0
· CLAUDE-CODE-FEATURE-RADAR · 2026.05.13 · 18 MIN ·

MCP 客户端 + 第三方服务器生态

Anthropic 主导但开放的标准,Cursor / Cline / Continue / OpenAI 全在接 —— 把接入第三方服务的成本压到 5 分钟。 · by 思扬
AI · HERO seed:3920260513 Anthropic 主导但开放的标准,Cursor / Cline / Continue / OpenAI 全在接 —— 把接入第三方服务的成本压到 5 分钟。
FIG.00 — cover · ai-generated · placeholder

原文:https://code.claude.com/docs/en/mcp 标准本体:https://modelcontextprotocol.io/introduction 官方 registry:https://api.anthropic.com/mcp-registry/v0/servers(JS 端动态拉,本机能 curl) 官方定位:Claude Code can connect to hundreds of external tools and data sources through the Model Context Protocol (MCP), an open source standard for AI-tool integrations.

🔥 影响力卡片

维度数据
标准制定方Anthropic 主导,但开放标准(modelcontextprotocol.io)— Cursor / Cline / Continue / OpenAI ChatGPT 全部正在接
官方 registry 规模”hundreds of external tools”(具体数字 dynamic loaded,不公开)
三种 transportstdio(本地进程)、http / streamable-http(推荐远程)、sse(已 deprecated)
本机 plugin 已带的 MCP server15 个(asana / context7 / discord / firebase / github / gitlab / greptile / imessage / laravel-boost / linear / playwright / serena / telegram / terraform / fakechat)
Anthropic 之外的 use casesGitHub Copilot 用了 MCP 接 GitHub(api.githubcopilot.com/mcp/)— Anthropic 标准被竞品采用
本机 changelog 已提及40+ 次(grep mcp 命中数);v2.1.139 让 stdio server 自动收到 CLAUDE_PROJECT_DIR

🎯 为什么必读

1. 这是 “Claude Code 与外部世界” 的官方协议。

不是某个 vendor 接口,不是 OpenAPI,不是 GraphQL — 是 专门为 AI agent 设计的工具/数据接入标准。任何东西想被 Claude(或者其他 AI agent)直接调用,做成 MCP server 就行。

2. 它把”接入第三方服务”的成本压到 5 分钟。

claude mcp add --transport http notion https://mcp.notion.com/mcp

完。Notion 接入完毕。不需要 OAuth 设置 / 不需要 API key 手工管 / 不需要写 wrapper

3. 它是 plugin marketplace 第三方插件的主要价值载体**。**

回看 plugin marketplace 那 15 个 external_plugins:它们大多数主要内容就是一个 MCP server 配置(.mcp.json + 简短 README)。所以”装 plugin = 一键 MCP 集成”。

4. MCP 解决的根本问题是:LLM 不擅长写 API client。

让 Claude 直接调 Linear REST API 是可行的,但每次都要:重读 API doc → 拼 URL → 处理 OAuth refresh → 解析 JSON。MCP 把这些预先打包成”工具”,Claude 直接 tool_use 调,省 token,省错误率

一句话总结

MCP = 给 AI agent 用的 “USB 标准”。任何外部服务做一个 MCP server,Claude Code 用一行命令接上,然后这服务的能力就变成 Claude 的工具。三种 transport:本地 stdio / 远程 HTTP / 远程 SSE(deprecated)。

💎 金句墙

“Connect a server when you find yourself copying data into chat from another tool, like an issue tracker or a monitoring dashboard.” “当你发现自己在反复从另一个工具(issue tracker / 监控面板)往 chat 里粘数据时,该接 MCP server 了。” —— 🟢 入门门槛信号 — 粘 3 次以上同类数据 = 该接 MCP

“Use third party MCP servers at your own risk - Anthropic has not verified the correctness or security of all these servers. Be especially careful when using MCP servers that could fetch untrusted content, as these can expose you to prompt injection risk.” “用第三方 MCP server 自负风险。特别要警惕能拉取不可信内容的 server — prompt injection 风险。” —— 🟢 安全警告必读 — 一个恶意 MCP server 能往 Claude 的 context 注入指令 → 操控 Claude 做坏事

“The SSE (Server-Sent Events) transport is deprecated. Use HTTP servers instead.” “SSE transport 已 deprecated。改用 HTTP server。” —— 🟢 新装时直接走 HTTP / streamable-http,SSE 是历史包袱

📋 核心精读

1. 三种 transport — 看一眼就知选哪个

Transport何时用实际例子
stdio(本地)你装的本地 npm 包 / Python 服务context7firebase、自己 python my-mcp.py
http / streamable-http(推荐远程)云上的官方 MCP 端点notionlineargithubgreptile
sse(deprecated)老的远程asana(仍用 SSE)

所以新接 server 时:云端服务 → HTTP;自己写的 → stdio。

2. 装一个 MCP server 的 3 种命令(全在 claude mcp 下)

# A. 远程 HTTP(最推荐)
claude mcp add --transport http notion https://mcp.notion.com/mcp

# B. 远程 HTTP + Bearer token
claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

# C. 本地 stdio + 环境变量
claude mcp add --transport stdio --env AIRTABLE_API_KEY=YOUR_KEY airtable \
  -- npx -y airtable-mcp-server

关键语法:-- 隔开 Claude Code 自己的 flags 和要传给 MCP server 的参数。这条很多人踩坑。

3. --scope 决定存哪 — 决定谁能用

Scope存在哪看得见的人
local(默认)~/.claude.json仅你,仅当前项目
project.mcp.json(进 git)项目所有人
user~/.claude.json user 段仅你,所有项目

实际用法:

  • API key 涉及的(私人)localuser
  • 公开服务(GitHub / GitLab / Notion 等团队都要)project(.mcp.json checkin 进 git)

4. .mcp.json 格式 — 4 种真实样本(本机已有)

A. SSE 远程(asana):

{
  "asana": {
    "type": "sse",
    "url": "https://mcp.asana.com/sse"
  }
}

B. stdio 本地通过 npx(context7):

{
  "context7": {
    "command": "npx",
    "args": ["-y", "@upstash/context7-mcp"]
  }
}

C. HTTP 远程带 token(github):

{
  "github": {
    "type": "http",
    "url": "https://api.githubcopilot.com/mcp/",
    "headers": {
      "Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
    }
  }
}

D. plugin 内部 stdio(discord — bun 启动):

{
  "mcpServers": {
    "discord": {
      "command": "bun",
      "args": ["run", "--cwd", "${CLAUDE_PLUGIN_ROOT}", "--shell=bun", "--silent", "start"]
    }
  }
}

${CLAUDE_PLUGIN_ROOT} 是 plugin 安装目录占位符。plugin 提供的 MCP server 启动时自动展开,用户配置的需要给默认值 ${VAR:-.}

5. /mcp 命令 — session 内查 / 操作 MCP server

> /mcp

显示:

  • 所有已连 server + 工具数量
  • 哪些 fetch 失败(connected but 0 tools / not auth’d)
  • 重连状态
  • 触发 OAuth 流程(对支持 OAuth 的远程 server)

v2.1.139 改进:/mcp Reconnect 不需要重启就能 pick up .mcp.json 的改动。

6. 自动重连 + 错误处理(企业级必看)

  • HTTP / SSE 断线:指数退避重连,5 次后标 failed
  • stdio 本地:不自动重连(本地进程死了你得自己起)
  • 初始连接失败:5xx / connection refused / timeout 重试 3 次(v2.1.121+)
  • 401 / 404:不重试(需要改配置)

7. 本机已带的 15 个 MCP server(plugin marketplace external)

MCP server类型
asanaSSEAsana 任务
context7stdio (npx)实时拉最新库 docs(超有用)
discordstdio (bun)Discord chat
fakechatstdio (bun)测试用 fake chat
firebasestdio (npx)Firebase 项目操作
githubHTTPGitHub PR / issue(用 Copilot 的端点!)
gitlabHTTPGitLab(无 auth header,匿名)
greptileHTTP语义跨 repo 搜索
imessagestdio (bun)macOS iMessage
laravel-booststdioLaravel 项目脚手架
linearHTTP/stdioLinear 任务管理
playwrightstdio浏览器自动化(替代 Chrome 扩展)
serenastdio多步任务编排
telegramstdio (bun)Telegram
terraformstdioIaC(Hashicorp 官方)

装方法:/plugin UI → 选 external_plugins/<name> → install。

8. OAuth 流程(对需要登录的远程 server)

很多 SaaS MCP server 走 OAuth(Notion / Linear / GitHub via Copilot)。流程:

claude mcp add --transport http notion https://mcp.notion.com/mcp

然后在 session 里:

> /mcp
# 选 notion → "Authenticate"
# → 浏览器跳出来,授权,回调
# → /mcp 显示 "authenticated, X tools available"

v2.1.136 修了一个老坑:多个 server 同时 refresh OAuth token 时不再丢 — 之前会每天 re-auth,现在稳了。

9. Channels — MCP server 消息给 Claude(高级)

普通 MCP 是 Claude 调 server。Channels 反过来:server 主动推消息给 Claude session,Claude 反应。

实际用法:

  • CI 挂了 → CI 监控 MCP 推消息 → Claude 自动 debug
  • Telegram 来消息 → Claude 看消息回复
  • 监控告警 → Claude 检查日志

启用:server 声明 claude/channel capability + 用户启动时 --channels flag。

详见 /en/channels(本系列暂不单写一篇,跟 hooks 有交叉)。

10. plugin 内嵌 MCP server 的 4 个特点

// plugin 的 .mcp.json
{
  "mcpServers": {
    "database-tools": {
      "command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
      "args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
      "env": { "DB_URL": "${DB_URL}" }
    }
  }
}
  • plugin 启用时自动起 server,卸载时自动停
  • 工具跟手工配置的 MCP server 并列出现(在 /mcp 面板)
  • 通过 plugin install / uninstall 管理,不需要单独 claude mcp 命令
  • ${CLAUDE_PLUGIN_ROOT} 占位符自动展开(不像项目级 .mcp.json 要写默认)

11. 常用环境变量调优

变量
MCP_TIMEOUT=10000server 启动超时 ms(默 3 秒太短)
MAX_MCP_OUTPUT_TOKENS=50000单次工具输出超过 10000 tokens 时会警告;调这个提高阈值
CLAUDE_PROJECT_DIRserver 启动时自动注入 — server 内可读 process.env.CLAUDE_PROJECT_DIR

12. 安全注意事项(必懂)

风险缓解
第三方 server 注入 prompt仅用可信源(Anthropic 官方 / 大厂自家 / open source 看过代码)
本地 stdio server 等于 Bash 调用不要 --env 传敏感凭证给可疑 npm 包
HTTP server 走未知公司 endpoint你的对话内容可能被采样 — 涉及私有代码 / IP 时仔细选
${VAR} 占位符plugin 自动展开 / 用户 .mcp.json${VAR:-default},别留空 ${VAR}
服务器名 workspace是保留字 — 用了会被跳过 + 警告

🟢 译者总评

1. MCP 是 Anthropic 的”标准制胜”豪赌

Anthropic 没把”接入工具”做成 Claude Code 自己的私有 protocol — 而是做成开放标准让别人接。结果是 OpenAI、Microsoft、Cursor 等都在用 MCP server(GitHub 的 MCP server 就是给 Copilot 用的)。

这给 Anthropic 带来的杠杆:

  • 每多一个第三方厂商做 MCP server,Claude Code 多一个工具(零边际成本)
  • 标准定义权 = 生态长期主导权
  • 用户从 OpenAI 切来 Claude 时,所有 MCP server 都能复用,降低切换成本

2. 对独立开发者,先装这 4 个就够了

按”边际价值排序”:

排名MCP server解决你哪个痛点
1context7写代码时 Claude 不知道最新 npm 包的 API → 一行 prompt “use context7 for X” 解决
2github(via Copilot endpoint)PR / issue / 仓库操作 — 比手敲 gh 命令快
3playwright浏览器自动化,跟 Chrome 扩展互补(headless 场景)
4linear(如果用 Linear)/ asana(如果用 Asana)任务 → 代码闭环

不要装的:

  • ❌ 你不会真用的(firebase / terraform 如果你没相关项目)
  • ❌ stdio 类启动慢的(MCP_TIMEOUT 没调好会拖整个 session 启动)
  • ❌ 第三方小公司没 review 过的(prompt injection 暴露面)

3. MCP 跟 Claude 其他能力的关系

                  [你的代码 / 项目]

        ┌─────────────────┼─────────────────┐
        │                 │                 │
   [Claude 主线]       [Subagent]       [Hook]
        │                 │                 │
        └────tool_use─────┴──tool_use───────┘

                  ┌───────┴───────┐
                  │               │
              [本机工具]      [MCP 工具]
              Read/Edit/Bash      │
                          ┌───────┴───────┐
                          │               │
                       [stdio]         [HTTP/SSE]
                          │               │
                     本地 npm 包      远程 SaaS 端点

MCP 不是替代 Read/Edit/Bash — 是它们的”外部扩展坞”。Read/Edit/Bash 处理本机,MCP 处理一切外面的东西。

4. 等过两年回头看,MCP 可能比 Claude Code 本身还重要

Anthropic 在通过 MCP 把整个 AI agent 生态规范化。如果你打算长期做”靠 AI 干活”的开发者,MCP 是必修课:

  • 短期:学会装 / 用
  • 中期:学会写 MCP server(给自己的 demo 项目接入)
  • 长期:你给客户做的产品里,可能会有 MCP server 形态(让客户的 AI 团队用)

🔗 延伸阅读

🔗 调研来源(可校验)

  • 主原文:https://code.claude.com/docs/en/mcp
  • 本机已带 15 个 MCP server 配置:~/.claude/plugins/marketplaces/claude-plugins-official/external_plugins/*/.mcp.json
  • changelog v2.1.139:MCP stdio servers now receive CLAUDE_PROJECT_DIR in their environment(raw/scan/CHANGELOG.md 第 12 行)
  • changelog v2.1.121:HTTP/SSE 初始连接重试 3 次
  • changelog v2.1.136:OAuth refresh token 多 server 并发问题修复
  • 标准本体仓库:github.com/modelcontextprotocol(open source,可读)