mcp-integration

A setup for MCP, a standard way for an AI agent to discover and call tools provided by outside services. It lets administrators add remote MCP servers and choose which servers and tools each agent can use.

In plain words
What is it for?
Use it to add remote MCP services over streamable HTTP or server-sent events, test their connections, and assign selected services to agent configurations.
Why use it?
It provides a controlled place to connect agents to external tools without giving every agent access to every server. It also supports connection testing, authentication headers, timeouts, and enabling or disabling servers and tools.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/xerrors/yuxi/mcp-integration
Clone the repo
git clone --depth 1 https://github.com/xerrors/Yuxi
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,196 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01196
Opus 5 $0.00000 $0.00598
Sonnet 5 $0.00000 $0.00239
Haiku 4.5 $0.00000 $0.00120

Measured yesterday against content hash 2a04c28944fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/mcp-integration.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

集成 MCP

MCP(Model Context Protocol)让智能体调用外部服务提供的工具。管理员在“扩展 → MCP”中添加远程服务器,智能体配置再决定哪些服务器进入运行时。

支持的传输方式

传输方式 适用场景
streamable_http 新的远程 MCP 服务
sse 仍提供 SSE 接口的远程服务
stdio 仅限代码维护的系统内置 MCP

管理接口只接受 streamable_httpsse。Yuxi 不允许通过 HTTP 请求创建任意本地 stdio 进程;历史用户 stdio 配置会被禁用,应迁移为远程服务。

添加远程 MCP

在“扩展 → MCP”点击“添加 MCP”,填写稳定标识、名称、传输方式和 URL。例如:

{
  "slug": "custom-remote-mcp",
  "name": "Example MCP",
  "transport": "streamable_http",
  "url": "https://example.com/mcp"
}

管理接口对应:

POST /api/system/mcp-servers
Authorization: Bearer <admin-token>
Content-Type: application/json

{
  "slug": "custom-remote-mcp",
  "name": "Example MCP",
  "transport": "streamable_http",
  "url": "https://example.com/mcp",
  "description": "提供示例查询工具"
}

需要认证的远程服务可以配置 HTTP headers、连接超时和 SSE 读取超时。凭证会随着连接请求发送,请只配置必要的 header,并把管理接口限制在可信的管理员范围。

添加后先点击“测试连接”,确认能发现工具,再把服务器状态设为“已添加”。状态关闭时,服务器记录仍保留,但不会进入运行时。

让智能体使用 MCP

在智能体配置的 MCP 字段中选择已添加的服务器:

  • 未显式配置时,使用当前用户可见的全部已启用服务器;
  • 显式选择后,只使用选择项;
  • MCP 工具仍会在执行处使用当前用户身份和服务器配置;
  • 管理员可以在 MCP 详情页单独禁用某个工具。

MCP 配置从 PostgreSQL 读取,工具对象按配置哈希缓存。修改连接配置或工具禁用列表后,下一次运行会使用新的配置键。

添加内置 stdio MCP

stdio MCP 等价于在 API/worker 容器内启动一个进程,只适合经过代码审查且必须本地运行的系统能力。远程服务可以承载时,优先使用 SSE 或 Streamable HTTP。

开发者在 service.py_DEFAULT_MCP_SERVERS 中添加固定定义:

_DEFAULT_MCP_SERVERS = {
    "example-mcp": {
        "command": "npx",
        "args": ["-y", "@scope/[email protected]"],
        "transport": "stdio",
        "description": "说明具体能力和使用场景",
        "icon": "🧩",
        "tags": ["内置"],
    },
}

commandargsenv 必须是代码中的固定值,包版本必须锁定;不能从 HTTP 请求、数据库字段或不受信任的环境拼接。env 只放非敏感固定值,密钥不能提交到代码或同步到数据库。

API/worker 启动时会把内置定义同步到数据库。新内置 MCP 默认未添加,管理员需要在管理页启用;内置项的连接配置由代码维护,不能删除或通过页面改成其他进程。

验证新内置 MCP:

docker compose up -d --build api worker
docker compose logs --tail=100 api worker

然后在管理页添加并测试工具。测试只确认连接和工具发现,不要在没有隔离和授权的情况下执行文件写入、Shell 或其他副作用。

Read the full file on GitHub · 107 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 107 lines · 0 tokens per session scan A 2a04c28944fb

Subscribe to this mod's changes

mcp-integration is an agent published in the GitHub repository xerrors/Yuxi (6,591 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,196 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.