MCPcopy Index your code
hub / github.com/MoonshotAI/kimi-cli

github.com/MoonshotAI/kimi-cli @1.48.0

repository ↗ · DeepWiki ↗ · release 1.48.0 ↗ · + Follow
8,560 symbols 44,362 edges 706 files 3,005 documented · 35%
README

Kimi CLI

Commit Activity Checks Version Downloads Ask DeepWiki

Kimi Code | Documentation | 文档

[!IMPORTANT] Kimi CLI is evolving into Kimi Code CLI — the next-generation terminal AI agent from the same team. Installing Kimi Code CLI automatically migrates your configuration and sessions. This project will be gradually wound down; the docs and existing installations remain available.

Kimi 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.

Getting Started

See Getting Started for how to install and start using Kimi CLI.

Key Features

Shell command mode

Kimi 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 CLI.

[!NOTE] Built-in shell commands like cd are not supported yet.

VS Code extension

Kimi CLI can be integrated with Visual Studio Code via the Kimi Code VS Code Extension.

VS Code Extension

IDE integration via ACP

Kimi CLI supports Agent Client Protocol out of the box. You can use it together with any ACP-compatible editor or IDE.

To use Kimi CLI with ACP clients, make sure to run Kimi CLI in the terminal and send /login to complete the login first. Then, you can configure your ACP client to start Kimi CLI as an ACP agent server with command kimi acp.

For example, to use Kimi CLI with Zed or JetBrains, add the following configuration to your ~/.config/zed/settings.json or ~/.jetbrains/acp.json file:

{
  "agent_servers": {
    "Kimi CLI": {
      "type": "custom",
      "command": "kimi",
      "args": ["acp"],
      "env": {}
    }
  }
}

Then you can create Kimi CLI threads in IDE's agent panel.

Zsh integration

You can use Kimi CLI together with Zsh, to empower your shell experience with AI agent capabilities.

Install the zsh-kimi-cli plugin via:

git clone https://github.com/MoonshotAI/zsh-kimi-cli.git \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/kimi-cli

[!NOTE] If you are using a plugin manager other than Oh My Zsh, you may need to refer to the plugin's README for installation instructions.

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 support

Kimi 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:

# Add streamable HTTP server:
kimi mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: ctx7sk-your-key"

# Add streamable HTTP server with OAuth authorization:
kimi mcp add --transport http --auth oauth linear https://mcp.linear.app/mcp

# Add stdio server:
kimi mcp add --transport stdio chrome-devtools -- npx chrome-devtools-mcp@latest

# List added MCP servers:
kimi mcp list

# Remove an MCP server:
kimi mcp remove chrome-devtools

# Authorize an MCP server:
kimi mcp auth linear

Ad-hoc MCP configuration

Kimi 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

More

See more features in the Documentation.

Development

To develop Kimi 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 CLI.

Refer to the following commands after you make changes:

uv run kimi  # run Kimi CLI

make format  # format code
make check  # run linting and type checking
make test  # run tests
make test-kimi-cli  # run Kimi 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.

Extension points exported contracts — how you extend this code

SpeechRecognition (Interface)
(no doc) [6 implementers]
web/src/components/ai-elements/prompt-input.tsx
EventMeta (Interface)
Metadata attached to each event for tool call grouping
vis/src/features/wire-viewer/wire-viewer.tsx
ApiResponse (Interface)
(no doc) [4 implementers]
web/src/lib/api/runtime.ts
SessionStatsData (Interface)
(no doc)
vis/src/App.tsx
SpeechRecognitionEvent (Interface)
(no doc)
web/src/components/ai-elements/prompt-input.tsx
CacheEntry (Interface)
(no doc)
vis/src/lib/cache.ts
SpeechRecognitionErrorEvent (Interface)
(no doc)
web/src/components/ai-elements/prompt-input.tsx
SessionMetadataInfo (Interface)
(no doc)
vis/src/lib/api.ts

Core symbols most depended-on inside this repo

append
called by 1002
src/kimi_cli/ui/shell/visualize/_blocks.py
write_text
called by 496
packages/kaos/src/kaos/path.py
mkdir
called by 394
src/kimi_cli/acp/kaos.py
join
called by 387
src/kimi_cli/wire/__init__.py
get
called by 288
src/kimi_cli/utils/aioqueue.py
cn
called by 264
web/src/lib/utils.ts
exists
called by 261
packages/kaos/src/kaos/path.py
unsafe_from_local_path
called by 166
packages/kaos/src/kaos/path.py

Shape

Function 4,356
Method 3,167
Class 872
Interface 121
Route 44

Languages

Python87%
TypeScript13%

Modules by API surface

tests/ui_and_conv/test_export_import.py132 symbols
src/kimi_cli/ui/shell/prompt.py119 symbols
tests/telemetry/test_instrumentation.py118 symbols
tests/ui_and_conv/test_btw.py90 symbols
tests/ui_and_conv/test_visualize_running_prompt.py88 symbols
tests/core/test_plan_mode.py85 symbols
src/kimi_cli/soul/kimisoul.py82 symbols
tests/ui_and_conv/test_prompt_tips.py81 symbols
src/kimi_cli/utils/rich/markdown.py79 symbols
tests/core/test_skill.py73 symbols
web/src/lib/api/runtime.ts70 symbols
src/kimi_cli/ui/shell/__init__.py70 symbols

Dependencies from manifests, versioned

@biomejs/biome2.3.8 · 1×
@codemirror/lang-yaml6.1.2 · 1×
@radix-ui/react-collapsible1.1.12 · 1×
@radix-ui/react-context-menu2.2.16 · 1×
@radix-ui/react-dialog1.1.15 · 1×
@radix-ui/react-dropdown-menu2.1.16 · 1×
@radix-ui/react-hover-card1.1.15 · 1×
@radix-ui/react-progress1.1.8 · 1×
@radix-ui/react-scroll-area1.2.10 · 1×

Datastores touched

dbDatabase · 1 repos

For agents

$ claude mcp add kimi-cli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact