
mcp-pin
io.github.GautamTalksDevv0.2.1更新於 Oct 6, 2026
Check if an MCP server's tool definitions changed after approval, from a signed public log.
概覽
一個本機 stdio 代理,會固定 MCP 工具定義,並在核准後工具、提示或指令變更時封鎖該伺服器。
- 功能
- mcp-pin 位於 MCP 用戶端與本機 stdio 伺服器之間,在核准時對每個工具的完整中繼資料以及伺服器的提示與指令建立指紋,並在每次連線時及整個工作階段期間重新檢查。若有任何差異,工作階段會被封鎖並顯示附標籤的差異,排隊中的呼叫不會被轉送。它也提供唯讀查詢工具,用來回報公開伺服器的工具清單是否變更、本機哪些伺服器已固定、待審核變更的類型,以及如何設定保護。公開簽章日誌會記錄已爬取伺服器的工具定義版本。
- 適用情境
- 當你執行具有廣泛權限的本機 stdio MCP 伺服器(例如檔案系統、GitHub、SSH、Kubernetes 或資料庫伺服器),並希望以確定性方式確認所核准的工具仍是目前提供的工具時,可以使用它。團隊也可以提交鎖定檔,像審查相依套件更新一樣審查定義變更。
- 執行需求
- 需要 Node.js 20 或更新版本,透過 npx 執行。代理僅支援 stdio 傳輸;HTTP 與 SSE 伺服器無法被代理。未宣告需要帳號、API 金鑰或環境變數。公開日誌查詢工具需要網路存取;代理本身在本機執行。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 mcp-pin,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-pin
The tool you approved is not the tool you're running.
[test] [license] [node] [Listed on mcpservers.org] [mcp-pin on Glama]
A local proxy that blocks tool drift, and a public log that remembers every version.
What happens · See it in 10 seconds · Quick start · The public log · Verify it yourself · Security · Threat model
Watch: The AI Tool You Approved Is Not the One Running Now (7 min), including the two bugs I shipped while building this.
Play: Spot the rug pull (60 seconds). Seven tools, eight seconds each: keep or block. Then see what mcp-pin flags.
What actually happens
You add an MCP server. Your client shows you a dialog. You read the tool descriptions, they look fine, you click approve.
That decision is never revisited.
The server can serve one set of tool definitions on Monday and a different set on Tuesday. Tool descriptions are not data that the model reads and sets aside. They are instructions that shape what the model does next, which means a changed description has the same reach as a changed system prompt. The MCP specification requires no integrity check, and most clients never re-prompt when definitions change underneath an already approved server. Visual Studio is the exception: since version 18.7 (June 2026) it compares a server's tools, prompts, resources and instructions with the last trusted version when the server starts, and asks before running it. mcp-pin does the same for the stdio servers in other clients, and keeps checking for the whole session.
That silence is the problem. Not that the model will certainly obey the new instruction, but that nobody checked, and nobody was told.
What mcp-pin does
Two surfaces, one engine, zero inference.
The proxy fingerprints every tool's full metadata at approval time, along with the server's prompts and its instructions to the model, and re-derives that decision on every connect. If anything changed, including a change the server did not announce, the session is blocked with a diff. Client traffic is queued until that check completes; on drift, nothing queued is forwarded. After that, every tool and prompt listing your client receives is checked against the pin before it is delivered, for the whole session, so a server cannot show the check one toolset and your client another, or change its tools halfway through. It speaks both the 2026-07-28 protocol (no initialize handshake) and the earlier ones.
The public log crawls MCP servers on a schedule, records every version of every tool definition, and keeps the history. Hash linked, signed, downloadable, and verifiable by anyone with no need to trust whoever publishes it. The crawler follows tools/list pagination; versions ≤0.1.0 did not, and records from those crawls are a floor rather than a count for any paginated server.
The tool never asks a model whether a change looks dangerous. It computes a hash and compares it. That is the whole design, and it is deliberate. A deterministic check keeps working when a model has a bad day, and it keeps working on the subtle changes a model would wave through.
See it in 10 seconds
A harmless bundled server changes its one tool between two sessions: the description starts asking for notes from the conversation, and the schema grows a field to carry them. The first session pins it. The second is blocked, with the diff. It runs in a temporary folder that is deleted afterwards, never touches your real pins, never calls a tool, and makes no network calls.
mcp-pin is published on npm only. The Python package named mcp-pin on PyPI is a separate project, not affiliated with this one.
Kill test
Pre-registered on 1 September 2026, before any code was written.
By 15 October 2026: at least 10 public MCP server READMEs carry the mcp-pin badge, OR at least 100 unique proxy installs (npm downloads excluding CI).
If neither happens, this repository is archived and the numbers are published as they stand.
It lives in the README so it cannot be quietly renegotiated later.
Protect every server in one command
It finds the MCP servers configured in Claude Desktop, Claude Code, Cursor, VS Code, Gemini CLI, Devin Desktop, Windsurf, Cline and Codex, shows you what it will change, backs up each file to ~/.mcp-pin/backups, and puts mcp-pin in front of every local server. Remote (URL) servers are left as they are, because the proxy speaks stdio only. Running it twice changes nothing; mcp-pin unwrap takes it out again. Restart the apps afterwards. Another app's config: mcp-pin wrap --config <file>. A project's shared .mcp.json is only touched with --project, because teammates use it too.
One click, and the Claude Code plugin
mcp-pin.gautamkhosla.com/install has Add to Cursor and Add to VS Code buttons, and a generator: paste any MCP server command and get it protected for Claude Code, Claude Desktop, Cursor, VS Code, Codex and the rest, plus an install link server authors can put in their own README.
In Claude Code, the plugin adds the lookup tools below, a skill for checking a server before you trust it, and a one-line note at session start listing local servers that run without mcp-pin (it reads config files only and changes nothing):
Agents that read Agent Skills from a folder (Muse Code reads .agents/skills/, for example) can use the same skill: copy plugins/mcp-pin/skills/mcp-pin into that folder.
Ask mcp-pin from your AI app
mcp-pin is also an MCP server. Add it like any other and your agent can check a public server before you install it, and tell you which of your servers is waiting for review after a block.
All four are read-only. They never return third-party text, neither tool descriptions from the log nor the changed definitions of a pending review, because a tool's output goes straight to the model. Names are reduced to a safe character set; the rest is dates, counts, hashes and fixed label keys. Approving stays with you in a terminal. mcp-pin lookup --http 8787 serves the two public tools over Streamable HTTP on localhost, for hosting as a remote connector; it never exposes the pins of the machine it runs on.
Protect one MCP server in 60 seconds
Pick the server with the most access. Filesystem, GitHub, SSH, Kubernetes, a database, anything cloud. Put mcp-pin in front of it.
Add it in front of a server in your client config:
First run pins. Every run after that verifies.
When the server changes its mind about what its tools do:
Above the diff, every change is labelled so you can triage it at a glance: New tool, New field: context, New instruction to the model, Mentions secrets or private files, New link or address, Hidden or unusual characters, Permission hint changed: readOnlyHint false to true, or Wording only. The labels come from fixed rules over the two versions, not from a model, and they never unblock anything: every change still waits for you.
Your client gets an error that names the server, the review command and the label names. It never repeats the changed text, because clients can pass error messages to the model and that text is the attack. Read the diff in a terminal with mcp-pin review <id>.
All commands
What it works with
Dated, because this changes. Last verified 5 October 2026.
I would rather this table be short and true than long and optimistic.
What gets fingerprinted
The whole tool object. Name, description, input schema, and annotations, canonicalized per RFC 8785 and hashed with SHA-256. Adding or removing a tool changes the set hash as well.
The rule is simple. If the model can read it, it is in scope. Key order does not matter, tool order does not matter, whitespace does not matter. A single character of a description does.
The exact recipe is an open spec, the tool definition hash, with test vectors and a second, independent implementation in Python, so a registry, a gateway or another client can compute the same hashes and check each other's.
For teams: commit an mcp-pin.lock
A pin on one laptop protects one person, from whatever that laptop saw first. A team that shares a .mcp.json can commit what it approved instead, and review every change to it like a dependency update.
The first command starts each local server in .mcp.json, reads what the model would read (tools, prompts and the server's instructions), stops it, and writes mcp-pin.lock. No tool is called. Every definition is stored as readable JSON, so the pull request that updates the lock shows exactly what a server now tells the model. The second puts the proxy in front of each server in the shared config, pointed at the lock:
Commit both files. From then on a server that differs from the lock is blocked on every teammate's machine, on the first run too, before anything is forwarded, and for the whole session. A lock that is missing, unreadable or edited by hand so it no longer matches its own hashes stops the server instead of falling back. A relative lock path is read from the folder the client starts the server in; if yours starts servers somewhere else, use an absolute path.
In CI, mcp-pin lock --check starts each server, compares it with the lock, prints the same labels as a block and exits 1 on any change, including a command edited in .mcp.json without re-locking. When a change is expected, run mcp-pin lock and commit the new lock in a pull request, so a person reads it before anyone's agent does.
${VAR}, ${VAR:-default} and ${env:VAR} in the config are filled in from the environment, the way clients do. A server that needs a credential just to list its tools needs it in CI as well.
The package behind the definitions
Definitions can stay the same while the code behind them changes. In September 2025, version 1.0.16 of the npm package postmark-mcp added one line that blind-copied every email it sent to an outside address (The Hacker News, Snyk). Anyone who ran it as npx -y postmark-mcp got the new code on their next start.
So the lock also records the package each server runs: the exact npm or PyPI version and the registry's digest of it (npm's integrity, PyPI's file hashes), or the image digest of a docker run image@sha256:... command.
- The proxy runs the locked version, even when the config asks for the newest:
npx -y some-serverrunssome-server@<locked version>, so new code waits for a reviewed lock update. A config that names another version or package does not start. mcp-pin lock --checkchecks the version that runs. It fails if the registry now serves different contents for it, and only notes that a newer version is out, so CI does not go red every time a server publishes.mcp-pin lockupdates. It resolves the newest version, probes exactly that version and records it, so the pull request shows the version change and any definition change together.
A published npm version or PyPI file cannot be replaced, so the version carries most of the weight. The digest catches a registry or mirror that serves something else, and a new file added to an old PyPI release. Understood: npx, npm exec, pnpm dlx, yarn dlx, bunx, uvx and pipx run --spec. A version range (^1.2.0) cannot be held, so lock asks for an exact version or a tag. Docker images are held only when the config pins a digest, and mcp-pin wrap points out every server whose package is not pinned. A package the registry will not show without credentials can be locked with --definitions-only.
For admins: require mcp-pin across the organisation
Write the approved servers in one config file, lock them, and generate the policy for the AI tools your organisation uses:
That writes, under mcp-pin-policy/, a policy for each product in which every approved local server runs through mcp-pin, pinned to the organisation's lock with --only-locked, so a server the lock does not list does not start. Deploy the lock to that path on every machine, and the policy files with your device management. Nothing is installed by the command.
What these controls compare is the configured command, not what it runs. That is why the lock matters: the policy makes every server go through mcp-pin, and mcp-pin checks the definitions and the package version against what the organisation approved. Because the matching is exact, regenerate the policy when the approved list or the mcp-pin version changes. Remote (HTTP) servers are listed by URL; mcp-pin cannot sit in front of them yet. Checked against each vendor's documentation on 5 October 2026.
Catch it in your own CI
Experimental. The GitHub Action is not part of the npm releases. Its bootstrap instructions currently reference a package that is not on npm, and the baseline does not survive the runner. Use the local proxy. Do not adopt the action in CI yet.
For a CI gate that works today, commit an
mcp-pin.lockand runnpx -y [email protected] lock --checkin any CI: it fails the build when a server's definitions or the contents of its locked package change. See For teams.
If you maintain an MCP server, the useful place to notice a definition change is the pull request that makes it.
First run writes .mcp-pin/tools.json; commit it. After that every pull request that moves a tool definition gets a comment with the diff, and schema changes that leave the description untouched are called out first.
The baseline lives in your repository and nothing is sent anywhere. There is a test in the suite that fails if the action ever contacts a remote host.
Full options in docs/ACTION.md.
The public log
The log records changes, not heartbeats. A server that never changes produces exactly one entry, which is why a quiet log is a good log.
The monthly drift report
On the 1st of each month the crawl job counts the month that ended from the log it has just verified and publishes it at /reports/: how many servers changed their tool definitions, what kind of change it was (a new tool, a new input field, a flipped permission hint, new wording that instructs the model), and which servers, by count of tools. Gaps in the crawl are stated, and a change first seen after one is dated by the window it happened in, not by the day it was noticed. The labels are mechanical, so they are totals and never shown against a named server. Run it yourself with npm run report:month -- --month 2026-10; it writes data/reports/2026-10.json.
The badge
Server authors can show their users that their definitions are stable and being watched.
The badge only ever states a fact about time. It says unchanged 91d or changed today. If the crawler has not had a good look in more than three days it says last checked 4 Sep instead of a number that kept growing while nobody looked, and a change first seen after a gap reads changed since 4 Sep, because the day it happened is unknown. It never says "safe", because this project cannot know that and will not imply it.
Verify it yourself
The point of a transparency log is that you do not have to trust the people running it. Every entry is hash linked to the one before it, and the head is signed with Ed25519. The verifier pins PUBLIC_KEY.txt; it will not accept a head signed by whatever key arrives with the file.
Change one byte of any historical entry and that command exits non zero. If this project ever quietly edited history, anyone holding an older copy could prove it.
How this differs from mcp-warden
mcp-warden is a lockfile and CI gate for the MCP server you build. It is at v1, it uses the same RFC 8785 plus SHA-256 canonicalization, and on schema diffing it is more thorough than this project: it classifies each mutation (required dropped, enum widened, type broadened, constraints relaxed) rather than reporting one opaque change, and it uploads SARIF to code scanning. It also inspects tool results at runtime.
If you maintain an MCP server and want a CI gate, use mcp-warden. It is better at that job and it was there first.
mcp-pin answers a different question. A lockfile tells you that your own server changed since your last commit. It cannot tell you what a third-party server's tools looked like last Tuesday, because nobody kept that record. This project keeps it: a public, hash-linked, signed history across every server it can reach, so you can look up a server you did not write and see what it used to say.
One is a lockfile for what you ship. The other is a history for what you install.
And from Snyk Agent Scan
Snyk Agent Scan (formerly Invariant's mcp-scan) discovers the MCP servers and skills on your machine and scans them for prompt injections and other threats hidden in natural language. If you want something to judge what a description says, use a scanner like that.
mcp-pin is narrower on purpose. It sits inline as a stdio proxy, holds your client's traffic until the toolset matches the pin, and decides with a hash comparison rather than a model. It does not judge content at all. It tells you that what you approved stopped being what is running, and it keeps the public record of when that happened across every server it can reach.
What this does not protect against
mcp-pin detects when a server's tool definitions change between sessions, including changes the server did not announce. That is the claim the evidence supports.
It does not protect you from a malicious program running as the same user. That program can delete ~/.mcp-pin and re-pin itself. That is an architectural limit of a local pin store, not a bug, and it will not be "fixed" by writing the same files harder. Day-one malice that never changes is also invisible. A pin is not a safety rating.
Versions ≤0.1.0 silently truncated paginated servers and silently lost concurrent pin writes while reporting success. Use 0.1.2 or later.
Honest limitations
Listed here rather than buried, because a security tool that oversells itself is worse than no tool at all.
Development
Zero runtime dependencies, Node 20 or newer. That is not minimalism for its own sake. A supply chain security tool with a large dependency tree is a joke at its own expense.
Contributing and security
- Found a vulnerability? See SECURITY.md. Please do not open a public issue first.
- Want your server out of the log? Add it to OPTOUT.txt or open an issue titled
opt out: <name>. Honoured on the next crawl, no justification needed. - Everything else is in CONTRIBUTING.md.
Further reading
- docs/THREAT_MODEL.md, mapped to the OWASP LLM Top 10 (2026), the OWASP Agentic Top 10 (ASI01 to ASI10), and STRIDE
- docs/ARCHITECTURE.md, how the pieces fit and why
- docs/OPERATIONS.md, running the crawler without harming anyone
- docs/VERIFYING.md, auditing the log without trusting us
- CHANGELOG.md, including what 0.1.0 silently got wrong
Who runs this
An independent open-source project built and run by Gautam Khosla, a student. Not affiliated with, endorsed by, or connected to Anthropic, the Model Context Protocol project, npm, GitHub, or any server listed in the log.
The crawler identifies itself, calls initialize and tools/list (following pagination), never invokes a tool, runs at most once per server per day, and never supplies a real credential or attempts to bypass authentication. Full policy: docs/OPERATIONS.md and the about page.
A badge is not a safety rating. unchanged 91d means the fingerprint has not moved in 91 days. It says nothing about whether a server is safe or trustworthy.
Opting out: add your server to OPTOUT.txt, open an issue titled opt out: <name>, or email me. No justification is requested and none is required.
Provided as is, without warranty of any kind, under the MIT licence. This is a hobby research project run by one person alongside university study. Do not build a compliance process on it.
MIT licensed. Built by Gautam Khosla.
來源:README.md,提交 a00870e
工具
0版本歷史
1- v0.2.1最新Oct 6, 2026


