> AI coding agents: see [/llms.txt](/llms.txt) for the full documentation index. Markdown version: [/docs/manual/en/ai/mcp.md](/docs/manual/en/ai/mcp.md).

---
title: MCP Server
description: Connect your documentation to AI tools with a native MCP server.
navigation:
  icon: i-lucide-cpu
---

## About MCP Servers

The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open protocol for connecting AI applications to external tools and data sources.

Every TockDocs instance includes a built-in MCP server so AI tools such as Claude, Cursor, VS Code, Windsurf, and Zed can search and read your documentation.

## Accessing Your MCP Server

Your MCP server is available at the `/mcp` path of your documentation URL.

::note
If your documentation is hosted at `https://docs.example.com`, your MCP server URL is `https://docs.example.com/mcp`.
::

## Disable the MCP Server

If you want to disable the MCP server, do so in `nuxt.config.ts`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  mcp: {
    enabled: false,
  },
})
```

## Built-in Tools

TockDocs exposes three built-in tools.

### `search-pages`

Searches titles, descriptions, headings, paths, and full page body content.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| `query`   | string (required) | Search query or natural-language question |
| `limit`   | number (optional) | Maximum number of results to return |
| `kb`      | string (optional) | Knowledge base id to scope results in multi-KB sites |
| `locale`  | string (optional) | Locale code to scope results |

`search-pages` uses FlexSearch for the primary pass and Fuse.js as a fuzzy fallback.

### `list-pages`

Lists available documentation pages with their titles, paths, descriptions, and URLs.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| `kb`      | string (optional) | Knowledge base id to scope results in multi-KB sites |
| `locale`  | string (optional) | Locale code to scope results |

### `get-page`

Retrieves the full markdown content of a specific documentation page.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| `path`    | string (required) | Exact page path |

Examples:

- KB mode: `/docs/manual/en/getting-started/installation`
- legacy i18n mode: `/en/getting-started/installation`
- legacy single-locale mode: `/getting-started/installation`

## KB-aware behavior

In multi-KB sites:

- external MCP clients can pass `kb` and `locale` explicitly to `search-pages` and `list-pages`
- the built-in assistant can also infer the current KB and locale from the docs page that triggered the request

This keeps retrieval scoped to the active documentation set when possible.

## Setup

The TockDocs MCP server uses HTTP transport and can be connected to multiple assistants.

### Claude Code

```bash
claude mcp add --transport http my-docs https://docs.example.com/mcp
```

### Cursor

:install-button{ide="cursor" label="Install in Cursor" url="https://docs.example.com/mcp"}

Or manually create/update `.cursor/mcp.json`:

```json [.cursor/mcp.json]
{
  "mcpServers": {
    "my-docs": {
      "type": "http",
      "url": "https://docs.example.com/mcp"
    }
  }
}
```

### Visual Studio Code

:install-button{ide="vscode" label="Install in VS Code" url="https://docs.example.com/mcp"}

Or manually create/update `.vscode/mcp.json`:

```json [.vscode/mcp.json]
{
  "servers": {
    "my-docs": {
      "type": "http",
      "url": "https://docs.example.com/mcp"
    }
  }
}
```

### Windsurf

```json [.codeium/windsurf/mcp_config.json]
{
  "mcpServers": {
    "my-docs": {
      "type": "http",
      "url": "https://docs.example.com/mcp"
    }
  }
}
```

### Zed

```json [.config/zed/settings.json]
{
  "context_servers": {
    "my-docs": {
      "source": "custom",
      "command": "npx",
      "args": ["mcp-remote", "https://docs.example.com/mcp"],
      "env": {}
    }
  }
}
```

## Customization

TockDocs uses `@nuxtjs/mcp-toolkit`, so you can extend the MCP server with custom tools, resources, prompts, and handlers.

### Add custom tools

```ts [server/mcp/tools/search.ts]
import { z } from 'zod'

export default defineMcpTool({
  description: 'Search documentation by keyword',
  inputSchema: {
    query: z.string().describe('The search query'),
  },
  handler: async ({ query }) => {
    const results = await searchDocs(query)
    return {
      content: [{ type: 'text', text: JSON.stringify(results) }],
    }
  },
})
```

### Add resources

```ts [server/mcp/resources/changelog.ts]
export default defineMcpResource({
  file: 'CHANGELOG.md',
  metadata: {
    description: 'Project changelog',
  },
})
```

### Add prompts

```ts [server/mcp/prompts/migration-help.ts]
import { z } from 'zod'

export default defineMcpPrompt({
  description: 'Get help with migrating between versions',
  inputSchema: {
    fromVersion: z.string().describe('Current version'),
    toVersion: z.string().describe('Target version'),
  },
  handler: async ({ fromVersion, toVersion }) => {
    return {
      messages: [
        {
          role: 'user',
          content: {
            type: 'text',
            text: `Help me migrate from version ${fromVersion} to ${toVersion}. What changed?`,
          },
        },
      ],
    }
  },
})
```

### Add separate handlers

You can expose different MCP endpoints with their own tool sets.

```ts [server/mcp/migration.ts]
import { z } from 'zod'

const migrationTool = defineMcpTool({
  name: 'migrate-v3-to-v4',
  description: 'Migrate code from version 3 to version 4',
  inputSchema: {
    code: z.string().describe('The code to migrate'),
  },
  handler: async ({ code }) => {
    return {
      content: [{ type: 'text', text: code }],
    }
  },
})

export default defineMcpHandler({
  route: '/mcp/migration',
  name: 'Migration Assistant',
  version: '1.0.0',
  tools: [migrationTool],
})
```

::tip{to="https://mcp-toolkit.nuxt.dev/"}
See the `@nuxtjs/mcp-toolkit` docs for the full API surface.
::
