> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ironclaw.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP 服务器

> 连接 Model Context Protocol 服务器扩展 IronClaw

IronClaw 可连接任意 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) 服务器，并把其工具暴露给代理。MCP 是开放标准，生态中已有大量数据库、API、云服务连接器。

<Info>
  当前通过 **HTTP 传输**（JSON-RPC 2.0）连接 MCP。`stdio` 传输暂不支持。
</Info>

***

## 添加服务器

可直接要求代理使用 MCP，或通过 CLI 添加：

```bash theme={null}
ironclaw mcp add <server_name> <server_url>
```

***

## 认证

如果服务器需要认证：

```bash theme={null}
ironclaw mcp auth <server_name>
```

***

## 查看已连接服务器

```bash theme={null}
ironclaw mcp list
```

连接成功后，MCP 工具会出现在代理工具列表中。

***

## 移除服务器

```bash theme={null}
ironclaw mcp remove <server_name>
```

***

## WASM 与 MCP 如何选择

| 维度   | WASM                     | MCP          |
| ---- | ------------------------ | ------------ |
| 隔离性  | 强（wasmtime 沙箱、fuel、内存限制） | 较弱（独立进程）     |
| 凭据处理 | 代理层注入，模块看不到原始密钥          | 由 MCP 服务自行处理 |
| 网络控制 | `capabilities.json` 白名单  | 由 MCP 服务控制   |
| 生态   | 自建为主                     | 现成生态丰富       |
| 语言   | 任意 `wasm32-wasi` 目标      | 任意语言         |
| 启动成本 | 首次需编译缓存                  | 服务需预先运行      |
| 适合场景 | 强隔离的定制集成                 | 复用现有 MCP 服务  |

<Note>
  涉及敏感凭据或不可信外部数据时，优先使用 WASM 工具，可获得更强隔离保障。
</Note>
