MoonshotAI/kimi-cli

GitHub: MoonshotAI/kimi-cli

终端中的 AI 编码代理,帮助完成代码操作与终端命令的自动化规划执行。

Stars: 7993 | Forks: 895

# Kimi Code CLI [![Commit Activity](https://img.shields.io/github/commit-activity/w/MoonshotAI/kimi-cli)](https://github.com/MoonshotAI/kimi-cli/graphs/commit-activity) [![Checks](https://img.shields.io/github/check-runs/MoonshotAI/kimi-cli/main)](https://github.com/MoonshotAI/kimi-cli/actions) [![Version](https://img.shields.io/pypi/v/kimi-cli)](https://pypi.org/project/kimi-cli/) [![Downloads](https://img.shields.io/pypi/dw/kimi-cli)](https://pypistats.org/packages/kimi-cli) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/MoonshotAI/kimi-cli) [Kimi Code](https://www.kimi.com/code/) | [Documentation](https://moonshotai.github.io/kimi-cli/en/) | [文档](https://moonshotai.github.io/kimi-cli/zh/) Kimi Code CLI is an AI agent that runs in the terminal, helping you complete software development tasks and terminal operations. It can read and edit code, execute shell commands, search and fetch web pages, and autonomously plan and adjust actions during execution. ## 入门指南 See [Getting Started](https://moonshotai.github.io/kimi-cli/en/guides/getting-started.html) for how to install and start using Kimi Code CLI. ## 主要功能 ### Shell 命令模式 Kimi Code CLI is not only a coding agent, but also a shell. You can switch the shell command mode by pressing `Ctrl-X`. In this mode, you can directly run shell commands without leaving Kimi Code CLI. ![](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/2df332c912194232.gif) ### VS Code 扩展 Kimi Code CLI can be integrated with [Visual Studio Code](https://code.visualstudio.com/) via the [Kimi Code VS Code Extension](https://marketplace.visualstudio.com/items?itemName=moonshot-ai.kimi-code). ![VS Code Extension](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/1316409eae194233.png) ### 通过 ACP 的 IDE 集成 Kimi Code CLI supports [Agent Client Protocol] out of the box. You can use it together with any ACP-compatible editor or IDE. To use Kimi Code CLI with ACP clients, make sure to run Kimi Code CLI in the terminal and send `/login` to complete the login first. Then, you can configure your ACP client to start Kimi Code CLI as an ACP agent server with command `kimi acp`. For example, to use Kimi Code CLI with [Zed](https://zed.dev/) or [JetBrains](https://blog.jetbrains.com/ai/2025/12/bring-your-own-ai-agent-to-jetbrains-ides/), add the following configuration to your `~/.config/zed/settings.json` or `~/.jetbrains/acp.json` file: ``` { "agent_servers": { "Kimi Code CLI": { "type": "custom", "command": "kimi", "args": ["acp"], "env": {} } } } ``` Then you can create Kimi Code CLI threads in IDE's agent panel. ![](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/49b23d8241194235.gif) ### Zsh 集成 You can use Kimi Code CLI together with Zsh, to empower your shell experience with AI agent capabilities. Install the [zsh-kimi-cli](https://github.com/MoonshotAI/zsh-kimi-cli) plugin via: ``` git clone https://github.com/MoonshotAI/zsh-kimi-cli.git \ ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/kimi-cli ``` Then add `kimi-cli` to your Zsh plugin list in `~/.zshrc`: ``` plugins=(... kimi-cli) ``` After restarting Zsh, you can switch to agent mode by pressing `Ctrl-X`. ### MCP 支持 Kimi Code CLI supports MCP (Model Context Protocol) tools. **`kimi mcp` sub-command group** You can manage MCP servers with `kimi mcp` sub-command group. For example: ``` # 添加可流式传输的 HTTP 服务器: kimi mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: ctx7sk-your-key" # 添加带有 OAuth 授权的可流式传输的 HTTP 服务器: kimi mcp add --transport http --auth oauth linear https://mcp.linear.app/mcp # 添加 stdio 服务器: kimi mcp add --transport stdio chrome-devtools -- npx chrome-devtools-mcp@latest # 列出已添加的 MCP 服务器: kimi mcp list # 移除 MCP 服务器: kimi mcp remove chrome-devtools # 授权 MCP 服务器: kimi mcp auth linear ``` **Ad-hoc MCP configuration** Kimi Code CLI also supports ad-hoc MCP server configuration via CLI option. Given an MCP config file in the well-known MCP config format like the following: ``` { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } }, "chrome-devtools": { "command": "npx", "args": ["-y", "chrome-devtools-mcp@latest"] } } } ``` Run `kimi` with `--mcp-config-file` option to connect to the specified MCP servers: ``` kimi --mcp-config-file /path/to/mcp.json ``` ### 更多 See more features in the [Documentation](https://moonshotai.github.io/kimi-cli/en/). ## 开发 To develop Kimi Code CLI, run: ``` git clone https://github.com/MoonshotAI/kimi-cli.git cd kimi-cli make prepare # prepare the development environment ``` Then you can start working on Kimi Code CLI. Refer to the following commands after you make changes: ``` uv run kimi # run Kimi Code CLI make format # format code make check # run linting and type checking make test # run tests make test-kimi-cli # run Kimi Code CLI tests only make test-kosong # run kosong tests only make test-pykaos # run pykaos tests only make build-web # build the web UI and sync it into the package (requires Node.js/npm) make build # build python packages make build-bin # build standalone binary make help # show all make targets ``` Note: `make build` and `make build-bin` automatically run `make build-web` to embed the web UI.
标签:ACp 集成, Agent Client Protocol, AI 代理, AI 编程, AI 辅助编程, CLI 工具, Kimi Code, Moonshot AI, Python CLI, Shell 模式, Subfinder, VS Code 扩展, Web 搜索, 二进制发布, 代码修复, 代码搜索, 代码编辑, 威胁情报, 开发者工具, 开源工具, 技术栈, 终端助手, 自主规划, 自动化任务, 软件开发, 逆向工具