写自己的 MCP server 前先看——2026 年的生态已经很丰富,许多场景套个现成的就能跑。本章把高频 server 速览一遍,让你的"自写冲动"用在真正缺的环节。

16.1 三类速览

┌───────────────────────────────────────────────────────────┐
│ 类别              │ 代表 server                            │
├───────────────────────────────────────────────────────────┤
│ 系统与工程         │ filesystem / git / github / brave-search│
│ 数据与知识         │ postgres / sqlite / context7 / notion  │
│ 业务与平台         │ slack / linear / jira / gdrive         │
└───────────────────────────────────────────────────────────┘

16.2 系统与工程类

filesystem (官方)

  • 提供 read_file / write_file / list_directory / search_files
  • 谁需要:让 Agent 改本地文件,但 harness 已自带 Edit/Write——重合度大。若 harness 已有,可省

git (官方)

  • git status / log / diff / commit 包装
  • 重点:MCP 化的 git 比裸 bash git 有结构化输出,便于 Agent 解析冲突

github (official)

  • 暴露 issue / PR / repo 操作
  • 用例:让你在 Cursor 里直接 “create PR for this branch”,而不切回浏览器
  • 注意权限:用 fine-grained PAT,scope 限定到所需 repo
  • 给 Agent “实时网络搜索” 能力。pretrain 之外的"互联网"
  • 用法差异:brave 偏 web、exa 偏语义、tavily 偏 LLM-friendly

16.3 数据与知识类

postgres / sqlite (official)

  • 暴露 query / schema / list_tables
  • 让 Agent “查数据” 但不开"改数据"——所有写操作 ✓ client 控制
  • ⚠️ 必须只读连接:用一个 readonly role,连 read committed 都不开写

context7 (Upstash)

  • 本课程推荐:检索官方文档(React / Vue / Hono / Anthropic SDK 等都覆盖)
  • 用法:模型生成候选代码前,先检索 context7,避免凭训练数据猜 API
  • 跟 RAG 区别:context7 是"网上文档 RAG",专门服务编程任务

notion / confluence / linear

  • 把你的 PM 文档、产品 spec、任务单接入模型
  • 用例:让 Agent 做 review 时能"读到 Jira 上的 acceptance criteria"

16.4 业务与平台类

slack

  • 发消息 / 列 channel / 搜索历史
  • 典型自动化:“CI 失败时,把 trace 发给 owner”——Agent 自己做
  • 警惕:能发意味着能误发。配 channels:write scope 时先做 dry-run mode

linear / jira

  • 跟 issue 状态机对接:让 Agent 自动转单、加 comment
  • 注意:状态机敏感,建议先开 read-only 后再加 mutation

google drive / microsoft graph

  • 读文档 / 列文件
  • 体验判断:SaaS 公司的工作台已是 MCP 主战场

16.5 配置速查

OpenCode 一次配多个 MCP:

{
  "mcp": {
    "github":    { "type": "stdio", "command": "npx",
                   "args": ["-y", "@modelcontextprotocol/server-github"],
                   "env":   { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GH_PAT}" } },
    "postgres":  { "type": "stdio", "command": "npx",
                   "args": ["-y", "@modelcontextprotocol/server-postgres",
                            "postgresql://readonly@localhost/mydb"] },
    "context7":  { "type": "http",  "url": "https://mcp.context7.com/mcp" },
    "myteam-slack":{
                   "type": "stdio", "command": "uvx",
                   "args": ["--from", "git+https://github.com/myteam/mcp-slack",
                            "mcp-slack"],
                   "env": { "SLACK_TOKEN": "${SLACK_BOT_TOKEN}" } }
    }
}

环境变量 ${VAR} 从进程环境读取,不入配置文件本体——这是上一章 7 个安全约束的实操。

16.6 怎么挑:四问选型

高 → 取向 低 → 取向
该 server 改的是生产数据吗? 改用 read-only 普通即可
该 server 频繁被调吗? 走 SSE 长连 stdio 即可
单个 session 用几次? 多次 → 常驻进程 (stdio) 一次性 → HTTP SSE
是否敏感网络出口? 自托管 选用官方托管版

总结规律:本地 / 高频 / 敏感 → stdio;遥端 / 中频 / 公开数据 → HTTP。

16.7 三个真实场景

场景 1:Cursor + context7 + postgres

你的项目用了一些新潮库,模型可能不熟。Cursor 配 context7 + postgres MCP:

  • 模型生成 ORM 代码时,自动 context7 查 SQLAlchemy 2.x 写法
  • 调试时让模型 select * from orders limit 5 看真实数据(只读)

场景 2:Claude Code + github + slack

团队 PR review 流程:

[USER]
看一下我今天推送的 PR,如果有 conflict 告我 slack

[AGENT]
- list_pull_requests → 找 PR123
- get_pull_request_files → 发现 3 个文件
- check_slack_history → 找负责 reviewer
- post_message → "PR123 有 conflict 在 src/foo.ts, @owner 请 check"
DONE

场景 3:OpenCode + filesystem + notion

把 Notion 的产品 spec 同步进项目:

  • Agent 起头主动 fetch Notion 的 spec,写入 SPEC.md
  • 后续所有任务以本地 SPEC.md 为 ground truth(avoid 反复 pull)

16.8 警惕三类问题 MCP server

问题 现象 解法
过度权限 server 默认能 read+write 全部 启动用最小权限账号
重 type 错 返回的 content 断言不匹配 schema 客户端做 round-trip validate
死锁 server 调外部 API 失败挂住 服务器端加 timeout + 错误回包

16.9 小结

  • 三类 server:系统工程 / 数据知识 / 业务平台
  • 四问选型:是否改生产 / 调用频率 / 单 session 用次 / 敏感出口
  • 用最小权限运行,配 ${ENV_VAR} 注入 secret
  • 不要总想着自己写——先看官方 / 社区有没有

下一篇:《17 开发你的第一个 MCP Server》——现成没合适的就写一个,30 行上手 + 实战 example。

Summary: 三类生态 server + 四问选型,先复用再自写。