MCP(Model Context Protocol)把模型与外部工具连接起来,常用于数据库检索、文档检索、自动化测试等场景。本文整理我常用的 MCP Server,逐一说明功能、给出去敏配置,并分别说明在 Cursor、Claude Code 与 Codex 中的接入方式。

为避免泄露敏感信息,下面所有配置均已脱敏,请按你的实际环境替换尖括号内容。建议将密钥放在环境变量或本地密钥管理中,不要提交到仓库。

1. mysql-local

功能:通过 MCP 连接 MySQL 数据库,执行查询、查看表结构、做数据辅助分析。

配置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "mysql-local": {
    "command": "npx",
    "args": [
      "-y",
      "@neigezhujiayi/mysql-mcp-server",
      "--host",
      "<DB_HOST>",
      "--port",
      "<DB_PORT>",
      "--user",
      "<DB_USER>",
      "--password",
      "<DB_PASSWORD>",
      "--database",
      "<DB_NAME>"
    ]
  }
}

配置方法:

  • Cursor:打开 Settings → MCP Servers,新建服务器并填入本节配置;若使用配置文件,合并到 ~/.cursor/mcp.jsonmcpServers
  • Claude Code:在 Claude Code 的 MCP 配置文件中加入本节配置;常见路径为 ~/.claude/mcp.json(不同版本可能略有差异)。
  • Codex:在 Codex 的 MCP 配置文件中加入本节配置;常见路径为 ~/.codex/mcp.json

2. context7

功能:把常用知识或片段存入 Upstash Redis,通过 MCP 做检索与补充上下文。

去敏配置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "context7": {
    "command": "npx",
    "args": [
      "-y",
      "@upstash/context7-mcp@latest"
    ],
    "env": {
      "UPSTASH_REDIS_REST_URL": "<UPSTASH_REDIS_REST_URL>",
      "UPSTASH_REDIS_REST_TOKEN": "<UPSTASH_REDIS_REST_TOKEN>"
    }
  }
}

配置方法:

  • Cursor:在 MCP Servers 中新增 context7,把本节配置粘贴进去;如用文件则合并到 ~/.cursor/mcp.json
  • Claude Code:在 Claude Code 的 MCP 配置文件加入本节配置;常见路径为 ~/.claude/mcp.json
  • Codex:在 Codex 的 MCP 配置文件加入本节配置;常见路径为 ~/.codex/mcp.json

3. nanobanana

功能:通过 MCP 调用 Gemini 能力(如多模态/图像等),便于在工作流里统一调用。

带上“专业”的提示词,即可调用 Pro 模型

配置:

1
2
3
4
5
6
7
8
9
{
  "nanobanana": {
    "command": "uvx",
    "args": ["nanobanana-mcp-server@latest"],
    "env": {
      "GEMINI_API_KEY": "<GEMINI_API_KEY>"
    }
  }
}

配置方法:

  • Cursor:MCP Servers 中新增 nanobanana,填入本节配置;如使用文件则合并到 ~/.cursor/mcp.json
  • Claude Code:在 Claude Code 的 MCP 配置文件加入本节配置;常见路径为 ~/.claude/mcp.json
  • Codex:在 Codex 的 MCP 配置文件加入本节配置;常见路径为 ~/.codex/mcp.json

4. playwright

功能:用 Playwright 做网页自动化与 UI 测试,可用于截图、表单自动化、回归验证等。

去敏配置:

1
2
3
4
5
6
{
  "playwright": {
    "command": "npx",
    "args": ["-y", "@executeautomation/playwright-mcp-server"]
  }
}

配置方法:

  • Cursor:MCP Servers 中新增 playwright 并粘贴本节配置;或合并到 ~/.cursor/mcp.json
  • Claude Code:在 Claude Code 的 MCP 配置文件加入本节配置;常见路径为 ~/.claude/mcp.json
  • Codex:在 Codex 的 MCP 配置文件加入本节配置;常见路径为 ~/.codex/mcp.json

5. spec-workflow

功能:把本地规范目录作为工作流输入,辅助生成任务拆解、验收标准或实现步骤。

配置:

1
2
3
4
5
6
{
  "spec-workflow": {
    "command": "npx",
    "args": ["-y", "@pimzino/spec-workflow-mcp@latest", "<PATH_TO_SPEC_DIR>"]
  }
}

配置方法:

  • Cursor:MCP Servers 中新增 spec-workflow 并粘贴本节配置;或合并到 ~/.cursor/mcp.json
  • Claude Code:在 Claude Code 的 MCP 配置文件加入本节配置;常见路径为 ~/.claude/mcp.json
  • Codex:在 Codex 的 MCP 配置文件加入本节配置;常见路径为 ~/.codex/mcp.json

6. chrome-devtools-mcp

功能:通过 MCP 连接 Chrome DevTools,支持页面自动化、网络/性能分析、截图与调试等。

配置:

1
2
3
4
5
6
{
  "chrome-devtools": {
    "command": "npx",
    "args": ["-y", "chrome-devtools-mcp@latest"]
  }
}

使用方法:

  • 默认模式下,只有在真正调用工具时才会自动启动 Chrome。
  • 验证用例:在 MCP 客户端输入 Check the performance of https://developers.chrome.com
  • 如需复用已有登录态或规避沙箱限制,建议按以下步骤连接已启动的 Chrome:
    1. 先完全退出所有 Chrome 实例,避免端口占用或选错 Profile。

    2. 用 macOS 命令启动 Chrome 并开启 remote debugging,务必指定独立的 --user-data-dir,避免暴露主 Profile:

      1
      2
      3
      
      /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
        --remote-debugging-port=9222 \
        --user-data-dir=/tmp/chrome-profile-stable
    3. 在 MCP 配置中追加 --browser-url=http://127.0.0.1:9222(端口改动需同步调整),例如:

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      
      {
        "chrome-devtools": {
          "command": "npx",
          "args": [
            "-y",
            "chrome-devtools-mcp@latest",
            "--browser-url=http://127.0.0.1:9222"
          ]
        }
      }
    4. 可用 http://127.0.0.1:9222/json/version 验证连接,必要时取 webSocketDebuggerUrl 改用 --wsEndpoint=...

    5. 安全提示:remote debugging 端口会让本机任意程序控制浏览器,开启期间不要登录敏感网站。

配置方法:

  • Cursor:MCP Servers 中新增 chrome-devtools 并粘贴本节配置;或合并到 ~/.cursor/mcp.json
  • Claude Code:在 Claude Code 的 MCP 配置文件加入本节配置;常见路径为 ~/.claude/mcp.json
  • Codex:在 Codex 的 MCP 配置文件加入本节配置;常见路径为 ~/.codex/mcp.json

常见注意事项

  1. npxuvx 需要可执行:请先安装 Node.js(chrome-devtools-mcp 需 v20.19+)与 uv(或 uvx),并安装 Chrome。
  2. 密钥尽量用环境变量注入,避免写入仓库;可在终端启动前 export,或使用本地密钥管理。
  3. 配置路径可能随版本变化,如找不到对应文件,以客户端设置页或官方文档为准。