For AI agents: a documentation index is available at /llms.txt
Skip to main content

Browserless MCP in Kimi Code CLI

Moonshot AI's Kimi Code CLI connects to the hosted Browserless MCP server from a user or project mcp.json, with OAuth or an API token. Once it's connected, Kimi Code CLI can scrape, search, crawl, and drive a cloud browser with the Browserless MCP tools.

Prerequisites
  • A Browserless API token from your account dashboard, or a Browserless account for OAuth sign-in
  • Kimi Code CLI installed. This is the Node.js kimi-code release, not the legacy Python kimi-cli, which stored its config under ~/.kimi/.

Connect to the hosted server​

The hosted server runs at https://mcp.browserless.io/mcp, so there's nothing to install.

Add to ~/.kimi-code/mcp.json for every project, or .kimi-code/mcp.json for one project:

{
"mcpServers": {
"browserless": {
"url": "https://mcp.browserless.io/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
}
}
}
}

Kimi Code CLI treats an entry with a url and no transport as a Streamable HTTP server. To keep the token out of the file, replace the headers block with "bearerTokenEnvVar": "BROWSERLESS_TOKEN" and set BROWSERLESS_TOKEN in your environment. To sign in with OAuth instead, drop the headers block and run /mcp-config login browserless in Kimi Code CLI, which opens a browser window to your Browserless account.

You can also run /mcp-config inside Kimi Code CLI to add or edit the entry interactively instead of editing the JSON by hand.

To use a region other than US West with an API token, add an x-browserless-api-url header to headers. With OAuth, add a browserlessUrl query parameter to the server URL instead: Kimi Code CLI treats any headers entry as static credentials and skips OAuth. See regional endpoints.

Run the server locally​

To run the MCP server process on your machine instead, use the @browserless.io/mcp npm package over stdio. You need Node.js 24 or newer. Browser work still runs on Browserless, so this is mainly for pinning a server version (add it to the package name, for example @browserless.io/mcp@1.41.0) or pointing at a self-hosted instance with BROWSERLESS_API_URL. Both setups use the server name browserless, so replace the hosted entry with this one rather than adding both. Edit the same file that holds the hosted entry: a project-level .kimi-code/mcp.json entry overrides a user-level entry with the same name, so adding this to ~/.kimi-code/mcp.json alone leaves a project-level hosted entry active.

Add to ~/.kimi-code/mcp.json (or your project's .kimi-code/mcp.json):

{
"mcpServers": {
"browserless": {
"command": "npx",
"args": ["-y", "@browserless.io/mcp"],
"env": {
"BROWSERLESS_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}

Check the connection​

Start a new Kimi Code CLI session and run /mcp. browserless should be listed as connected. Its tools are named mcp__browserless__<tool>, so they read mcp__browserless__browserless_agent and so on.

FAQ & Troubleshooting​

I edited mcp.json but the Browserless tools don't show up

Kimi Code CLI only registers servers added mid-session in sessions created afterwards. Start a new session, then run /mcp again.

The project-level .kimi-code/mcp.json entry is ignored

Project-level servers only load in a trusted workspace. Accept the workspace trust prompt when Kimi Code CLI asks. For headless runs such as kimi -p in CI, set KIMI_CODE_TRUST_WORKSPACE=1, or move the entry to ~/.kimi-code/mcp.json.

The server connects but every tool call returns 401 Unauthorized

The token is missing or wrong. Copy it again from your account dashboard and check the header reads Bearer followed by the token, with no quotes or trailing whitespace inside the value. The hosted server accepts the connection with any bearer token and checks it on each tool call, so with a wrong token /mcp still shows browserless as connected while tool calls fail with Server error 401: Invalid API key. If you used bearerTokenEnvVar and BROWSERLESS_TOKEN isn't set in the environment Kimi Code CLI was launched from, the server shows as failed instead. Fix the token, then start a new session.

I migrated from the Python kimi-cli and OAuth stopped working

kimi migrate copies your MCP server config but not MCP authorizations. Run /mcp-config login browserless again to sign in.

Next steps​

Was this page helpful?