MCP Server Setup

Connect AI agents like Claude to MarkDocs using the Model Context Protocol (MCP). Your AI can create documents, leave comments, make suggestions, and review edit history.

What is MCP?

The Model Context Protocol is an open standard for connecting AI models to external tools and data sources. MarkDocs implements an MCP server that exposes 13 tools and 2 resources, allowing any MCP-compatible AI agent to interact with your documents.

Quick Setup

1. Install the CLI

curl -fsSL https://markdocs.sh/install.sh | bash

2. Get your API key

Go to Settings in your MarkDocs dashboard and create an API key. You'll need this for the MCP server configuration.

3. Configure Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "markdocs": {
      "command": "markdocs-mcp",
      "env": {
        "MARKDOCS_API_KEY": "mdk_your_key_here",
        "MARKDOCS_URL": "https://markdocs.sh"
      }
    }
  }
}

4. Configure Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "markdocs": {
      "command": "markdocs-mcp",
      "env": {
        "MARKDOCS_API_KEY": "mdk_your_key_here",
        "MARKDOCS_URL": "https://markdocs.sh"
      }
    }
  }
}

5. Other MCP clients

Any MCP-compatible client can connect using stdio transport:

# Run the MCP server directly
MARKDOCS_API_KEY=mdk_your_key MARKDOCS_URL=https://markdocs.sh markdocs mcp

Available Tools

ToolDescription
list_documentsList all documents
create_documentCreate a new document with title and optional content
get_documentGet document details by ID
delete_documentSoft-delete a document
list_commentsList comments with optional resolved filter
add_commentAdd an inline comment at a position range
resolve_commentMark a comment as resolved
delete_commentDelete a comment
list_suggestionsList suggestions with optional status filter
add_suggestionPropose a text replacement
accept_suggestionAccept a pending suggestion
reject_suggestionReject a pending suggestion
get_historyGet edit history for a document

Available Resources

URIDescription
markdocs://documentsList all documents as JSON
markdocs://documents/{id}Get a specific document as JSON

Architecture

┌─────────────────┐     stdio      ┌─────────────────┐
│  AI Agent       │ ◄────────────► │  MCP Server     │
│  (Claude, etc.) │                │  (markdocs-mcp) │
└─────────────────┘                └────────┬────────┘
                                            │ HTTPS + API Key
                                   ┌────────▼────────┐
                                   │  MarkDocs API   │
                                   │  markdocs.sh    │
                                   └────────┬────────┘
                                            │ Prisma
                                   ┌────────▼────────┐
                                   │  PostgreSQL     │
                                   │  (Supabase)     │
                                   └─────────────────┘