Model Context Protocol

md2 for agents

The Model Context Protocol lets your agent call md2 as a tool: it writes Markdown, asks for a PDF, Word file or more, gets a link back, and draws on the template library.

Status: live now

The MCP server is live at the address below over Streamable HTTP (protocol version 2025-06-18). The REST API on the same origin works too, for any agent with an HTTP tool.

Live now
MCP · Endpoint https://md2.dev/mcp/v2
Live now
REST POST https://md2.dev/v1/convert

Two ways to authenticate

OAuth 2.1

For interactive clients: the client opens the sign-in page itself, and you copy nothing. It uses PKCE and dynamic client registration; the scopes are convert:read, convert:write, library:read and agent:use.

API keys

For non-interactive clients and scripts: a key starting with md2_, sent in the header Authorization: Bearer md2_…

Setup per client

Each client has two forms: the first uses OAuth and signs in automatically, the second uses an API key. The address is the same for all of them.

Claude Code

OAuth · terminal
claude mcp add --transport http md2 https://md2.dev/mcp/v2
API key · terminal
claude mcp add --transport http md2 https://md2.dev/mcp/v2 --header "Authorization: Bearer md2_YOUR_KEY"

Claude Desktop

OAuth · Settings → Connectors → Add custom connector
https://md2.dev/mcp/v2
API key · claude_desktop_config.json (mcp-remote)
{
  "mcpServers": {
    "md2": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://md2.dev/mcp/v2",
        "--header",
        "Authorization: Bearer md2_YOUR_KEY"
      ]
    }
  }
}

Cursor

OAuth · ~/.cursor/mcp.json
{
  "mcpServers": {
    "md2": {
      "url": "https://md2.dev/mcp/v2"
    }
  }
}
API key · ~/.cursor/mcp.json
{
  "mcpServers": {
    "md2": {
      "url": "https://md2.dev/mcp/v2",
      "headers": {
        "Authorization": "Bearer md2_YOUR_KEY"
      }
    }
  }
}

VS Code

OAuth · .vscode/mcp.json
{
  "servers": {
    "md2": {
      "type": "http",
      "url": "https://md2.dev/mcp/v2"
    }
  }
}
API key · .vscode/mcp.json
{
  "servers": {
    "md2": {
      "type": "http",
      "url": "https://md2.dev/mcp/v2",
      "headers": {
        "Authorization": "Bearer md2_YOUR_KEY"
      }
    }
  }
}

Gemini CLI

OAuth · ~/.gemini/settings.json
{
  "mcpServers": {
    "md2": {
      "httpUrl": "https://md2.dev/mcp/v2"
    }
  }
}
API key · ~/.gemini/settings.json
{
  "mcpServers": {
    "md2": {
      "httpUrl": "https://md2.dev/mcp/v2",
      "headers": {
        "Authorization": "Bearer md2_YOUR_KEY"
      }
    }
  }
}

The seven tools

  • convert

    Markdown to 13 formats. A binary file comes back as a signed link valid for 24 hours, or inline as Base64 on request.

  • render_html

    Sanitised HTML for the document, with its title and warnings, to check it before converting.

  • list_themes

    The available themes, formats and text directions.

  • agent_draft

    Asks Mido, the writing agent, to write or edit a Markdown draft, Arabic first. It counts against your daily messages.

  • library_search

    Search the library of prompts, skills and project templates.

  • library_get

    The full content of a library item by its id.

  • import_to_markdown

    Opens a public web page in a real browser and returns its main content as Markdown.

Tools, resources and prompts in detail

REST for any agent without MCP

If your client doesn't speak MCP, any agent that can send an HTTP request can print right now:

bash
curl -X POST https://md2.dev/v1/convert \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Hello\n\nfrom md2","format":"pdf"}' \
  -o hello.pdf

API docs