Check that the MCP server you run is built from the code you can read.
An MCP server from npm runs with your files, tokens and shell. You read its GitHub repository, then npx runs a tarball
that was built somewhere else. mcp-sourcecheck ties the two together: it downloads the published tarball, finds the
commit it claims to come from, and compares the bytes. By default it never runs any server or package code.
npx github:KemalG-u/mcp-sourcecheck scan # every MCP server in your Claude Code / Desktop / Cursor / VS Code config
npx github:KemalG-u/mcp-sourcecheck check @modelcontextprotocol/server-filesystem@2.4.1Snapshot of 2026-11-30 (tool v0.1.0). Every number below is produced by bench/run.mjs; full data in bench/results.json and bench/snapshot-2026-11-30.json; how to reproduce it: bench/REPRODUCE.md.
The official MCP registry (all 3,033 pages read): 303,278 entries (all versions), 76,643 distinct active servers.
| servers | |
|---|---|
| remote endpoint only (no package) | 47,307: remote, cannot be verified by anyone but their operators |
| list an npm package | 20,035 (19,751 distinct npm packages) |
| list a PyPI package | 5,671 (not supported in v0.1) |
| list an OCI image | 2,147 (not supported in v0.1) |
The 100 most-downloaded npm packages (weekly downloads, 7 days; the 100th has 8,381):
99 checked | 71 attested | 67 source-match | 13 unlinked | 17 to review (105 files) | rebuilt 12/30
(bench/table.txt has the same line from the script; "to review" means verdict MISMATCH with review: "needs-review".)
- 71 of 99 have npm build provenance whose subject digest equals the tarball (the signature itself is not verified here).
- 67 of 99 match their linked commit file for file, apart from build output. For 13 of these, every file in the tarball is verified against the source (byte-identical, identical after line-ending normalisation, a copy of another repository file, a
package.jsonthat differs only in npm-normalised fields, or a version stamp); for the rest the share of verified files is inresults.json(files.verified/files.total), becauseSOURCE-MATCHdoes not claim the build output. - 2 have provenance but the source could not be compared (
ATTESTED-ONLY), 13 cannot be tied to any commit (UNLINKED), 1 could not be checked at all (no matching source directory). - 17 have files the tool cannot explain from the source (
needs-review, 105 files in total). Each one was checked a second time with a fresh download and agit fetchof the commit; one package's findings (40 files) disappeared that way: git holds the same bytes and the source archive had left them out (export-ignore), so they are not counted. A first version of this second look also dismissed a package wrongly, because a published file over 2 MiB was compared as if it were empty; that is fixed and the package is counted. The remaining differences reproduce byte for byte; they are things like a placeholder replaced by a key at build time, a README written by the release job, or generated data files. Needs review means "a human should look", not "something is wrong". Named results are inbench/results.json, as byte-level facts with the command that reproduces them; this README names only good news. An independent review of the first run found 51 of 155 flagged files that were the tool's own mistakes (wrong directory in a monorepo, copied files, unusual output directories, packages published fromdist/, version stamps). A second review found the fixes had been too generous in places (a copy rule that accepted code swapped for another file's bytes, adist/rule that accepted anybin, a 2 MiB hashing gap). All are fixed, each with a negative test, and the numbers above are from the rerun (DECISIONS.md D10). - Rebuilt, 12 of 30 (the 30 highest-ranked
SOURCE-MATCHpackages): the sandboxed rebuild reproduced the published files byte for byte for 12, differs for 2 (files that differ or are missing in the rebuild output), could not run for 14 (pnpm, yarn or no lockfile: unsupported), failed to build for 2. The ones that did:@modelcontextprotocol/server-filesystem,server-everything,server-memory,server-sequential-thinking,@hostinger/mcp,@perplexity-ai/mcp-server,@ui5/mcp-server,@cap-js/mcp-server,@zereight/mcp-gitlab,@brave/brave-search-mcp-server,repomix,dembrandt.
Limits of this table: download counts exist for 9,574 of the 19,751 npm packages (all unscoped ones, and the scoped ones the npm search endpoint or a time-boxed direct lookup returned). The other 10,177 are mostly scoped long-tail packages; a random sample of 106 of them had at most 427 downloads a week (the 100th ranked package has 8,381), so we do not expect them to change the top 100, but they were not exhaustively counted. Versions checked are the ones the registry entries declare.
$ npx github:KemalG-u/mcp-sourcecheck check @modelcontextprotocol/server-filesystem@2.4.1 --rebuild
REBUILT @modelcontextprotocol/server-filesystem@2.4.1
2 of 14 files are byte-identical to https://github.com/modelcontextprotocol/servers/src/filesystem at b502fd9fc7 (attestation); 12 are build output or bundled dependencies that only --rebuild can verify
rebuilt from the commit in a sandbox: every published file is byte-identical to the rebuilt package
repository : https://github.com/modelcontextprotocol/servers/src/filesystem (directory detected)
provenance : present, subject digest matches the tarball; signature not verified here
commit : b502fd9fc711 via attestation
files : 14 in tarball: 2 identical, 0 explained copies/normalised, 12 build output or bundled (unverified), 0 flagged
rebuild : identical
note: attestation subject digest matches the tarball; the Sigstore signature is NOT verified here (run `npm audit signatures`)Verdicts, strongest first:
| Verdict | Meaning |
|---|---|
REBUILT |
Rebuilt from the linked commit in a sandbox (--rebuild); every published file is byte-identical. |
SOURCE-MATCH |
A commit is linked and every tarball file is identical to it, except build output, which is counted and reported but not verified. |
ATTESTED-ONLY |
npm provenance exists and matches the tarball, but the source could not be compared. |
UNLINKED |
Nothing ties this version to a commit. |
MISMATCH |
Files differ from the linked source (or the attestation contradicts the tarball). Always marked needs-review: a byte-level fact, never a claim about intent. |
flowchart LR
A[package@version] --> P1[P1 repository field -> GitHub repo]
A --> T[published tarball + SHA-512]
T --> P2[P2 provenance subject digest == tarball?<br/>source repo == repository field?]
P2 --> P3[P3 commit: attestation, else gitHead, else unambiguous tag]
P1 --> P3
P3 --> P4[P4 every tarball file vs the commit<br/>monorepo: repository.directory]
P4 --> V{verdict}
P4 -. --rebuild, Linux + bubblewrap .-> P5[P5 npm ci --ignore-scripts, build offline, npm pack, compare]
P5 --> V
| Step | What it does | What it does not do |
|---|---|---|
| P1 | Resolves the repository field (GitHub) |
Other hosts: reported, not compared |
| P2 | Reads the SLSA statement; checks subject digest and source repository | Does not verify the Sigstore signature: run npm audit signatures for that |
| P3 | Picks the commit from provenance, gitHead or a tag, in that order |
Ambiguous tags are not guessed |
| P4 | Byte-compares every file; explains CRLF, copied LICENSE, npm-normalised package.json, build output |
Build output is not verified without P5 |
| P5 | Opt-in rebuild inside bubblewrap, network off for the build | pnpm/yarn/no lockfile: reported unsupported |
mcp-sourcecheck scan [--home DIR] [--config FILE] # find servers in client configs, flag floating `npx -y pkg`, check each
mcp-sourcecheck lock pkg@1.2.3 | --from-scan # write mcp-sourcecheck.lock (version, integrity, source commit)
mcp-sourcecheck verify [--deep] # CI: exit 1 when integrity, commit, attestation or verdict drifted
mcp-sourcecheck check pkg --confirm # re-verify a MISMATCH with a fresh download + git fetch
mcp-sourcecheck setup [--claude-skill] [--write] # AGENTS.md block / Claude skill so your agent checks before it adds a server
mcp-sourcecheck doctor # environment check, including what --rebuild needsEvery command takes --json. Exit codes: 0 ok, 1 findings (MISMATCH, lock drift), 2 error.
Pin your MCP servers once, then let CI fail when one drifts:
npx github:KemalG-u/mcp-sourcecheck lock --from-scan --config .mcp.json # writes mcp-sourcecheck.lock; commit it# .github/workflows/mcp-sourcecheck.yml
name: MCP servers match their source
on: [pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
sourcecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: KemalG-u/mcp-sourcecheck@main # use a full commit SHA you have reviewed
with:
lock: mcp-sourcecheck.lock # default
config: .mcp.json # optional: npx servers must be pinned and in the lock; github:/URL/path ones fail
deep: "false" # "true": re-run the full source comparison per entryThe Action runs mcp-sourcecheck verify from its own checked-out ref (no npm install) and fails the job on drift, or when the lock file has no entries. With config, the job also fails when a config file is
unreadable, has an unknown shape or lists no servers, when an npx server is not pinned or not in the lock, and when an
npx entry cannot be pinned at all (github:, git or tarball URL, local path); remote, PyPI and Docker servers are only
reported as not covered. The step exposes the CLI exit code as the exit-code output (1 = drift, 2 = error). A full
example with SHA-pinned actions is in examples/workflow.yml, with a sample config and its
lock file next to it.
npx github:KemalG-u/mcp-sourcecheck setup --write # appends the block to AGENTS.md
npx github:KemalG-u/mcp-sourcecheck setup --claude-skill --writeor paste: "Before adding or updating an MCP server from npm, run npx github:KemalG-u/mcp-sourcecheck check <package>@<exact version>. Proceed on REBUILT or SOURCE-MATCH; ask me on ATTESTED-ONLY or UNLINKED; stop and show me the file list on MISMATCH. Never put an unpinned npx -y <package> in a persistent config."
- PyPI, Docker/OCI and other registries. npm only in v0.1.
- Remote (HTTP/SSE) servers. There is no package to compare; the operator's server is whatever it is.
scanlists them as remote and says so. - Malware or vulnerability scanning, tool-description auditing. Different problem; see Related work.
- Verify signatures. It checks that the attestation talks about this tarball and this repository.
npm audit signaturesverifies the signature. - Prove a rebuild is trustworthy.
REBUILTsays the published bytes equal what the linked commit builds, with its lockfile, in that sandbox. It does not say the commit is good. - Verify build output without
--rebuild.SOURCE-MATCHreports how many files were covered (for example 2 of 14); the rest are build output. - Work on pnpm/yarn repositories for
--rebuild, or on hosts other than GitHub.
Where it lost in the bench is listed in bench/results.json: packages it could not check are rows, not omissions.
--rebuild is the only mode that executes third-party code (the package's own build script). It refuses to run without
bubblewrap, runs npm ci --ignore-scripts with the network, then the build and npm pack with the network removed, a
read-only root, a hidden home directory and a scrubbed environment. Use a VM, container or WSL distribution you can
throw away. See DECISIONS.md D7.
agent-scan, a scanner from the security company Snyk (github.com/snyk/agent-scan), scans MCP servers and agent skills for malicious content and tool poisoning. It does not tie a package to its source commit or pin versions.- mcp-drift, mcp-lock and similar small tools pin or hash MCP tool definitions to detect change after you approved a server. They do not ask whether the code you approved matches the repository.
npm audit signaturesandgh attestation verifyverify signatures and provenance. This tool starts where they stop: it compares the files.- reproducible-builds style tools rebuild everything;
--rebuilddoes the same for npm, narrowly.
Corrections welcome: if a row of this table is wrong or a project is missing, open an issue.
bench/REPRODUCE.md. npm test runs offline against recorded registry responses plus a recorded real
package (@modelcontextprotocol/server-filesystem@2.4.1).
MIT. See DECISIONS.md for the design decisions.
Contributing: CONTRIBUTING.md. Reporting a vulnerability: SECURITY.md.
AI assistance: this project was prepared with Claude Code agents.