# MCP

markdown.page exposes a minimal public MCP endpoint for agents that want to publish markdown and get a permanent URL.

No account, API key, or auth header is required.

## Endpoint

```txt
POST https://markdown.page/mcp
```

Transport: HTTP JSON-RPC.

Streaming: not supported. This MCP server is request/response only; it does not open server-sent event streams. A `GET /mcp` request with `Accept: text/event-stream` returns `405 Method Not Allowed`. Send JSON-RPC requests with `POST /mcp`.

The endpoint currently exposes one tool only:

```txt
publish_markdown({ markdown: string })
```

## Tool contract

Input schema:

```json
{
  "type": "object",
  "properties": {
    "markdown": { "type": "string" }
  },
  "required": ["markdown"],
  "additionalProperties": false
}
```

Output schema:

```json
{
  "type": "object",
  "properties": {
    "slug": { "type": "string" },
    "url": { "type": "string", "format": "uri" },
    "raw_url": { "type": "string", "format": "uri" },
    "json_url": { "type": "string", "format": "uri" }
  },
  "required": ["slug", "url", "raw_url", "json_url"],
  "additionalProperties": false
}
```

## Example

```bash
curl https://markdown.page/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"publish_markdown","arguments":{"markdown":"# Hello from MCP"}}}'
```

A successful call returns MCP text content plus structured URL metadata:

```json
{
  "slug": "a3x9k2b7",
  "url": "https://markdown.page/a3x9k2b7",
  "raw_url": "https://markdown.page/a3x9k2b7.md",
  "json_url": "https://markdown.page/a3x9k2b7.json"
}
```

## Limits and safety

The MCP publishing tool uses the same path as `POST /api/publish`:

- 1 MB markdown per page
- 2 MB request envelope
- fair-use rate limiting per IP
- markdown validation and sanitization

Published pages are public and permanent. Do not publish secrets, private data, credentials, or content you may need to edit later.

## Discovery

Agent discovery guide:

```txt
GET https://markdown.page/llms.txt
```

MCP documentation:

```txt
GET https://markdown.page/mcp
```

SSE support signal:

```txt
GET https://markdown.page/mcp
Accept: text/event-stream
```

returns `405` with `supports_sse: false`.
