# MCP Server

Connect AI coding agents and other MCP clients to Korey using the Model Context Protocol.

Korey exposes a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server so AI coding agents — Cursor, Claude Code, and others — can read from and write to your Korey workspace directly. No custom integration code needed on your part.

## What is MCP?

MCP is an open standard that lets AI tools discover and call capabilities exposed by external services. Instead of each tool implementing its own Korey integration, any MCP-compatible client can connect once and get access to the same set of tools.

## What Korey exposes via MCP

Once connected, an AI agent can:

- **Read threads** — list and retrieve conversation history from your workspace.
- **Send messages** — post new messages or continue existing threads.
- **Create threads** — start new conversations with a given name.

More tools will be added as the MCP integration matures.

## Connecting a client

Korey's MCP server endpoint is:

MCP clients authenticate using OAuth 2.0. On first connection the client will:

1. Discover Korey's OAuth configuration automatically from `/.well-known/oauth-authorization-server`.
2. Register itself via [Dynamic Client Registration](https://www.rfc-editor.org/rfc/rfc7591) — no manual client setup required.
3. Redirect you to Korey to approve the requested scopes.
4. Receive tokens and connect.

After the first authorization the client stores its tokens and reconnects silently.

  The first time you connect an MCP client you'll be taken to a Korey consent screen in your browser. Make sure you're signed in to Korey before starting the connection from your editor.

## Setup by client

### Cursor

1. Open Cursor settings and navigate to **MCP Servers**.
2. Add a new server with the URL `https://mcp.korey.ai/mcp`.
3. Cursor will open a browser window to complete the OAuth flow.
4. Once approved, Korey tools appear in Cursor's agent tool list.

### Claude Code

1. Run `claude mcp add korey https://mcp.korey.ai/mcp` in your terminal.
2. Claude Code will open a browser window to complete the OAuth flow.
3. Once approved, use `@korey` in Claude Code to invoke Korey tools.

### Other clients

Any MCP client that supports [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) and OAuth 2.0 Dynamic Client Registration will work with `https://mcp.korey.ai/mcp`.

## Managing MCP access

MCP clients appear as **connected apps** in your settings:

1. Open **Settings → Connected Apps**.
2. Find the MCP client by name (e.g. "Cursor", "Claude Code").
3. Click **Revoke** to disconnect it. The client will need to go through the OAuth flow again to reconnect.

  MCP clients typically request `threads:read` and `threads:write`. Scopes are explicit — `threads:write` does not imply `threads:read`. If you want a client to have read-only access, revoke its current token and approve only `threads:read` on the next consent screen. To further restrict a token to only the user's own threads, approve `threads:read:own` instead of `threads:read`.

## For developers: building an MCP-aware integration

If you're building a tool that connects to Korey via MCP, the relevant endpoints are:

**MCP server**

**OAuth discovery**

**DCR endpoint**

Your client should use Dynamic Client Registration (RFC 7591) so users don't need to register your app manually. The `client_name` you register with is shown on the Korey consent screen, so choose something recognizable.

See the [OAuth & Connected Apps](/docs/developers/oauth) page for the full details on scopes, token endpoints, and client registration.