
### Kimi Code CLI

Auth: Personal OAuth (recommended): choose your account or an agent profile with selected access during authorization. [Profile selection and setup](/docs/agents).

1. Add the server to `~/.kimi-code/mcp.json` at user level, or to `.kimi-code/mcp.json` in the working directory at project level, as shown below. The HTTP MCP endpoint is `https://meinkontext.de/mcp`.
2. Start a new Kimi session. A server added by editing `mcp.json` does not register in an already-open session.
3. Run `/mcp-config login meinkontext`, then authorize your meinKontext account or an agent profile in the browser.
4. Run `/mcp` and check the connection status for `meinkontext`.

```json
{
  "mcpServers": {
    "meinkontext": {
      "url": "https://meinkontext.de/mcp"
    }
  }
}
```

- Caveat: The user-level file applies across projects and does not require workspace trust. The project-level file applies only to that repository and requires workspace trust. Review the remote URL in Kimi's trust prompt before trusting the folder. See the [official Kimi Code MCP documentation](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/mcp.html).
- Caveat: Keep the URL exactly `https://meinkontext.de/mcp`. It is the canonical OAuth resource for which meinKontext issues access tokens.
- Caveat: Reconnect or start a new session after server-side tool or instruction changes. A running session can keep the old tool definitions and catalog digest.
- Caveat: With a personal OAuth connection, ask: "Set up meinKontext for this project using `setup_client`. Prefer relevant skills, memory and knowledge without repeated reminders." Name the connection as configured in your client. Agent profiles and org API keys cannot run personal setup.
- Caveat: The tool returns a recipe; your agent checks the effective instruction file and adds only its marked routing block. Existing rules remain. It does not copy your context or switch off native memory, but it tells your agent to save lasting facts only in meinKontext. On request it can supply a local hook and rollback recipe; your client must install and trust it. Supported local versions get a project or user recipe; unknown versions and browser/cloud clients get session instructions. Start a new session afterwards.
- Caveat: Ask the agent to check with `action: "check"` or remove with `action: "remove"`. A matching block hash confirms only the client-reported structure. Test a relevant task in a fresh session to see whether it actually reads the skill or memory. Keep the local installation receipt: it lets the agent remove its unchanged block even when the server is offline. Modified or duplicate blocks require reconciliation.

**Optional: org API key instead of personal OAuth**

1. Mint an org API key with the `create_api_key` tool from a connected session, and export it in your shell (for example as `MEINKONTEXT_TOKEN`). The environment variable must be present when Kimi starts.
2. Use the following server entry. `bearerTokenEnvVar` makes Kimi send the bearer token from the named environment variable.

```json
{
  "mcpServers": {
    "meinkontext": {
      "url": "https://meinkontext.de/mcp",
      "bearerTokenEnvVar": "MEINKONTEXT_TOKEN"
    }
  }
}
```

- Caveat: `bearerTokenEnvVar` contains only the variable name, never a literal token. Keep the actual key out of configuration files and protect its environment or secret store.
- Caveat: Org-scoped service principal: read-only for objects (authoring tools are hidden), and for memory: `recall` and `search` work, `remember` and `forget` need OAuth.