Skip to content
Kept
Connect tools

MCP server

Connect your coding agent to Kept to get cited answers from your team’s runbooks and docs. The MCP server runs on the Mac that runs Kept and exposes three read-only tools: ask, search and list_sources. Agents can’t create, edit, delete or manage documents. The HTTP API is read-only in the same way.

Before you start

  1. In Kept, open Settings → Sharing. Under Apps and AI tools, turn on Let apps and AI tools on this Mac use Kept.
  2. Create a key for the tool and name it for its use, such as “Claude Code on Sam’s Mac”. Copy it when it appears. It starts with kept_, Kept shows it once, and Kept stores only a hash of it.
  3. Add Kept to your agent using the setup below. Replace YOUR_KEY with your key or use the KEPT_KEY environment variable where shown.

If your agent uses a cloud model, the answers and passages Kept returns go to that model’s provider as part of the agent’s context. Use a local model to keep those results on the Mac.

Set up your agent

Run the agent on the same Mac as Kept. Every client connects to http://127.0.0.1:47822/mcp and sends Authorization: Bearer YOUR_KEY. The config file and field names vary by client.

Where the client supports environment variables, put export KEPT_KEY=kept_… in ~/.zshrc, open a new terminal, and reference KEPT_KEY as shown. Don’t commit a config file that contains a key.

AgentWhere it goes
Claude CodeOne command
CodexOne command or ~/.codex/config.toml
Cursor.cursor/mcp.json or ~/.cursor/mcp.json
VS Code (GitHub Copilot).vscode/mcp.json
Windsurf~/.codeium/windsurf/mcp_config.json
ZedZed’s settings.json
Gemini CLI~/.gemini/settings.json
OpenCodeopencode.json
ClineCline’s MCP settings
LM StudioLM Studio’s mcp.json
GooseExtensions settings
Claude Desktopclaude_desktop_config.json, through mcp-remote

After editing a config file, restart the agent or reload its MCP servers. These setups follow the clients’ documentation as of November 2026. If a client doesn’t connect, check its current MCP docs for a remote or HTTP server configuration.

Claude Code

Run this command to add Kept:

claude mcp add --transport http kept http://127.0.0.1:47822/mcp \
  --header "Authorization: Bearer $KEPT_KEY"

Add --scope user to use Kept in every project. Run claude mcp list to see whether it’s connected.

Codex

The Codex CLI and IDE extension share one config. Set KEPT_KEY in the environment Codex starts from. Register Kept with the CLI or add it to ~/.codex/config.toml. Both setups tell Codex to read the key from the environment without writing the key itself to the config file.

codex mcp add kept --url http://127.0.0.1:47822/mcp --bearer-token-env-var KEPT_KEY

Cursor

Add Kept to .cursor/mcp.json for one project or ~/.cursor/mcp.json for every project:

{
  "mcpServers": {
    "kept": {
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer ${env:KEPT_KEY}" }
    }
  }
}

Open Cursor Settings → MCP. Kept should show three tools.

VS Code (GitHub Copilot)

Add Kept to .vscode/mcp.json for a workspace, or run MCP: Open User Configuration from the Command Palette to configure it for all workspaces. The top-level key is servers and the server type is http:

{
  "servers": {
    "kept": {
      "type": "http",
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer ${input:kept-key}" }
    }
  },
  "inputs": [
    { "id": "kept-key", "type": "promptString", "description": "Kept API key", "password": true }
  ]
}

VS Code asks for the key once and stores it securely outside the config file. Use Kept from Copilot Chat in agent mode.

Windsurf

Open ~/.codeium/windsurf/mcp_config.json or go to Windsurf Settings → Cascade → MCP Servers → View raw config. Use serverUrl for the address:

{
  "mcpServers": {
    "kept": {
      "serverUrl": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer ${env:KEPT_KEY}" }
    }
  }
}

Press refresh in the MCP Servers panel after saving. On Teams and Enterprise plans, an admin may need to allow remote MCP servers.

Zed

Open Zed’s settings (⌘ + ,) and add Kept under context_servers:

{
  "context_servers": {
    "kept": {
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer YOUR_KEY" }
    }
  }
}

Kept appears in the Agent Panel settings. The dot turns green when Kept is connected.

Gemini CLI

Add Kept to ~/.gemini/settings.json or .gemini/settings.json in a project. Use httpUrl for Streamable HTTP. The url field selects the older SSE transport.

{
  "mcpServers": {
    "kept": {
      "httpUrl": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer $KEPT_KEY" }
    }
  }
}

Run /mcp in Gemini CLI to see Kept and its tools.

OpenCode

Add Kept to opencode.json in a project or ~/.config/opencode/opencode.json for all projects:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "kept": {
      "type": "remote",
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer {env:KEPT_KEY}" },
      "oauth": false
    }
  }
}

"oauth": false tells OpenCode to use the key without trying to sign in. Asking can take up to a minute. If OpenCode times out early, add "timeout": 90000.

Cline

In VS Code, open Cline’s MCP Servers panel, choose Configure MCP Servers, and add Kept:

{
  "mcpServers": {
    "kept": {
      "type": "streamableHttp",
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer YOUR_KEY" }
    }
  }
}

LM Studio

LM Studio runs models locally, so the results Kept returns stay on the Mac. Open Program → Install → Edit mcp.json in the right sidebar and add Kept:

{
  "mcpServers": {
    "kept": {
      "url": "http://127.0.0.1:47822/mcp",
      "headers": { "Authorization": "Bearer YOUR_KEY" }
    }
  }
}

Choose a model that supports tool use. Kept’s model and LM Studio’s model both need memory, so use a small model in LM Studio on a 16 GB Mac.

Goose

Use these values when Goose asks for the extension settings:

  • Type: Streamable HTTP
  • Endpoint: http://127.0.0.1:47822/mcp
  • Request headers: Authorization = Bearer YOUR_KEY

Open Extensions → Add custom extension.

Run goose configure, then choose Add Extension → Remote Extension (Streamable HTTP).

Claude Desktop

Claude Desktop’s built-in connectors reach servers through Anthropic’s cloud and can’t reach 127.0.0.1 on your Mac. Run the open-source mcp-remote bridge on the Mac instead. The bridge needs Node.js. Open Settings → Developer → Edit Config and add:

{
  "mcpServers": {
    "kept": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote", "http://127.0.0.1:47822/mcp",
        "--header", "Authorization:${KEPT_AUTH}"
      ],
      "env": { "KEPT_AUTH": "Bearer YOUR_KEY" }
    }
  }
}

Quit and reopen Claude Desktop. Keep the header as written, without a space after the colon: some apps split arguments at spaces. Claude Desktop sends what Kept returns to Anthropic’s servers.

Other clients

Any MCP client that supports Streamable HTTP with custom headers works. Look for a remote or HTTP server in the client’s docs, then enter the address and Authorization header. If the client can only run local commands, use the mcp-remote bridge as shown for Claude Desktop.

Check it works

  1. Ask your agent: “Use Kept to list the sources it has.” The agent should call list_sources and name your documents.
  2. Ask a question your docs cover, such as “Using Kept, how do we roll back a deploy?” The answer should come with citations.
  3. If the agent doesn’t connect, check the key with curl -H "Authorization: Bearer $KEPT_KEY" http://127.0.0.1:47822/v1/status. A 401 means the key is wrong. If there’s no response, Kept isn’t open or the API is off. See API and MCP errors.

Agents decide when to call a tool based on its description. To make yours use Kept without asking for it each time, add this line to its instructions file, such as CLAUDE.md, AGENTS.md or .cursor/rules: “For questions about our runbooks, policies or internal docs, ask the kept MCP server and cite its sources.”

Tools

Each tool returns structuredContent matching its outputSchema. It also returns the same JSON as text for clients that only read content.

ask

Get an answer from your documents with numbered citations. A local model writes the answer in 5 to 60 seconds.

questionstringrequired

The question in plain language. Up to 2,000 characters.

The result includes the answer and its citations:

ask result
{
  "kind": "grounded",
  "answer": "Roll back with the deploy tool's previous release, then confirm the error rate drops within 10 minutes [1]. Page the payments on-call if it doesn't [2].",
  "citations": [
    { "number": 1, "source": "payments-runbook.md", "category": "Runbooks", "quote": "To roll back, run deploy rollback payments --to previous…" },
    { "number": 2, "source": "on-call.md", "category": "Runbooks", "quote": "If the error rate hasn't recovered within 10 minutes, page…" }
  ]
}

kind is grounded when the answer comes from your documents or notFound when they don’t cover the question. pinned: true marks an answer the owner approved. If notice is present, show it alongside the answer.

If the answer has no [n] markers, citations contains the closest passages Kept found. Those passages don’t establish which ones the model used. From the next release, citationsAreExplicit is true when each citation matches a marker and false when the citations are only the closest passages. Until then, Kept omits the field. Tell your agent to quote a passage as a source only when its number appears in the answer. See the answer object.

Find the most relevant passages, best first, without generating an answer. Use it when the agent needs the exact wording.

querystringrequired

What to look for. Up to 2,000 characters.

limitinteger

How many passages to return, from 1 to 20. Defaults to 6.

The result contains passages. Each passage can include source, category, pageStart, pageEnd, heading, text and relevance (0 to 1). See the passage object.

list_sources

List the documents Kept answers from. This tool takes no input. The result contains sources. Each source can include id, name, type, category, status (ready, noText or error), pages and addedAt. See the source object.

When a tool fails

Kept returns a tool result with isError: true and a plain-language message for these failures:

  • The question or query is empty or too long.
  • The trial or subscription has ended. Listing sources still works.
  • The AI engine isn’t running or the model isn’t installed.
  • The client asked too many questions in the last minute.

An unknown tool name returns JSON-RPC error -32602.

Protocol

The endpoint is http://127.0.0.1:47822/mcp. It uses Streamable HTTP and returns plain JSON without an event stream. It is stateless, with no session IDs. Send one JSON-RPC message per request. Kept doesn’t support batches.

Protocol versionHow it works with Kept
2026-07-28No handshake. Send _meta["io.modelcontextprotocol/protocolVersion"] with every request, plus matching MCP-Protocol-Version and Mcp-Method headers. For tools/call, also send Mcp-Name. server/discover returns supported versions, capabilities, server info and instructions.
2025-03-26, 2025-06-18, 2025-11-25Send initialize, then notifications/initialized (Kept responds with 202), then requests.
CodeHTTPMeaning
-32700400The body isn’t valid JSON.
-32600400The body isn’t a single JSON-RPC 2.0 message.
-32601200 (404 on 2026-07-28)Method not supported.
-32602200Unknown tool.
-32020400A header doesn’t match the body (2026-07-28).
-32022400Unsupported protocol version. data.supported lists the stateless version Kept supports (2026-07-28). The older versions in the table above work through initialize.

Authentication, rate limits and HTTP-level errors (401, 402, 403, 429) are the same as for the HTTP API.

Security

  • This Mac only. Kept listens on 127.0.0.1. Other computers can’t reach port 47822.
  • Keys. Create one key per tool. Kept shows each key once, stores only its SHA-256 hash and compares hashes in constant time. Revoking a key stops it on the next request. Turning the API off stops every key.
  • Website requests. Kept requires a loopback Host to stop DNS rebinding and refuses requests with a non-loopback Origin. Websites can’t send Authorization without a CORS preflight, which Kept never approves.
  • Read-only access. No tool can add, change or delete anything. Kept doesn’t save questions from MCP in its history.
  • Untrusted text. Passages contain your documents’ words. Anyone who can edit a synced document can put text in front of your agent. Treat tool output as data, as you would a web page.

Something wrong or missing? Tell us.