---
title: "MCP Server"
description: "Every docs site serves a Model Context Protocol server at /mcp by default. This page lists the built-in tools, resources and prompts, shows how to connect Claude Code, Cursor, VS Code and other clients, and explains how to disable, restrict or extend the server."
canonical_url: "https://docs.mhaibaraai.cn/en/docs/ai/mcp"
---
# MCP Server

> Every docs site serves a Model Context Protocol server at /mcp by default. This page lists the built-in tools, resources and prompts, shows how to connect Claude Code, Cursor, VS Code and other clients, and explains how to disable, restrict or extend the server.

The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open protocol for connecting AI applications to external services. Movk Nuxt Docs ships an MCP Server built on [`@nuxtjs/mcp-toolkit`](https://mcp-toolkit.nuxt.dev). Once connected, assistants such as Claude and Cursor search and read your docs when they need to instead of answering from training data.

The server is on by default and lives at the site's `/mcp` path. If your docs are deployed at `https://docs.example.com`, the MCP URL is `https://docs.example.com/mcp`. [AI Chat](https://docs.mhaibaraai.cn/en/docs/ai/ai-chat) reads the docs through the same tools.

## Configuration

### Disable

MCP is controlled by the `movkNuxtDocs.mcp` feature flag. When off, `@nuxtjs/mcp-toolkit` is not installed as a module, and both `/mcp` and the MCP server card go away:

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

> [!WARNING]
> 
> MCP cannot be disabled while 
> 
> AI Chat
> 
>  is enabled; the build fails if you try.

> [!NOTE]
> 
> The MCP Server needs a running server and is unavailable on a fully static 
> 
> nuxt generate
> 
>  deployment.

### Name and browser redirect

The remaining options live under `mcp` and are read by `@nuxtjs/mcp-toolkit`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  mcp: {
    // Server name shown to clients
    name: 'My Docs',
    // Page to redirect to when /mcp is opened in a browser
    browserRedirect: '/docs/ai/mcp'
  }
})
```

`browserRedirect` also becomes the documentation URL in the [MCP server card](https://docs.mhaibaraai.cn/en/docs/ai/agent-discovery#mcp-server-card). See the [MCP Toolkit docs](https://mcp-toolkit.nuxt.dev) for more options.

## Built-in capabilities

### Tools

| Tool | Purpose | Main parameters |
| --- | --- | --- |
| `search-documentation` | Search pages by title, path or description; lists every page with no parameters | `search`, `section`, `locale` |
| `get-documentation-page` | Return one page as Markdown by path, optionally only the named H2 sections | `path`, `headings` |
| `search-composables` | Find composable pages by keyword | `search`, `locale` |
| `get-component` | Return component documentation with metadata, optionally only some sections | `componentName`, `sections`, `locale` |
| `get-component-metadata` | Return a component's props, slots and emits | `componentName`, `full`, `locale` |
| `list-examples` | List every example name | None |
| `get-example` | Return an example's source code | `exampleName` |
| `search-icons` | Search one Iconify collection, `lucide` by default | `query`, `collection`, `limit` |

The component and example tools rely on the [component docs](https://docs.mhaibaraai.cn/en/docs/components/component-props) feature and return nothing when it is off. `search-composables` looks for pages whose path contains `composables/` (such as `/docs/composables/` or `/docs/reference/composables/`); `get-component` and friends look for pages whose path contains `/components/`.

### Resources

| URI | Content |
| --- | --- |
| `resource://docs/documentation-pages` | Title, description and path of every page |
| `resource://docs/components` | Component pages with their category and `keywords` |
| `resource://docs/composables` | Composable pages |
| `resource://docs/examples` | Example names |

Resources list default-language content only.

### Prompts

| Prompt | Purpose |
| --- | --- |
| `find-component-for-usecase` | Recommend a component for a use case |
| `implement-component-with-props` | Generate an implementation from a component's docs and metadata |

### Multiple languages

With [internationalization](https://docs.mhaibaraai.cn/en/docs/guide/i18n) enabled, the tools taking `locale` and both prompts query that language's collection and `/{locale}/docs` prefix, falling back to the default language when omitted. An unregistered locale answers 400 with the available locales. `get-documentation-page` resolves by path directly, such as `/en/docs/getting-started`.

### Restrict tools

A client can send an `X-MCP-Tools` header (comma-separated tool names) to expose only the tools it needs and save context:

- No header: every tool is exposed
- Empty value: no tools are exposed
- An unknown tool name: the server answers 400

The filtering is implemented by the layer's `server/mcp/index.ts`; the Cursor section below shows a client configuration.

## Connect a client

The server uses the HTTP transport. Replace `https://docs.example.com/mcp` with your URL.

### Claude Code

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

### Cursor

::install-button{url="https://docs.example.com/mcp"}
::

Or create `.cursor/mcp.json` at the project root:

```json [.cursor/mcp.json]
{
  "mcpServers": {
    "my-docs": {
      "type": "http",
      "url": "https://docs.example.com/mcp",
      "headers": {
        "X-MCP-Tools": "search-documentation,get-documentation-page"
      }
    }
  }
}
```

Remove `headers` to expose every tool.

### Visual Studio Code

Requires the GitHub Copilot and GitHub Copilot Chat extensions.

::install-button{url="https://docs.example.com/mcp" ide="vscode"}
::

Or add it to `.vscode/mcp.json`:

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

### Claude Desktop

Add the server to `claude_desktop_config.json`, opened from "Settings → Developer → Edit Config", then restart the app:

```json [claude_desktop_config.json]
{
  "mcpServers": {
    "my-docs": {
      "command": "npx",
      "args": ["mcp-remote", "https://docs.example.com/mcp"]
    }
  }
}
```

### Opencode

```json [opencode.json]
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-docs": {
      "type": "remote",
      "url": "https://docs.example.com/mcp",
      "enabled": true
    }
  }
}
```

### ChatGPT

In ChatGPT on the web, turn on developer mode under "Settings → Connectors → Advanced settings", then create a connector with your MCP server URL and `None` as authentication.

Once connected, just ask: "list every docs page", "read the installation guide", "which props does `ComponentProps` accept?". The assistant picks the tools itself.

## Extend

The server loads the files under your project's `server/mcp/` and merges them with the layer's definitions.

### Custom tools

```ts [server/mcp/tools/search-pages.ts]
import { z } from 'zod'
import { queryCollection } from '@nuxt/content/server'

export default defineMcpTool({
  description: 'Search page titles and descriptions by keyword',
  annotations: {
    readOnlyHint: true,
    destructiveHint: false,
    idempotentHint: true,
    openWorldHint: false
  },
  inputSchema: {
    search: z.string().describe('Keyword')
  },
  cache: '30m',
  async handler({ search }) {
    const event = useEvent()
    const keyword = search.toLowerCase()

    const pages = await queryCollection(event, 'docs')
      .select('title', 'description', 'path')
      .all()

    return pages.filter(page =>
      page.title?.toLowerCase().includes(keyword)
      || page.description?.toLowerCase().includes(keyword)
    )
  }
})
```

The tool name defaults to the file name in kebab-case. A file named after a built-in tool (such as `server/mcp/tools/search-documentation.ts`) replaces it.

### Custom resources

```ts [server/mcp/resources/page-index.ts]
import { queryCollection } from '@nuxt/content/server'

export default defineMcpResource({
  uri: 'resource://docs/page-index',
  description: 'Title and path of every page',
  cache: '1h',
  async handler(uri: URL) {
    const pages = await queryCollection(useEvent(), 'docs')
      .select('title', 'path')
      .all()

    return {
      contents: [{
        uri: uri.toString(),
        mimeType: 'application/json',
        text: JSON.stringify(pages, null, 2)
      }]
    }
  }
})
```

### Custom prompts

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

export default defineMcpPrompt({
  description: 'Explain what a config option does and its default',
  inputSchema: {
    key: z.string().describe('Option path, e.g. header.nav')
  },
  async handler({ key }) {
    return {
      messages: [{
        role: 'user' as const,
        content: {
          type: 'text' as const,
          text: `Read the app.config reference and explain the purpose, type and default of ${key}.`
        }
      }]
    }
  }
})
```

### Replace the default handler

The layer's `server/mcp/index.ts` is the default handler and implements the `X-MCP-Tools` filter. Create a file at the same path in your project to replace it:

```ts [server/mcp/index.ts]
import { defineMcpHandler, getMcpTools } from '@nuxtjs/mcp-toolkit/server'

export default defineMcpHandler({
  async tools(event) {
    return getMcpTools({ event, orphansOnly: true })
  }
})
```

> [!TIP]
> See: https://mcp-toolkit.nuxt.dev
> 
> See the MCP Toolkit docs for multiple handlers, sessions, authentication and other advanced setups.


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.cn/sitemap.md) for all pages.
