MCP Server

Connect Docd documentation to AI clients through the built-in MCP server.

Overview

Docd includes a built-in Model Context Protocol server through @nuxtjs/mcp-toolkit.

That gives AI clients a structured way to:

  • discover your documentation pages
  • fetch the full markdown for a specific page
  • consume your docs without scraping rendered HTML

The server is available at:

/mcp

If your docs site is deployed at https://docs.example.com, the MCP server lives at:

https://docs.example.com/mcp

Docd also includes a Copy MCP Server URL action in the page header menu so readers can copy the endpoint directly from the UI.

Built-in tools

Docd currently exposes two tools by default.

list-pages

Lists documentation pages with their title, path, description, and URL.

Use it when an AI client needs to explore the docs before reading a specific page.

ParameterTypeDescription
sectionstring (optional)Filter pages by a path prefix such as /getting-started

get-page

Returns one page with metadata plus the raw markdown body.

ParameterTypeDescription
pathstring (required)The docs route, such as /getting-started/installation

Disable the MCP server

If you do not want to expose MCP at all, disable it in nuxt.config.ts:

ts

nuxt.config.ts

export default defineNuxtConfig({
  mcp: {
    enabled: false,
  },
})

Connecting AI clients

Docd uses HTTP transport, so any MCP client that supports remote servers can connect to it.

Claude Code

claude mcp add --transport http my-docs https://docd.uithing.com/mcp

Cursor

Add the server to .cursor/mcp.json:

json

.cursor/mcp.json

{
  "mcpServers": {
    "my-docs": {
      "type": "http",
      "url": "https://docd.uithing.com/mcp"
    }
  }
}

Visual Studio Code

Add the server to .vscode/mcp.json:

json

.vscode/mcp.json

{
  "servers": {
    "my-docs": {
      "type": "http",
      "url": "https://docd.uithing.com/mcp"
    }
  }
}

Windsurf

json

.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "my-docs": {
      "type": "http",
      "url": "https://docd.uithing.com/mcp"
    }
  }
}

Zed

json

.config/zed/settings.json

{
  "context_servers": {
    "my-docs": {
      "source": "custom",
      "command": "npx",
      "args": ["mcp-remote", "https://docd.uithing.com/mcp"],
      "env": {}
    }
  }
}

Extending the server

Because the MCP server is powered by @nuxtjs/mcp-toolkit, you can add your own tools, prompts, resources, or custom handlers in your app.

Add a custom tool

Create a file in server/mcp/tools/:

ts

server/mcp/tools/search.ts

import { z } from "zod"

export default defineMcpTool({
  description: "Search docs by keyword",
  inputSchema: {
    query: z.string().describe("Search query"),
  },
  handler: async ({ query }) => {
    const results = await searchDocs(query)

    return {
      content: [
        {
          type: "text",
          text: JSON.stringify(results),
        },
      ],
    }
  },
})

Add a resource

Expose a file or generated document through server/mcp/resources/:

ts

server/mcp/resources/changelog.ts

export default defineMcpResource({
  file: "CHANGELOG.md",
  metadata: {
    description: "Project changelog",
  },
})

Add a prompt

Create reusable prompts in server/mcp/prompts/:

ts

server/mcp/prompts/migration-help.ts

import { z } from "zod"

export default defineMcpPrompt({
  description: "Generate migration guidance",
  inputSchema: {
    fromVersion: z.string(),
    toVersion: z.string(),
  },
  handler: async ({ fromVersion, toVersion }) => {
    return {
      messages: [{
        role: "user",
        content: {
          type: "text",
          text: `Help me migrate from ${fromVersion} to ${toVersion}.`,
        },
      }],
    }
  },
})

Add another handler

You can expose additional MCP endpoints with dedicated tools:

ts

server/mcp/migration.ts

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

Override a built-in tool

If you need custom behavior, create a tool with the same filename in your app:

ts

server/mcp/tools/list-pages.ts

import { z } from "zod"

export default defineMcpTool({
  description: "Custom page discovery",
  inputSchema: {
    section: z.string().optional(),
    tag: z.string().optional(),
  },
  handler: async ({ section, tag }) => {
    return []
  },
})
Refer to the MCP Toolkit documentation for the full server API and advanced patterns.