# How to Integrate Kimi CLI with VS Code and Other Editors

> Integrate Kimi CLI with VS Code and other editors using ACP. Learn how Kimi's HTTP server enables seamless file operations, code execution, and chat within your IDE for enhanced productivity.

- Repository: [Moonshot AI/kimi-cli](https://github.com/MoonshotAI/kimi-cli)
- Tags: how-to-guide
- Published: 2026-07-24

---

**Kimi CLI integrates with VS Code and other editors via the Agent Client Protocol (ACP), exposing an HTTP server that the Kimi Code extension and third-party IDEs connect to for file operations, code execution, and chat.**

The `MoonshotAI/kimi-cli` repository provides a terminal-based interface for interacting with Kimi AI, but it also functions as a backend server for modern development environments. By leveraging the ACP protocol, you can integrate Kimi CLI with VS Code, Zed, JetBrains IDEs, and other editors that support custom agent servers.

## Understanding the Agent Client Protocol (ACP) Architecture

The integration architecture centers on Kimi CLI running in **ACP server mode**. When started with the `kimi acp` sub-command, the CLI launches an ACP-compatible HTTP server that exposes routes under `/api/open-in` and handles authentication via slash commands.

According to the source code in [`src/kimi_cli/acp.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/acp.py), this mode transforms the CLI from an interactive terminal application into a headless server that editors can connect to. The server listens on localhost and accepts requests for opening files, running code, and managing chat sessions.

The core components work as follows:

- **Kimi CLI** (`kimi acp`) - Hosts the ACP server and exposes HTTP routes
- **Kimi Code VS Code extension** - Connects to the ACP server and forwards user actions
- **`open_in` endpoint** ([`src/kimi_cli/web/api/open_in.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/web/api/open_in.py)) - Implements OS-specific logic for launching applications
- **Editor configuration** - Provides the command to start the ACP server and authentication details

## VS Code Integration via the Kimi Code Extension

The official **Kimi Code** extension available on the VS Code Marketplace provides seamless integration by communicating with a running Kimi CLI instance via ACP.

### Installing the Extension

Install the Kimi Code extension from the VS Code Marketplace. Once installed, the extension automatically configures itself to communicate with the Kimi CLI backend, though you can customize the connection settings if needed.

### Configuration Settings

The extension uses the following configuration in your VS Code [`settings.json`](https://github.com/MoonshotAI/kimi-cli/blob/main/settings.json):

```json
{
  "kimiCode.server.command": "kimi",
  "kimiCode.server.args": ["acp"]
}

```

These settings tell the extension how to spawn the Kimi CLI ACP server. The extension manages the server lifecycle, starting it automatically when VS Code launches and connecting via HTTP to the local ACP endpoint.

## Integrating Other Editors (Zed, JetBrains, etc.)

Any editor supporting custom agent servers can integrate with Kimi CLI through the ACP protocol. The repository provides configuration examples for Zed and JetBrains IDEs in the README.

### ACP Server Configuration

To connect Zed, JetBrains, or other compatible editors, add the following configuration to your editor's agent server settings:

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

```

This configuration specifies the command to start the ACP server (`kimi acp`) and any required environment variables.

### Authentication Flow

Before editors can interact with the Kimi CLI server, you must authenticate. In the terminal UI, type the `/login` slash command to authenticate your session. The authentication logic is handled in [`src/kimi_cli/ui/shell/slash.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/ui/shell/slash.py), which processes the login flow required for ACP clients.

Once authenticated, editors can send commands to open files, execute code, and initiate chat sessions through the HTTP API.

## How the Open-In Feature Works

The "open in editor" functionality is implemented in [`src/kimi_cli/web/api/open_in.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/web/api/open_in.py). This module contains the OS-specific logic for launching local applications including VS Code, Finder, Terminal, and iTerm.

When the Kimi Code extension or a curl request asks to open a file, the server executes platform-specific commands to launch the requested application with the specified path. For example, on macOS and Windows, the endpoint handles VS Code specifically through the `code` command or equivalent.

You can test this endpoint directly using curl:

```bash
curl -X POST http://localhost:8000/api/open-in \
  -H "Content-Type: application/json" \
  -d '{"app":"vscode","path":"~/myproject/main.py"}'

```

This HTTP POST request triggers the same logic used by the VS Code extension, demonstrating that the integration is essentially a thin client talking to the Kimi CLI backend.

## Starting the ACP Server

To begin integration with any editor, first start the Kimi CLI in ACP mode:

```bash

# Start Kimi CLI in ACP server mode

kimi acp

```

This command launches the ACP server listening on localhost (typically port 8000). The server remains active until terminated, handling requests from connected editors.

After starting the server, issue the authentication command in your terminal:

```bash

# In the Kimi CLI terminal interface

/login

```

Once authenticated, your configured editors can communicate with the server. The VS Code extension handles this automatically, while other editors require the JSON configuration shown above.

## Summary

- **Kimi CLI** runs an ACP server via the `kimi acp` command, enabling editor integration through HTTP endpoints
- The **Kimi Code** VS Code extension connects to this server using settings configured in `kimiCode.server.command` and `kimiCode.server.args`
- **Third-party editors** like Zed and JetBrains integrate using a JSON configuration block specifying the `kimi acp` command
- The **`/api/open-in`** endpoint in [`src/kimi_cli/web/api/open_in.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/web/api/open_in.py) handles OS-specific application launching for VS Code and other tools
- **Authentication** requires running the `/login` slash command (processed in [`src/kimi_cli/ui/shell/slash.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/ui/shell/slash.py)) before editors can access the ACP server

## Frequently Asked Questions

### What is the Agent Client Protocol (ACP) in Kimi CLI?

The Agent Client Protocol (ACP) is a communication standard implemented in Kimi CLI that allows external applications to interact with the AI backend. When running `kimi acp`, the CLI starts an HTTP server that exposes endpoints for file operations, code execution, and chat functionality. Editors connect to this server as clients, sending commands and receiving responses through the REST API.

### How do I authenticate an editor with Kimi CLI?

Authentication requires running the `/login` slash command in the Kimi CLI terminal interface. This command is handled by [`src/kimi_cli/ui/shell/slash.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/ui/shell/slash.py) and establishes the session credentials that the ACP server uses to validate requests from connected editors. You must complete this step once before any editor client can successfully communicate with the server.

### Can I use Kimi CLI with editors other than VS Code?

Yes. While Kimi CLI offers an official VS Code extension called Kimi Code, any editor supporting custom agent servers can integrate via ACP. The repository includes configuration examples for Zed and JetBrains IDEs, which require adding a JSON configuration block specifying the `kimi acp` command and arguments to your editor's settings.

### Where is the open-in logic implemented in the source code?

The logic for opening files in external applications is implemented in [`src/kimi_cli/web/api/open_in.py`](https://github.com/MoonshotAI/kimi-cli/blob/main/src/kimi_cli/web/api/open_in.py). This file contains the platform-specific code that launches VS Code, Finder, Terminal, iTerm, and other applications when the `/api/open-in` endpoint receives a POST request with the target application and file path parameters.