Skip to content

Latest commit

 

History

History
114 lines (85 loc) · 2.39 KB

File metadata and controls

114 lines (85 loc) · 2.39 KB

Contributing | 貢獻指南

Thanks for your interest in contributing! This project bridges Kimi Code with Claude Code via MCP.

感謝你有興趣貢獻!本專案透過 MCP 將 Kimi Code 與 Claude Code 串接。

Getting Started | 開始

# Clone the repo
git clone https://github.com/howardpen9/kimi-code-mcp.git
cd kimi-code-mcp

# Install dependencies
npm install

# Run in development mode (auto-recompile)
npm run dev

# Build for production
npm run build

Prerequisites | 前置需求

  • Node.js >= 18
  • Kimi CLI installed: uv tool install kimi-cli
  • Kimi authenticated: kimi login

Project Structure | 專案結構

src/
├── index.ts           # MCP server + tool definitions
├── kimi-runner.ts     # CLI subprocess management
└── session-reader.ts  # Session metadata reader

Development Workflow | 開發流程

  1. Create a branch: git checkout -b feature/your-feature
  2. Make changes in src/
  3. Test locally:
    # Run the MCP server directly
    npm run dev
    
    # Or build and test with Claude Code
    npm run build
    # Then restart Claude Code to pick up changes
  4. Commit with descriptive messages
  5. Open a PR

Testing with Claude Code | 用 Claude Code 測試

Add to your .mcp.json:

{
  "mcpServers": {
    "kimi-code": {
      "command": "npx",
      "args": ["tsx", "/path/to/your/clone/src/index.ts"]
    }
  }
}

Then in Claude Code, use /mcp to verify the server is connected.

Adding New Tools | 新增工具

To add a new MCP tool:

  1. Define the tool in src/index.ts using server.tool()
  2. Use Zod schemas for input validation
  3. Handle errors gracefully (return isError: true with message)
  4. Add appropriate timeouts

Example:

server.tool(
  'kimi_new_tool',
  'Description of what the tool does',
  {
    param: z.string().describe('Parameter description'),
  },
  async ({ param }) => {
    // Implementation
    return { content: [{ type: 'text' as const, text: result }] }
  }
)

Code Style | 程式碼風格

  • TypeScript strict mode
  • ES modules (import/export)
  • Async/await for all async operations
  • Descriptive error messages

Reporting Issues | 回報問題

Please open an issue with:

  • Your Node.js version
  • Kimi CLI version (kimi --version)
  • Error output / logs
  • Steps to reproduce

License

By contributing, you agree your contributions will be licensed under MIT.