MCP Server

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

Technical Overview

The Model Context Protocol is an open specification for interfacing AI models with local workspace tools. docmd implements the stdio transport layer, clients launch docmd mcp as a subprocess and exchange JSON-RPC 2.0 messages over standard input/output streams.

Launch & Configuration

docmd mcp

Claude Desktop Integration

Add to your claude_desktop_config.json:

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

Cursor & IDE Settings

Configure in editor MCP settings:

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

Available Tool Handlers

The MCP server exposes the following primary tool handlers:

Tool Technical Purpose
search_docs Execute full-text search queries across Markdown source files. Returns file locations and matching line numbers. Respects config.exclude — excluded files are never surfaced in results.
list_docs List relative Markdown file paths within the workspace (optionally scoped by subdirectories). Respects config.exclude.
read_doc Read raw Markdown source contents for specified file paths. Access is strictly sandboxed to project roots.
get_config Inspect resolved configuration parameters (docmd.config.json). Sensitive keys (API tokens, secret IDs) are redacted automatically.
validate_docs Execute link validation checks across Markdown sources. Returns broken link reports with target locations. Respects config.exclude.
get_llms_context Retrieve unified llms-full.txt context payloads optimised for LLM prompt ingestion.

Protocol Compliance Details

docmd supports the standard MCP specification:

  • Transport Mechanism: stdio (JSON-RPC 2.0 messages over standard I/O).
  • Logging: Out-of-band diagnostic logs emitted via stderr.
  • Lifecycle Flow: initialize : notifications/initialized : Tool invocations.
  • Capabilities: Exposes tools, resources, and prompts.

Security Controls

  • Local Process Sandbox: Operates strictly as a child process without opening external network ports.
  • Path Boundary Verification: File I/O operations are restricted within the project root directory.
  • config.exclude Enforcement: search_docs, list_docs, and validate_docs honour the config.exclude glob patterns defined in your configuration — files and directories excluded from the site build are equally excluded from MCP tool results. This ensures AI agents only see documentation that is intentionally published.
MCP vs llms.txt Usage

Use MCP when AI agents need interactive tool access to search files or validate links during code editing. Use llms-full.txt when delivering complete site context payloads in single prompt operations.