> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/llms.txt
> - v0: https://docs.butterix.com/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# MCP 服务器

`POST /_mcp/server`

站点 MCP 服务器（Streamable HTTP 传输，JSON 响应）。支持 `initialize`、`ping`、`tools/list`、`tools/call`，也接受批量消息。
工具：`search_docs`（检索）、`get_page`（获取页面 Markdown）、`list_pages`（列出页面）。多语言站点的 `search_docs` 与 `list_pages` 可以传 `locale`。`GET` 请求返回 405；站点关闭 MCP 时返回 404。
受密码保护的站点需要访问令牌或 OAuth 登录，未授权时返回 401。

Base URL: https://butterix-sites.butterix.com

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `jsonrpc` | "2.0" | yes | Allowed: `2.0`. |
| `id` | string | no |  |
| `method` | enum | yes | Allowed: `initialize`, `ping`, `tools/list`, `tools/call`. |
| `params` | object | no |  |

## Example request

```bash
curl -X POST https://butterix-sites.butterix.com/_mcp/server \
     -H "Content-Type: application/json" \
     -d '{
         "jsonrpc": "2.0",
         "id": 1,
         "method": "tools/call",
         "params": {
           "name": "search_docs",
           "arguments": {
             "query": "自定义域名",
             "limit": 3
           }
         }
       }'
```

## Responses

### 200

JSON-RPC 响应

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `jsonrpc` | string | no |  |
| `id` | string | no |  |
| `result` | object | no |  |
| `error` | object | no |  |
| `error.code` | integer | no |  |
| `error.message` | string | no |  |

### 202

通知类消息，无响应体

### Example response (200)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "## 1. 自定义域名 › 配置 DNS\nURL: https://docs.butterix.com/guides/deploy/custom-domains\n\n添加 TXT 记录……"
      }
    ]
  }
}
```
