# MCP 服务器

> Sommatic AI 文档 MCP 服务器让 Claude Code、Codex、Cursor 及任何 MCP 客户端以工具的形式搜索和阅读本文档、节点、表达式与 API 操作。

Source: https://docs.sommatic.ai/zh/agents/mcp/ (updated 2026-11-26)

有了 MCP 服务器，智能体无需记住 URL：它请服务器搜索文档，或返回某个页面、节点、表达式或 API 操作，并在回答中附上出处的文档 URL。服务器读取的是本站发布的同一份[目录](https://docs.sommatic.ai/zh/agents/llms-txt.md)和 Markdown 版本，因此答案始终来自最新文档。

- **地址：**`https://docs.sommatic.ai/mcp`（可流式 HTTP）。
- \*\*访问：\*\*只读，无需认证。只提供公开文档，绝不涉及你所在组织的数据。
- \*\*语言：\*\*每个工具都接受 `locale`：`en`（默认）、`es` 或 `zh`。

## 配置

**Claude Code**

```bash
claude plugin marketplace add sommatic/sommatic-agent-toolkit
claude plugin install sommatic@sommatic
```

插件一步即可添加 MCP 服务器和[技能包](https://docs.sommatic.ai/zh/agents/skills.md)。如只需添加服务器：

```bash
claude mcp add --transport http --scope user sommatic-docs https://docs.sommatic.ai/mcp
```

**Codex**

```bash
codex mcp add sommatic-docs --url https://docs.sommatic.ai/mcp
```

**Cursor**

将服务器添加到 `~/.cursor/mcp.json`（所有项目）或 `.cursor/mcp.json`（单个项目）：

```json
{ "mcpServers": { "sommatic-docs": { "url": "https://docs.sommatic.ai/mcp" } } }
```

**任意智能体**

```bash
npx @sommatic/cli agent setup
```

CLI 会在你的电脑上查找 Claude Code、Codex 和 Cursor，先展示将要修改的内容，经你确认后再应用。详见 [CLI](https://docs.sommatic.ai/zh/agents/cli.md)。

## 工具

| 工具                                              | 返回                                                                           |
| ----------------------------------------------- | ---------------------------------------------------------------------------- |
| `search_docs(query, locale?, product?, limit?)` | 按标题、slug 和描述排序的页面，附带 URL 与 Markdown 版本。                                      |
| `read_page(path_or_url, locale?)`               | 返回页面的 Markdown，可传入 URL、路径（`/es/nodes/flow.if`）或 slug（`workflows`）。           |
| `list_nodes(family?, status?)`                  | 节点的 slug、名称、分类、状态和一句话简介。                                                     |
| `get_node(slug)`                                | 单个节点：配置字段、端口、状态，以及在表达式中读取的输出路径。                                              |
| `list_expressions(group?)`                      | 表达式可用的全部变量与辅助函数，按工作流编辑器的分组排列，另含 JavaScript 内置对象。                             |
| `get_expression(name)`                          | 单个表达式名称（`$json`、`$ifEmpty`、`Math.round` 等）：签名、参数、返回值、错误与示例。名称不存在时，会告诉你应改用什么。 |
| `get_api_endpoint(method, path)`                | 单个 API 操作及其参数、请求体与响应；路径可以是具体路径或模板路径。                                         |
| `get_git_sync_schema(kind)`                     | Git Sync 的 `package`、`environment` 或 `resource-header` 的 JSON Schema。        |
| `list_commands(kind?)`                          | Command Center 命令，`read` 或 `exec`。                                           |

在智能体写入之前，先用 `get_node` 核对节点 slug、配置字段和端口，用 `get_expression` 核对表达式名称，用 `get_api_endpoint` 核对 API 调用，并引用每个回答附带的 URL。

## 下一步

- [CLI](https://docs.sommatic.ai/zh/agents/cli.md): 在终端中使用同一份文档。
- [技能包](https://docs.sommatic.ai/zh/agents/skills.md): 面向 Sommatic AI 任务的精准指引。
