> For the complete documentation index, see [llms.txt](https://k-ai.gitbook.io/knowledge-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k-ai.gitbook.io/knowledge-ai/k-ai-mcp/mcp.md).

# Overview

K-AI exposes two Model Context Protocol (MCP) servers — one for Retrieval (5 tools, the canonical replacement of the `/search` endpoint that was removed from the K-AI Instance API in April 2026 — see [Removed endpoints](/knowledge-ai/sources-and-ingestion/instance-api/removed-endpoints.md)) and one for Audit (21 curated tools). MCP clients (Claude Desktop, Cursor, Mistral Le Chat, any MCP-compatible agent) discover OAuth at each MCP URL and authenticate the end-user once. A single token grants access to every K-AI instance the user is entitled to, on both servers. The host LLM does the orchestration; K-AI exposes primitives, not a chat strategy.

## Two MCP servers

* `https://api-retrieval.kai-studio.ai/mcp` — **5 tools**. The Activate surface over Retrieval. See [Retrieval tools](/knowledge-ai/k-ai-mcp/retrieval-tools.md).
* `https://api-audit.kai-studio.ai/mcp` — **21 tools**. The Activate surface over K-AI Audit, organised conflict-first. See [Audit tools](/knowledge-ai/k-ai-mcp/audit-tools.md). Both servers follow the [schema stability policy](/knowledge-ai/k-ai-mcp/schema-stability.md).

Both servers use Streamable HTTP transport and are stateless (no server-side sessions).

## Authentication

Both surfaces share a single OAuth 2.1 Authorization Server: `https://auth-api.kai-studio.ai`. Clients discover it via `/.well-known/oauth-authorization-server` on either MCP host. Tokens are signed JWTs and are accepted on both surfaces — register your client once, use it everywhere. End-user identity is propagated into every tool call, carrying group-based RBAC, per-instance visibility and instructions. See [OAuth 2.1](/knowledge-ai/authentication/oauth.md) for the full flow.

## Quick start

The fastest path is Cursor: two one-click install buttons (one per server). Claude Desktop and Mistral Le Chat require UI steps via their respective Custom Connector panels — see [Connect a client](/knowledge-ai/k-ai-mcp/connect-a-client.md).

## What's in this section

| Page                                                                  | Purpose                                             |
| --------------------------------------------------------------------- | --------------------------------------------------- |
| [What is MCP](/knowledge-ai/k-ai-mcp/what-is-mcp.md)                  | Protocol primer; why K-AI exposes MCP.              |
| [Connect a client](/knowledge-ai/k-ai-mcp/connect-a-client.md)        | Install in Claude Desktop, Cursor, Mistral Le Chat. |
| [OAuth flow (detailed)](/knowledge-ai/k-ai-mcp/oauth-flow.md)         | Sequence diagram, endpoints, troubleshooting.       |
| [Retrieval tools](/knowledge-ai/k-ai-mcp/retrieval-tools.md)          | The 5 Retrieval MCP tools.                          |
| [Audit tools](/knowledge-ai/k-ai-mcp/audit-tools.md)                  | The 21 curated Audit MCP tools.                     |
| [Cookbook](/knowledge-ai/k-ai-mcp/cookbook.md)                        | Multi-tool recipes (Retrieval + Audit).             |
| [Schema stability policy](/knowledge-ai/k-ai-mcp/schema-stability.md) | What we commit to keep stable, deprecation policy.  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://k-ai.gitbook.io/knowledge-ai/k-ai-mcp/mcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
