跳到正文
DEV Community· PickAPlugin·· 4 小時前AI 評分70

如何在安裝前檢查 MCP 伺服器是否安全

How to check an MCP server is safe before you install it

AI 導讀

PickAPlugin 作者整理了 MCP 伺服器安裝前的安全檢查清單,供用戶自行核查來源、安裝命令與權限風險。本機 stdio 伺服器不受協定沙箱保護,可讀取用戶有權存取的檔案並連接外部網絡;遠端 HTTP 伺服器則要求信任其營運者處理智能體傳送的內容。清單建議核對發佈者及套件名稱、固定版本、審閲安裝命令、限制憑證與檔案及網絡權限,並隔離第三方本機伺服器;工具描述亦應視為不可信內容。

正文

PickAPlugin

Disclosure: I run PickAPlugin, an independent catalog of ChatGPT and Codex plugins and MCP servers. This is adapted from our guide on the same topic. We don't test or audit anything we list, so this is a checklist for doing that part yourself, based on the official MCP, Claude, Cursor and Codex docs.

A listing on a registry, npm, GitHub or a directory (ours included) is not a review. Before you add an MCP server, here is the checklist I use.

What you're trusting

A local stdio server is an ordinary process your app starts as you. The protocol doesn't sandbox it, so it can read files your user can read (SSH keys, cloud credentials, browser profiles), see the environment variables you pass in, and make outbound network connections. A remote HTTP server is a different trade: you're trusting the operator with whatever your agent sends it. Every server you enable also shares the model's context, so keep the roster small.

The checklist

  1. Know what's already installed. Read your existing config: claude_desktop_config.json for Claude Desktop, the two mcp.json files for Cursor, or codex mcp list and ~/.codex/config.toml for Codex. Remove servers you don't use.
  2. Identify the publisher. Can you tie the package to a real repository and maintainer? Is the activity plausible, or did a quiet repo suddenly ship a release?
  3. Check the exact package name. Typosquatting is cheap. Compare the name in the install command, letter by letter, with the official README. For example, @modelcontextprotocol/server-filesystem is not @modelcontextprotocal/server-filesystem.
  4. Pin the version. Avoid npx -y some-package@latest. Pinning the top-level package doesn't freeze transitive dependencies, though. Pinning a container image by digest does.
  5. Read the actual command. Watch for a surprising download host, a curl-piped-to-shell installer, arguments that grant broad filesystem paths or Docker sockets, and post-install scripts.
  6. Give each server its own limited credentials. Use environment variable names or the app's secret store, not live secrets in a committed config file. Use read-only or fine-grained tokens.
  7. Limit filesystem and network reach. Give a server specific directories, read-only when that's enough. Don't point it at / or your home directory.
  8. Isolate third-party local servers. A container with minimal mounts turns "can read my SSH keys" into "can read an empty directory."
  9. Treat tool descriptions as untrusted. The server sends its tool names and descriptions to the model at runtime, which is an injection surface a README review doesn't cover.

The full version, with Claude Desktop, Cursor and Codex specifics, is here: how to check an MCP server is safe. If you also need install steps, see how to install an MCP server in Claude, Cursor and Codex.

來源:DEV Community · dev.to