docmd includes a native Model Context Protocol (MCP) server, enabling AI development agents to interact with your documentation workspace programmatically over a secure, local connection.

What is MCP?

The Model Context Protocol is an open standard for connecting AI models to external tools and data sources. It uses JSON-RPC 2.0 messages over a transport layer (stdio, HTTP). docmd implements the stdio transport — the agent spawns docmd mcp as a child process and communicates via stdin/stdout.

Quick Start

docmd mcp

This starts the MCP server over stdio. No network ports are opened — all communication happens through standard input/output streams.

Claude Desktop Configuration

Add to your Claude Desktop claude_desktop_config.json:

{
  "mcpServers": {
    "docmd": {
      "command": "npx",
      "args": ["@docmd/core", "mcp"],
      "cwd": "/path/to/your/docs/project"
    }
  }
}

Cursor / Windsurf Configuration

Add to your editor’s MCP settings:

{
  "command": "npx @docmd/core mcp",
  "transport": "stdio"
}

Available Tools

The MCP server exposes four tools that agents can call:

Tool Description
search_docs Full-text search across all documentation files. Returns matching lines with file paths and line numbers.
read_doc Read the raw markdown content of any documentation file by its relative path.
validate_docs Run link validation across all markdown files. Returns a list of broken links with file, line, and target.
get_llms_context Retrieve the complete llms-full.txt context — the unified content of the entire documentation site, optimised for LLM ingestion.

Tool Schemas

search_docs

{
  "name": "search_docs",
  "inputSchema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "The term or phrase to search for." }
    },
    "required": ["query"]
  }
}

read_doc

{
  "name": "read_doc",
  "inputSchema": {
    "type": "object",
    "properties": {
      "route": { "type": "string", "description": "Relative path to the markdown file (e.g. docs/getting-started.md)." }
    },
    "required": ["route"]
  }
}

validate_docs / get_llms_context

No input parameters required.

Protocol Details

docmd implements the MCP specification (protocol version 2025-03-26):

  • Transport: stdio — JSON-RPC 2.0 messages over stdin/stdout, one per line
  • Diagnostics: Logged to stderr (does not interfere with the JSON-RPC stream)
  • Lifecycle: initializenotifications/initialized → tool calls
  • Ping: Responds to ping requests with {} (required for connection health checks)
  • Capabilities: Declares tools, resources, and prompts (tools are the primary interface)

Privacy & Security

  • Local only: The server runs as a child process — no network exposure, no ports opened
  • Sandboxed: File operations are restricted to the project working directory
  • No telemetry: No data is sent anywhere — all processing happens on your machine

Complementary Features

The MCP server works alongside other AI-first features in docmd:

  • llms.txt / llms-full.txt: Generated at build time by the llms plugin. Any agent can fetch these from your deployed site without MCP.
  • Copy Context widget: Browser UI button that copies page content optimised for pasting into AI chat windows.
  • SKILL.md: Agent instruction manual auto-generated by docmd init. Points to the docmd-skills knowledge base.
When to use MCP vs llms.txt

Use MCP when an agent needs to search, read specific files, or validate links interactively during development. Use llms-full.txt when an agent needs the entire documentation context in a single fetch (e.g., for RAG or pre-prompting).