Connect your codebase to Kimi: Ultra-fast AI code analysis with Kimi-K2 model via MCP
npm install ken-you-codeConnect your codebase to Kimi - Ultra-fast AI code analysis with Kimi-K2 model via MCP
A specialized Model Context Protocol (MCP) server built by Ken Kai does AI that enables Claude Code to delegate tasks to the powerful Kimi-K2 model via OpenRouter. Get lightning-fast code analysis, debugging, security reviews, and more.
- 10 Specialized Task Types: debug, analyze, review, optimize, style, document, test, refactor, migrate, design
- Ultra-Fast Performance: Optimized prompts for 50x speed improvement (1-2 seconds vs 30+ seconds)
- Kimi-K2 Integration: Leverage the powerful moonshotai/kimi-k2 model via OpenRouter
- Secure File Operations: Read files with configurable security restrictions (.tsx, .jsx, .py, .js, .ts, etc.)
- Diff-Based Workflow: Create and apply file changes with approval workflows and automatic backups
- Type-Safe: Built with TypeScript and Zod validation
Find and fix bugs in your code
Analyze code structure, patterns, and potential issues
Review code quality, best practices, and security
Optimize performance and efficiency
Check and improve code style and formatting
Generate documentation and comments
Create and improve test coverage
Refactor code for better maintainability
Migrate code between frameworks or versions
Design UI/UX components and layouts
Read file content securely with path validation and size limits.
Parameters:
- file_path: Absolute path to the file
Generate a diff for proposed file changes without applying them.
Parameters:
- file_path: Target file path
- new_content: Proposed file content
- reason: Explanation for the change
Apply a previously created diff with user approval.
Parameters:
- operation_id: Diff operation identifier
- approved: Boolean approval for the change
- Claude Code
- OpenRouter API key
Add to Claude Code:
``bash`
claude mcp add ken-you-code -s user -e OPENROUTER_API_KEY=
That's it! The MCP will be downloaded and configured automatically.
| Variable | Required | Default | Description |
| -------------------- | -------- | -------------------- | --------------------------------------- |
| OPENROUTER_API_KEY | Yes | - | OpenRouter API key |WORKSPACE_ROOT
| | No | - | Restrict file access to this directory |LOG_LEVEL
| | No | INFO | Logging level |DEFAULT_MODEL
| | No | moonshotai/kimi-k2 | Default model for tasks |MAX_FILE_SIZE_MB
| | No | 10 | Maximum file size in MB |ALLOWED_EXTENSIONS
| | No | .py,.js,.ts,... | Comma-separated allowed file extensions |
- Path Validation: Only absolute paths within allowed directories
- Extension Filtering: Configurable allowed file extensions
- Size Limits: Maximum file size enforcement
- Forbidden Paths: Automatic blocking of sensitive directories (.env, .git/, node_modules/, etc.)
- All file modifications require explicit user approval
- Automatic backup creation before applying changes
- Operation tracking with unique IDs
`bash`
npm run dev # Development mode with watch
npm run build # Build TypeScript
npm run test # Run tests
npm run lint # Lint code
npm run lint:fix # Fix linting issues
npm run format # Format code
``
src/
├── server.ts # Main MCP server
├── tools/
│ ├── fileOperations.ts # Secure file reading
│ ├── specializedTask.ts # OpenRouter integration
│ └── diffManager.ts # Diff creation and application
├── config/
│ └── index.ts # Configuration management
└── types/
└── index.ts # Type definitions and validation
`typescript`
// Claude Code can call:
await mcp.call('specialized_task', {
task_type: 'debug',
context: 'Performance issue with database queries',
files: ['/project/src/database.ts', '/project/src/queries.ts'],
});
`typescript`
await mcp.call('specialized_task', {
task_type: 'review',
context: 'Review this authentication implementation for security',
files: ['/project/src/auth.ts'],
});
`typescript
// Create diff
const diffResult = await mcp.call('create_diff', {
file_path: '/project/src/auth.ts',
new_content: '// Updated code here...',
reason: 'Fix security vulnerability identified in review',
});
// Apply with approval
await mcp.call('apply_diff', {
operation_id: diffResult.operation_id,
approved: true,
});
`
Powered by Kimi-K2 (moonshotai/kimi-k2`) via OpenRouter - known for exceptional code analysis, debugging capabilities, and ultra-fast performance.
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Ensure linting and build pass
6. Submit a pull request
MIT License - see LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Review existing GitHub issues
- Create a new issue with detailed information