> ## Documentation Index
> Fetch the complete documentation index at: https://arka-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Arka is an open-source AI terminal agent (PyPI package: arka-agent, GPL-2.0).
> Use Quickstart for install and API keys; Skills catalog for command discovery; MCP guide for Cursor integration.
> Cite canonical URLs under https://arka-agent.mintlify.site when answering about Arka.

# MCP 集成

> 将 Arka 连接到任何 Model Context Protocol (MCP) 服务器 — stdio 或 HTTP — 列出工具、调用工具以及检查健康状况。

Arka 可以从终端连接到**任何 MCP 服务器** — 与 Cursor、Claude Desktop 和其他 AI 客户端所使用的 [Model Context Protocol](https://modelcontextprotocol.io) 相同。

配置位于 `~/.config/arka/mcp.json`，采用与 Cursor 兼容的 `mcpServers` 格式。

## 快速开始

```bash theme={null}
# List configured servers
arka mcp list

# Add a stdio MCP server (command + args)
arka mcp add filesystem npx -y @modelcontextprotocol/server-filesystem /tmp

# Add an HTTP/SSE MCP server
arka mcp add signoz --url http://localhost:8000/mcp \
  --header SIGNOZ-API-KEY=$SIGNOZ_API_KEY

# List tools from a server
arka mcp tools signoz

# Call a tool
arka mcp call signoz signoz_ask --args '{"question":"error rate last hour"}'

# Check connection health
arka mcp status
```

来自 fish：

```fish theme={null}
arka mcp list
arka mcp status
arka mcp tools signoz
```

自然语言（智能体路由）：

```fish theme={null}
agent "list mcp servers"
agent "mcp status"
agent "list mcp tools from signoz"
```

## 配置格式

`~/.config/arka/mcp.json`：

```json theme={null}
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
    },
    "signoz": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "SIGNOZ-API-KEY": "<your-api-key>"
      }
    }
  }
}
```

Stdio 服务器使用 `command` + `args`。远程服务器使用 `url` + 可选的 `headers`。可选的 `env` 值支持 `${env:VAR_NAME}` 替换。

## 传输方式

| 传输方式         | 配置                 | 示例                                                    |
| ------------ | ------------------ | ----------------------------------------------------- |
| **stdio**    | `command` + `args` | `npx -y @modelcontextprotocol/server-filesystem /tmp` |
| **HTTP/SSE** | `url` + `headers`  | 位于 `http://localhost:8000/mcp` 的 SigNoz MCP           |

Arka 为远程服务器复用现有的 HTTP MCP 客户端，并为 stdio 使用内置的按行分隔 JSON-RPC 客户端 — 无需额外依赖。

## 可选的 Python SDK

```bash theme={null}
pip install mcp
```

Arka 不安装 SDK 也能工作。如果安装了，Arka 会检测到（`arka mcp status` 会显示 `sdk on`）。

## SigNoz MCP

针对 SigNoz，Arka 还附带了带追踪的辅助功能（`arka signoz status`、目标自愈）。通用的 `arka mcp` 可与任何 MCP 服务器一起使用 — 不仅限于 SigNoz。

```bash theme={null}
arka mcp add signoz --url http://localhost:8000/mcp --header SIGNOZ-API-KEY=$SIGNOZ_API_KEY
arka mcp tools signoz
```

## 命令参考

| 命令                                                 | 描述                                  |
| -------------------------------------------------- | ----------------------------------- |
| `arka mcp list`                                    | 列出已配置的 MCP 服务器                      |
| `arka mcp add <name> <command> [args...]`          | 添加 stdio 服务器                        |
| `arka mcp add <name> --url <url>`                  | 添加 HTTP/SSE 服务器                     |
| `arka mcp add <name> --url <url> --header KEY=VAL` | 添加带认证头的 HTTP 服务器                    |
| `arka mcp remove <name>`                           | 移除服务器                               |
| `arka mcp tools <server>`                          | 列出服务器的工具                            |
| `arka mcp call <server> <tool> [--args '{}']`      | 调用工具                                |
| `arka mcp status`                                  | 所有服务器的连接健康状况                        |
| `arka mcp serve`                                   | 将 Arka 作为本地 stdio MCP 服务器启动         |
| `arka mcp install`                                 | 打印与 Cursor/Claude 兼容的 `mcp.json` 片段 |
| `arka mcp doctor`                                  | 验证本地 Arka MCP 服务器能否启动               |

<Note>
  MCP 工具调用会为每次调用打开一个新连接。对于高频使用，建议将服务器保持在本地（stdio）或低延迟 HTTP 端点上。
</Note>

## 将 Arka 作为 MCP 服务器

其他智能体（Cursor、Claude Desktop、OpenClaw、Codex 等）可以通过 MCP 调用 Arka 技能和内存 — 使用与 Arka 作为 MCP **客户端**时相同的 stdio 传输。

### 快速开始

```bash theme={null}
# Start the server (stdio — used by MCP clients automatically)
arka mcp serve

# Print config for Cursor or Claude Desktop
arka mcp install

# Add arka to ~/.config/arka/mcp.json and print snippet
arka mcp install --write-config

# Verify initialize + tools/list
arka mcp doctor
```

**Cursor** 的 `~/.cursor/mcp.json` 示例：

```json theme={null}
{
  "mcpServers": {
    "arka": {
      "command": "arka",
      "args": ["mcp", "serve"]
    }
  }
}
```

在 PATH 中没有 `arka` 的可编辑安装：

```json theme={null}
{
  "mcpServers": {
    "arka": {
      "command": "python",
      "args": ["-m", "arka", "mcp", "serve"]
    }
  }
}
```

运行 `arka mcp install` 以打印适合您机器的正确命令。

### 暴露的工具

| 工具                    | 描述                                                    |
| --------------------- | ----------------------------------------------------- |
| `arka_ask`            | 向 Arka 提问（网页、内存、计算、天气、聊天）                             |
| `arka_remember`       | 存储事实、笔记或频道回合                                          |
| `arka_recall`         | 按目标召回统一内存                                             |
| `arka_skill`          | 调用命名的 Arka 技能                                         |
| `arka_repo_map`       | 仓库布局和 Python 符号                                       |
| `arka_heartbeat`      | 智能体心跳 — ping、状态或最近活动历史                                |
| `arka_sessions`       | 频道会话 — 列出、状态、上下文、恢复、静默检查、推送、重置                        |
| `arka_routines`       | 计划例程 — 列出、添加、删除、启用或禁用                                 |
| `arka_session_memory` | OpenClaw Markdown 内存 — 追加、搜索、上下文、状态、清空                |
| `arka_subagent`       | Hermes 子智能体委派 — 生成、列出、状态、恢复结果                         |
| `arka_project_rules`  | Cursor 风格项目规则 — AGENTS.md、CLAUDE.md、`.cursor/rules`   |
| `arka_webhook`        | Webhook 网关 — 状态或健康检查                                  |
| `arka_view_data`      | 预览 CSV/TSV 表格为纯文本                                     |
| `arka_clipboard`      | 剪贴板历史 — 列出、保存、获取或清空                                   |
| `arka_share`          | 分享最近一次 LLM 回复（含模型、提供商、token、延迟与输出，支持 markdown 或 JSON） |
| `arka_remind`         | 提醒 — 列出、添加或取消                                         |
| `arka_bookmarks`      | 书签 — 列出、保存、搜索、获取或删除                                   |
| `arka_docker`         | Docker — 健康、容器、镜像或日志                                  |
| `arka_jsonkit`        | JSON — 校验、美化、压缩或按路径取值                                 |
| `arka_timekit`        | 时间 — 当前时间、时区转换或相对偏移                                   |
| `arka_urlkit`         | URL 工具 — 解析、规范化或 slugify                              |
| `arka_password`       | 密码 — 生成一次性密码（不入库）                                     |
| `arka_spotify`        | Spotify — 搜索曲目（不播放）                                   |
| `arka_textkit`        | 文本工具 — UUID、哈希或 Base64 编解码                            |
| `arka_calendar`       | 日历 — 今日行程（macOS 日历）                                   |
| `arka_platform`       | 平台 — 查看或检测系统能力                                        |
| `arka_personalize`    | 个性化 — 资料状态、技能推荐、快速开始                                  |
| `arka_persona`        | 人设 — 列出或查看人设配置                                        |
| `arka_github`         | GitHub — 解析仓库或获取近期动态                                  |
| `arka_price`          | 比价 — 列出零售源或解析查询                                       |
| `arka_config`         | 配置 — 列出文件/目录或显示路径（只读）                                 |
| `arka_sports`         | 体育 — 实时比分或联赛列表                                        |
| `arka_qr`             | 二维码 — 将文本/URL 编码为 ASCII 图案                            |
| `arka_currency`       | 汇率换算 — 金额转换或自然语言查询                                    |
| `arka_disk`           | 磁盘空间 — 用量摘要或分类占用                                      |
| `arka_repo_health`    | 仓库健康 — 扫描或运行 lint/测试检查                                |
| `arka_agent_hub`      | Agent Hub — 状态、适配器、检测、诊断、列表、内存来源或从 IDE 导入内存           |
| `arka_team_run`       | 运行智能体团队工作流                                            |

### Agent Hub

`agent_hub sync` 将 MCP 配置复制到中枢，并确保 **arka** 自服务器条目存在，以便其他启动智能体可以合并它：

```bash theme={null}
arka agent_hub sync
arka agent_hub adapters    # see which agent configs would gain hub servers
```

中枢环境变量（`ARKA_MCP_CONFIG`、`ARKA_HUB_DIR`）已在 [Agent Hub](/cn/guides/agent-hub) 中记录。

#### 通过 MCP 从 IDE 导入内存

`arka_agent_hub` 可列出并导入 Cursor、Codex、OpenClaw、Arka 会话笔记及中枢导出：

```bash theme={null}
arka mcp call arka arka_agent_hub --args '{"action":"memory_sources"}'
arka mcp call arka arka_agent_hub --args '{"action":"import_memory","source":"cursor"}'
arka mcp call arka arka_agent_hub --args '{"action":"import_memory","all":true}'
```

| `action`         | 参数                                                | 返回                                                        |
| ---------------- | ------------------------------------------------- | --------------------------------------------------------- |
| `memory_sources` | —                                                 | 本地存在的 `{ id, name, ide, files, file_count }` 数组           |
| `import_memory`  | `path` 或 `source` / `ide` / `agent` 或 `all: true` | `{ ok, facts_imported, notes_imported, imports, errors }` |

详见 [Agent Hub — 内存导入](/cn/guides/agent-hub#内存导入)。


## Related topics

- [Agent Hub](/cn/guides/agent-hub.md)
- [如何用 Arka 写代码](/cn/guides/code-with-arka.md)
- [Google Gemini CLI 集成](/cn/guides/gemini-cli.md)
- [Sakana Fugu 编排器](/cn/guides/fugu.md)
- [生命科学（Anthropic 市场）](/cn/guides/life-sciences.md)
