packages/kilo-docs/pages/automate/mcp/using-in-kilo-code.md
Model Context Protocol (MCP) extends Kilo Code's capabilities by connecting to external tools and services. This guide covers everything you need to know about using MCP with Kilo Code.
{% youtube url="https://youtu.be/6O9RQoQRX8A" caption="Demonstrating MCP installation in Kilo Code" /%}
{% tabs %} {% tab label="VSCode" %}
MCP server configurations are stored inside the main Kilo config file. There are two levels:
~/.config/kilo/kilo.jsonc — applies to all projects.kilo.jsonc in your project root, or .kilo/kilo.jsonc for a cleaner setup.Precedence: Project-level configuration takes precedence over global configuration.
You can edit MCP settings from the Kilo Code settings UI:
Agent Behaviour tab on the left side.MCP Servers sub-tab.From here you can add, edit, enable/disable, and delete MCP servers. Changes are written directly to the appropriate config file.
MCP servers are configured under the mcp key in kilo.jsonc:
Local (STDIO) server:
{
"mcp": {
"my-local-server": {
"type": "local",
"command": ["node", "/path/to/server.js"],
"environment": {
"API_KEY": "your_api_key"
},
"enabled": true,
"timeout": 10000
}
}
}
Remote (HTTP/SSE) server:
{
"mcp": {
"my-remote-server": {
"type": "remote",
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer your-token"
},
"enabled": true,
"timeout": 15000
}
}
}
Remote servers support OAuth 2.0 authentication. If the server supports it, Kilo Code will automatically start the OAuth flow when you connect. You can also disable OAuth with "oauth": false.
{% /tab %} {% tab label="VSCode (Legacy)" %}
MCP server configurations can be managed at two levels: global (applies across all workspaces) and project-level (specific to a single project). Project-level configuration takes precedence over global settings.
| Scope | Path | Description |
|---|---|---|
| Global | mcp_settings.json | Accessible via VS Code settings. Applies across all workspaces. |
| Project | .kilocode/mcp.json | In your project root. Auto-detected by Kilo Code. |
Project-level configs can be committed to version control to share with your team.
{% /tab %} {% tab label="CLI" %}
The CLI accepts several config filenames. The recommended file is kilo.json:
| Scope | Recommended Path | Also supported |
|---|---|---|
| Global | ~/.config/kilo/kilo.json | kilo.jsonc, opencode.json, opencode.jsonc, config.json |
| Project | ./kilo.json or ./.kilo/kilo.json | kilo.jsonc, opencode.jsonc, opencode.json |
{% /tab %} {% /tabs %}
{% tabs %} {% tab label="VSCode (Legacy)" %}
Both global and project-level files use a JSON format with a mcpServers object containing named server configurations:
{
"mcpServers": {
"server1": {
"command": "python",
"args": ["/path/to/server.py"],
"env": {
"API_KEY": "your_api_key"
},
"alwaysAllow": ["tool1", "tool2"],
"disabled": false
}
}
}
Example of MCP Server config in Kilo Code (STDIO Transport)
{% /tab %} {% tab label="VSCode" %}
In the VS Code extension, open Settings → MCP and click Add Server to configure a new server through the UI. You can also edit the config files directly — see the CLI tab for the JSON format.
{% /tab %} {% tab label="CLI" %}
Add MCP servers under the mcp key in your config file. Each server has a unique name that you can reference in prompts.
{
"mcp": {
"my-server": {
"type": "local",
"command": ["npx", "-y", "my-mcp-command"],
"enabled": true
}
}
}
You can disable a server by setting enabled to false without removing it from your config.
{% /tab %} {% /tabs %}
MCP supports two main transport types:
StreamableHTTP first, then falls back to SSE automatically.For more details, see STDIO & SSE Transports.
Used for local servers running on your machine:
For more in-depth information about how STDIO transport works, see STDIO Transport.
STDIO configuration example:
{% tabs %} {% tab label="VSCode (Legacy)" %}
{
"mcpServers": {
"local-server": {
"command": "node",
"args": ["/path/to/server.js"],
"env": {
"API_KEY": "your_api_key"
},
"alwaysAllow": ["tool1", "tool2"],
"disabled": false
}
}
}
{% /tab %} {% tab label="VSCode" %}
In the VS Code extension, open Settings → MCP, click Add Server, and choose Local (stdio). Fill in the command, arguments, and optional environment variables through the UI. You can also edit the config files directly — see the CLI tab for the JSON format.
{% /tab %} {% tab label="CLI" %}
{
"mcp": {
"my-local-server": {
"type": "local",
"command": ["npx", "-y", "my-mcp-command"],
"enabled": true,
"environment": {
"API_KEY": "your_api_key"
}
}
}
}
| Option | Type | Required | Description |
|---|---|---|---|
type | String | Yes | Must be "local". |
command | Array | Yes | Command and arguments to run the MCP server. |
environment | Object | No | Environment variables to set when running the server. |
enabled | Boolean | No | Enable or disable the MCP server on startup. |
timeout | Number | No | Timeout in ms for fetching tools from the MCP server. Default: 30000. |
{% /tab %} {% /tabs %}
Used for remote servers accessed over HTTP/HTTPS:
{% tabs %} {% tab label="VSCode (Legacy)" %}
{
"mcpServers": {
"remote-server": {
"type": "streamable-http",
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer your-token"
},
"alwaysAllow": ["tool3"],
"disabled": false
}
}
}
{% /tab %} {% tab label="VSCode" %}
In the VS Code extension, open Settings → MCP, click Add Server, and choose Remote (HTTP). Enter the server URL and optional headers through the UI. You can also edit the config files directly — see the CLI tab for the JSON format.
{% /tab %} {% tab label="CLI" %}
{
"mcp": {
"my-remote-server": {
"type": "remote",
"url": "https://my-mcp-server.com/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer MY_API_KEY"
}
}
}
}
| Option | Type | Required | Description |
|---|---|---|---|
type | String | Yes | Must be "remote". |
url | String | Yes | URL of the remote MCP server. |
enabled | Boolean | No | Enable or disable the MCP server on startup. |
headers | Object | No | HTTP headers to send with requests. |
timeout | Number | No | Timeout in ms for fetching tools from the MCP server. Default: 30000. |
{% /tab %} {% /tabs %}
⚠️ DEPRECATED: The SSE Transport has been deprecated as of MCP specification version 2025-03-26. Please use the HTTP Stream Transport instead, which implements the new Streamable HTTP transport specification.
Used for remote servers accessed over HTTP/HTTPS:
For more in-depth information about how SSE transport works, see SSE Transport.
SSE configuration example:
{
"mcpServers": {
"remote-server": {
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer your-token"
},
"alwaysAllow": ["tool3"],
"disabled": false
}
}
}
{% tabs %} {% tab label="VSCode (Legacy)" %}
You can edit both global and project-level MCP configuration files directly from the Kilo Code settings.
Settings.Agent Behaviour tab on the left sideMCP Servers sub-tabEdit Global MCP: Opens the global mcp_settings.json file.Edit Project MCP: Opens the project-specific .kilocode/mcp.json file. If this file doesn't exist, Kilo Code will create it for you.{% image src="/docs/img/using-mcp-in-kilo-code/mcp-installed-config.png" alt="Edit Global MCP and Edit Project MCP buttons" width="600" caption="Edit Global MCP and Edit Project MCP buttons" /%}
Delete button on the confirmation box{% image src="/docs/img/using-mcp-in-kilo-code/using-mcp-in-kilo-code-5.png" alt="Delete confirmation box" width="400" caption="Delete confirmation box" /%}
{% /tab %} {% tab label="VSCode" %}
In the VS Code extension, manage MCP servers from Settings → MCP:
The extension also supports the {env:VARIABLE_NAME} syntax in config files to reference environment variables (see the CLI tab for details).
{% /tab %} {% tab label="CLI" %}
| Command | Description |
|---|---|
kilo mcp list | List all configured MCP servers |
kilo mcp add | Add an MCP server |
kilo mcp auth | Authenticate with an MCP server |
kilo mcp logout | Log out from an MCP server |
kilo mcp debug | Debug an MCP server connection |
Inside the interactive TUI, use the /mcps slash command to toggle MCP servers on or off.
Use {env:VARIABLE_NAME} syntax in config files to reference environment variables:
{
"mcp": {
"my-server": {
"type": "remote",
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer {env:MY_API_KEY}"
}
}
}
}
{% /tab %} {% /tabs %}
{% tabs %} {% tab label="VSCode" %}
Set the timeout field (in milliseconds) in the server's config entry. The default is 10 seconds for local servers and 15 seconds for remote servers.
{% /tab %} {% tab label="VSCode (Legacy)" %}
To set the maximum time to wait for a response after a tool call to the MCP server:
Network Timeout pulldown at the bottom of the individual MCP server's config box and change the time. Default is 1 minute but it can be set between 30 seconds and 5 minutes.{% image src="/docs/img/using-mcp-in-kilo-code/using-mcp-in-kilo-code-6.png" alt="Network Timeout pulldown" width="400" caption="Network Timeout pulldown" /%}
{% /tab %} {% /tabs %}
{% tabs %} {% tab label="VSCode" %}
MCP tool calls use the same permission system as built-in tools. Each MCP tool's permission key is its namespaced name: {server}_{tool} (e.g. my_server_do_something).
At runtime: When an MCP tool is called, the Permission Dock shows an approval prompt. Click Approve Always to save an allow rule to your config so future calls to that tool are auto-approved.
In your config file: Add the tool name (or a wildcard pattern) to the permission key in kilo.jsonc:
{
"permission": {
"my_server_do_something": "allow",
"my_server_*": "allow"
}
}
{% /tab %} {% tab label="VSCode (Legacy)" %}
MCP tool auto-approval works on a per-tool basis and is disabled by default. To configure auto-approval:
Always allow checkbox next to the tool name{% image src="/docs/img/using-mcp-in-kilo-code/using-mcp-in-kilo-code-7.png" alt="Always allow checkbox for MCP tools" width="120" caption="Always allow checkbox for MCP tools" /%}
When enabled, Kilo Code will automatically approve this specific tool without prompting. Note that the global "Use MCP servers" setting takes precedence - if it's disabled, no MCP tools will be auto-approved.
{% /tab %} {% /tabs %}
{% tabs %} {% tab label="VSCode (Legacy)" %}
When setting up MCP servers on Windows, you'll need to use the Windows Command Prompt (cmd) to execute commands. Here's an example of configuring a Puppeteer MCP server on Windows:
{
"mcpServers": {
"puppeteer": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}
This Windows-specific configuration:
cmd command to access the Windows Command Prompt/c to tell cmd to execute the command and then terminatenpx to run the package without installing it permanently-y flag automatically answers "yes" to any prompts during installation@modelcontextprotocol/server-puppeteer package which provides browser automation capabilities{% callout type="note" %} For macOS or Linux, you would use a different configuration:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}
{% /callout %}
{% /tab %} {% tab label="VSCode" %}
In the VS Code extension, use Settings → MCP → Add Server to add any of the examples below through the UI. You can also edit the config files directly — see the CLI tab for the JSON format.
{% /tab %} {% tab label="CLI" %}
When setting up local MCP servers on Windows, use the full cmd invocation in the command array:
{
"mcp": {
"puppeteer": {
"type": "local",
"command": ["cmd", "/c", "npx", "-y", "@modelcontextprotocol/server-puppeteer"],
"enabled": true
}
}
}
The same approach can be used for other MCP servers on Windows, adjusting the package name as needed for different server types.
Connect to the Figma Desktop app's MCP server:
{
"mcp": {
"Figma Desktop": {
"type": "remote",
"url": "http://127.0.0.1:3845/mcp"
}
}
}
Add the Context7 MCP server for documentation search:
{
"mcp": {
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp"
}
}
}
Add the test MCP server for development:
{
"mcp": {
"mcp_everything": {
"type": "local",
"command": ["npx", "-y", "@modelcontextprotocol/server-everything"]
}
}
}
{% /tab %} {% /tabs %}
Kilo Code does not come with any pre-installed MCP servers. You'll need to find and install them separately.
For full SDK documentation, visit the MCP GitHub repository.
After configuring an MCP server, Kilo Code will automatically detect available tools and resources. To use them:
Example: "Analyze the performance of my API" might use an MCP tool that tests API endpoints.
{% tabs %} {% tab label="VSCode" %}
needs_auth status: For remote servers with OAuth, the extension will show a notification to start the auth flow. Click it to authenticate.failed status: Check the CLI output for error details. Ensure commands and paths are correct.{% /tab %} {% tab label="VSCode (Legacy)" %}
mcp_settings.json (for global settings) or .kilocode/mcp.json (for project settings).{% /tab %} {% tab label="CLI" %}
kilo mcp debug <server-name> to inspect the connection.kilo.jsonc config or via {env:VARIABLE_NAME} references."enabled": false) in your config.timeout value for the specific MCP server in your config.{% /tab %} {% /tabs %}
{% callout type="tip" %} Reduce system prompt size: If you're not using MCP, turn it off in Settings > Agent Behaviour > MCP Servers to significantly cut down the size of the system prompt and improve performance. {% /callout %}