mcp-audit
CLAUDE.md8 starsChanged 11 days agoApache-2.0View on GitHub
An open-source, privacy-first CLI tool that scans MCP (Model Context Protocol) server configurations for security vulnerabilities. Think "Snyk for MCP servers." The product is Credenzo and the command is credenzo. Use those in every text a person reads: help text, reports, messages, documentation, examples. These keep the old name on purpose. Do not rename them without a migration: - The mcp-audit command (same entry point; _entry._old_name_notice prints one stderr line in a terminal, never in CI, a pipe, or run).…
- Reads credentials
- Installs packages
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- adudley78/credenzoword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- adudley78/credenzo★ 8100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repositoryOne other file it gives its agents.
- verifySkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 5 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 62
Do not put a licence check in the package.
- Very specific: line 379
Every module has a corresponding test file in tests/ (e.g., test_discovery.py)
- Very specific: line 381
All findings use the Finding Pydantic model from models.py
- Very specific: line 463
Governance policy resolution order: when --policy is not given: explicit flag → cwd → git repo root → …
- Very specific: line 585
Never construct a shell command as a string and pass it to subprocess.run().
- Very specific: line 589
Use os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600) for sensitive writes.
- Very specific: line 593
No bare
except:clauses: Use except Exception: at minimum, or a more specific type. - Very specific: line 605
Dev extras required: Run uv sync --extra dev before running tests for the first time, or after a fresh clone.
- Very specific: line 611
Run uv run pytest after every change
- Very specific: line 612
Run uv run ruff check src/ tests/ before committing
- Very specific: line 613
Run uv run bandit -r src/ -ll -f txt periodically (we're a security tool — act like it)
- Very specific: line 619
Bandit: must report no medium or higher issue.
- Distinctive: line 627
If a task involves designing a new module interface, changing how analyzers interact with each other, restructuring data models, or you …
- Distinctive: line 631
Do not attempt to resolve architectural ambiguity by guessing.
- Distinctive: line 648
All detection patterns are original implementations based on published security research.
- Distinctive: line 651
Every new pattern must cite its research source.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Credenzo (formerly mcp-audit)
An open-source, privacy-first CLI tool that scans MCP (Model Context Protocol) server configurations for security vulnerabilities. Think "Snyk for MCP servers."
Names (0.33.0 rename)
The product is Credenzo and the command is credenzo. Use those in every
text a person reads: help text, reports, messages, documentation, examples.
These keep the old name on purpose. Do not rename them without a migration:
- The
mcp-auditcommand (same entry point;_entry._old_name_noticeprints one stderr line in a terminal, never in CI, a pipe, orrun). - The distribution that holds the code,
mcp-audit-scanner. Thecredenzodistribution (packaging/credenzo/) holds no code: it pins the same version, forwards the extras and declares thecredenzocommand (tests/test_credenzo_package.py). Publish it withpublish-credenzo-name.ymlafter each release. - The import package
mcp_audit, the release binary names (mcp-audit-<os>-<arch>), the spec files. - The repository is
adudley78/credenzo(renamed 2026-11-16; GitHub redirects the old name). URLs use the new name.setup-actionaccepts a binary signed under either name. Never create a repository namedmcp-audit: that ends the redirects. - Machine contracts: exact
"mcp-audit"literals (platformdirs directory, SARIF tool name, CycloneDX/OpenVEX/Nucleus tool names,_producer), lockgenerated_by,mcp-audit/…andmcp-audit:property keys, the code-scanning category,.mcp-audit-policy.yml,mcp-audit-feed.pub, themcp-audit.devAPI host,MCP_AUDIT_*environment variables. - A wrapped config entry may launch
mcp-audit run(written before 0.33.0) orcredenzo run;runtime/wrapping._WRAPPER_NAMEaccepts both. - Pre-commit hook ids
mcp-auditandmcp-audit-lock-verifystay besidecredenzoandcredenzo-lock-verify; the setup action puts both command names on PATH and keeps themcp-audit-versionoutput.
What this project does
Developers use MCP servers to give AI agents (Claude, Cursor, VS Code Copilot) access to tools — file systems, databases, APIs, etc. These servers are configured via JSON files and can be poisoned, misconfigured, or compromised. Credenzo scans those configs and flags security issues.
Business model
The credenzo command is fully open source under Apache 2.0 — every command and
every check is free for every user. There is no Community / Pro / Enterprise
split and no license-key gate in the package. All paid-license plumbing (Ed25519
signing, revocation lists, activate / license commands, the gate() shim)
was removed in v0.2.0; anything that still references licensing.py or
_gate.py is stale.
There is one paid offer, beside the package and not in it: Credenzo Team
(team/, docs/team.md, added 2026-11-20). It is a GitHub Action that runs
credenzo lock --verify and sends drift alerts (an issue, a webhook message).
The check itself is the free command and always runs. Alerts are free for
personal accounts and public repositories, and $99 a month (up to 10 seats) for
the private repositories of an organization. Rules that keep it honest:
team/is never imported bysrc/mcp_auditand never ships in the wheel or the binary (tests/test_team_action.py::test_the_team_code_is_not_in_the_package). Do not put a licence check in the package.team/credenzo_team.pyandscripts/team_licenses.pyuse the standard library only. The action sends nothing to the project (no usage report);docs/telemetry.mdstill holds.- A subscription is found by GitHub owner name in the public licence list on
the
team-licensesbranch, which.github/workflows/team-licenses.ymlbuilds from Stripe twice an hour. The list holds digests and fillers, never a name, an email address or a Stripe ID; neither job prints one, or a count. The length of the list shows no count, but someone who keeps copies of it can count the entries that are new. When the list cannot be read, alerts stay on. - The offer (price, checkout link, the date the experiment started) is
team/offer.json;scripts/team_go_live.pywrites it and the "Subscribe" block ofdocs/team.md.scripts/paid_path_report.pyprints the weekly public numbers and applies the continue/stop rule that was set before the experiment (10 customers or $1k MRR to continue; after 90 days, fewer than 3 customers or less than $300 MRR to stop, which at $99 means that 4 customers pass the stop line).
Funding is also requested via GitHub Sponsors (handle configured in
.github/FUNDING.yml, with a "Support" section in README.md).
Tech stack
- Python 3.11+, managed with
uv - CLI: Typer + Rich
- Data models: Pydantic v2
- Testing: pytest + pytest-asyncio
- Linting: Ruff + Bandit
- Packaging: hatchling via pyproject.toml
Project layout
One line per module. The detail for each one (finding IDs, pipeline step,
budgets, the tests that pin it) is in docs/module-map.md: read its entry,
and the module docstring, before you change a module.
src/mcp_audit/
├── cli/ # Typer app; one submodule per command group
│ ├── __init__.py # `app` and sub-apps; re-exports the names tests patch
│ ├── __main__.py # `python -m mcp_audit.cli` (PyInstaller target)
│ ├── _helpers.py # `_write_output`
│ ├── scan.py # scan, discover, pin, watch (`_apply_*` stages, `_write_*` output)
│ ├── check.py # check: one-page verdict
│ ├── fix.py # fix: safe remediations
│ ├── wrap.py # wrap / unwrap: launch local servers through `credenzo run`
│ ├── run.py # `run` in --help; `_entry.py` dispatches it to runtime/
│ ├── guard.py # `guard` in --help; `_entry.py` dispatches it to runtime/guard.py
│ ├── diff.py # diff: MCP-aware diff for PR review and CI gates
│ ├── baseline.py # baseline: save / list / compare / delete / export
│ ├── registry.py # update-registry, verify
│ ├── rules.py # rule: validate / test / list
│ ├── policy.py # policy: validate / init / check
│ ├── extensions.py # extensions: discover / scan
│ ├── agent_files.py # agent-files: discover / scan
│ ├── plugins.py # plugins: discover / scan
│ ├── lock.py # lock: write, --verify, --accept mcp-lock.json
│ ├── _bundle.py # --bundle / --bundle-key for scan and affected
│ ├── sast.py # sast
│ ├── sbom.py # sbom: CycloneDX 1.5
│ ├── affected.py # affected: is this advisory in a discovered server?
│ ├── reach.py # reach: what can the agents on this machine touch?
│ ├── vet.py # vet: pre-install package verdict
│ ├── shadow.py # shadow: shadow MCP server sweep
│ ├── killchain.py # killchain: top blast-radius-cutting changes
│ ├── snapshot.py # snapshot: signed forensic snapshots
│ ├── dashboard.py # dashboard
│ ├── fleet.py # merge: fleet report from scan JSON files
│ ├── push_nucleus.py # push-nucleus: scan and upload to Nucleus
│ ├── register.py # register: opt-in registration
│ ├── advise.py # advise and `feed verify`
│ └── version.py # version
├── scanner.py # Orchestrator: discovery → parsing → `_run_static_pipeline` → score
├── scoring.py # Score 0–100 and grade A–F (docs/scoring.md)
├── discovery.py # Finds MCP config files across all supported clients
├── config_parser.py # Parses JSON configs, normalizes across client formats
├── models.py # Pydantic models: Finding, ServerConfig, ScanResult, ScanScore, …
├── owasp_mcp.py # Single source of truth for OWASP MCP Top 10 codes/names
├── verdict.py # Pure verdict builder for `vet`
├── watcher.py # `watch` filesystem watcher
├── mcp_client.py # Live MCP connection for --connect
├── _paths.py # Find bundled data in source, wheel and frozen builds
├── _network.py # --offline mutual exclusion for network flags
├── _entry.py # Console script; dispatches `run` and `guard` before Typer loads
├── _brand.py # Repo/site URLs and the Markdown footer for shared reports
├── _star.py # One-time star note after the first terminal `scan`/`check`; no network
├── _jcs.py # RFC 8785 canonical JSON, stdlib only (used by `run`)
├── runtime/ # `credenzo run` and `guard`: stdlib only on the launch path (docs/run.md)
│ ├── cli.py # argparse for `run`; exit 78 when enforce refuses
│ ├── relay.py # Byte-exact stdio relay; enforce mode goes line by line
│ ├── gate.py # Launch gate: argv vs the lock entry
│ ├── wrapping.py # Wrap and unwrap entries; when a wrapper is trusted
│ ├── guard.py # `credenzo guard`: Claude Code PreToolUse hook
│ └── tools.py # ToolGuard: live tools/list vs the lock's tool digests
├── _redact.py # Local-path redaction for output that leaves the host
├── bundle.py # Signed air-gapped data bundle
├── gateways.py # MCP gateway upstreams (mcptoon, 1MCP, MCPHub)
├── keys/ # Feed public key (mcp-audit-feed.pub)
├── _gitobjects.py # Read-only git object store (never runs git)
├── _gitignore.py # gitignore matcher (never runs git)
├── host_platform.py # windows / wsl / macos / linux
├── harness_versions.py # Installed agent harness versions, read from files
├── guardrails.py # GUARD-001/002: guardrail drift
├── policy_sources.py # Read-only OS policy readers (plist, registry)
├── affected/ # `affected` engine: query, match, render
│ ├── transitive.py # `affected --transitive`
│ ├── fleet.py # `affected --fleet`
│ ├── vex.py # OpenVEX 0.2.0 writer
│ ├── fixplan.py # `affected --fix`
│ └── respond.py # Respond block and --policy-out
├── exploit/ # KEV / EPSS / public-PoC signals
├── analyzers/ # Detection
│ ├── base.py # BaseAnalyzer abstract class
│ ├── poisoning.py # Tool description poisoning detection
│ ├── credentials.py # Secret/API key exposure in configs
│ ├── transport.py # Transport security
│ ├── supply_chain.py # Package provenance and typosquatting detection
│ ├── hook_runnable.py # HOOK-004/005: hook commands that cannot start
│ ├── config_hygiene.py # CFHYG, HARNESS, HOOK-001/002, TRUST-003/008, PERM-001..006
│ ├── rug_pull.py # Config-entry change detection via hashing
│ ├── toxic_flow.py # TOXIC-*, INTEG-001: dangerous capability pairs
│ ├── auth.py # Remote server authentication checks
│ ├── collision.py # COLLIDE-001..003: tool name and description copies (--connect)
│ ├── annotations.py # ANNOT-001: readOnlyHint on a tool that writes
│ ├── delegation.py # DELEG-001..003: cross-tool delegation (--connect)
│ ├── git_exec.py # TRUST-006/007: git config that can run code
│ ├── permissions.py # PERM-001..007: Claude Code permission rules
│ ├── sandbox.py # SANDBOX-001..005: sandbox settings a repository loosens
│ ├── rule_secrets.py # CRED-004: credentials in permission rules
│ ├── rule_secret_history.py # CRED-005: CRED-004 over git history
│ ├── shipped_settings.py # CRED-006: settings an image or npm package ships
│ ├── managed_policy.py # MANAGED-001..007: managed MCP policy vs servers
│ ├── secret_reach.py # REACH-001..003: credential files readable without a prompt
│ ├── npx_cache.py # SC-011: known-malicious packages in the npx cache
│ └── attack_paths.py # Attack paths and the greedy hitting set
├── reach/ # `reach` engine (pure, no subprocess)
│ ├── engine.py # build_machine_reach(): one verdict per agent
│ ├── claude.py # Claude Code's answers
│ ├── codex.py # Codex answers from config.toml
│ ├── surface.py # Allowlists; anything off them is COULDN'T CHECK
│ ├── network.py # Does a server reach the network?
│ ├── common.py # Shared assessment helpers
│ ├── context.py # Paths and capped reads
│ ├── models.py # Dataclasses; `sanitize()` is the one choke point
│ └── fleet.py # `reach --fleet DIR`
├── agent_files/ # Instruction, memory and skill files (SKILL-*, MEM-*)
│ ├── models.py # AgentFile and surfaces
│ ├── discovery.py # discover_agent_files()
│ ├── imports.py # Claude Code @path imports and "read X" references
│ ├── gitignore.py # .gitignore matcher read by file
│ ├── heartbeat.py # MEM-004 detector
│ ├── sleeper.py # MEM-005 detector
│ ├── exfil.py # MEM-006 detector
│ ├── instruction_shapes.py # MEM-007/008 detectors
│ ├── drift.py # INSTR-001/002: instruction file drift
│ ├── reach.py # MEM-003..005 in the default scan and --project
│ ├── framing.py # Describes-vs-directs gate for SKILL-001
│ ├── analyzer.py # analyze_agent_files()
│ ├── skill_package.py # SKILL-005..008: every file in a skill folder
│ ├── install_steps.py # Pure text checks for skill install steps
│ └── subagents.py # AGENT-001..004: subagent definitions
├── plugins/ # Claude Code plugins (PLUGIN-*, MOD-*)
│ ├── models.py # InstalledPlugin dataclass
│ ├── discovery.py # Installed plugins and their MCP servers
│ ├── analyzer.py # PLUGIN-001/002
│ ├── checkout.py # PLUGIN-003/004: pin vs checked-out commit
│ └── mods.py # MOD-001..006: Claude Code mods
├── ci_workflows/ # WORKFLOW-001..003: Actions workflows that run an agent
│ ├── discovery.py # Find workflow files (bounded)
│ └── analyzer.py # Analyze them
├── lock/ # mcp-lock.json (ADR-0005, docs/lock.md)
│ ├── model.py # Ownership boundary and top-level checksum
│ ├── writer.py # regenerate()/write_lock()
│ ├── verifier.py # lock --verify: LOCK-001..014
│ ├── section_digests.py # lock_version 2 section digests
│ ├── guardrail_section.py # `guardrails` section (LOCK-014)
│ ├── tool_digests.py # `tools` section: per-tool digests
│ ├── calendar_text.py # Dates that move with the calendar (stdlib only)
│ ├── tool_text.py # saved tool text `mcp-lock.tools.json`
│ ├── core.py # Stdlib-only primitives shared with `run`
│ └── identity.py, resolve.py, discovery.py, auto_verify.py
├── advisory/ # OSV 1.6.0 records and the signed feed (see invariants below)
│ ├── schema.py # Advisory dataclass → OSV 1.6.0 JSON
│ ├── classify.py # finding ID → finding_class / observation / CVSS 3.1 vector
│ ├── canonical.py # RFC 8785 JCS canonicalization
│ ├── freshness.py # snapshot_version / published_at / expires on index.json only
│ ├── feed.py # build_advisory / write_feed
│ ├── sign.py # cosign and minisign backends; sign_feed / verify_feed
│ ├── validate.py # validate_osv() against the vendored schema
│ └── osv_schema/ # Vendored osv-1.6.0.json
├── attestation/ # --verify-hashes and Sigstore checks
│ ├── hasher.py # Layer 1: tarball SHA-256
│ ├── verifier.py # verify_server_hashes()
│ ├── sigstore_client.py # Layer 2: Sigstore bundles from npm and PyPI
│ └── sigstore_findings.py # Layer 2 results → findings
├── baselines/
│ └── manager.py # BaselineManager, Baseline, BaselineServer, DriftFinding, DriftType
├── registry/
│ ├── loader.py # KnownServerRegistry, RegistryEntry, load_registry()
│ ├── twins.py # SC-007 unscoped twins
│ ├── malicious.py # load_known_malicious(), assess()
│ ├── research.py # load_research_records(), research_id()
│ └── reachability.py # Transport tags on known CVEs
├── rules/
│ └── engine.py # Policy-as-code rule engine
├── governance/
│ ├── models.py # Governance policy models
│ ├── loader.py # load_policy() resolution order
│ └── evaluator.py # evaluate_governance()
├── vulnerability/ # `scan --check-vulns` (network, opt-in)
│ ├── models.py # ResolvedPackage, VulnAdvisory data models
│ ├── resolver.py # Package and version from a launch line
│ ├── depsdev.py # fetch_dependency_graph() → DependencyGraph
│ ├── osv.py # OSV.dev queries
│ └── scanner.py # check_vulnerabilities()
├── diff/ # MCP-aware diff engine
│ ├── loader.py # Load diff inputs (directory, scan JSON, git SHA)
│ ├── comparator.py # Compare two ServerConfig lists → flat list of Change objects
│ ├── risk.py # Risk classification for diff changes
│ └── render.py # Render diff to terminal, JSON, and PR-comment Markdown
├── fixer/ # `fix` engine: backup, then atomic write
│ ├── fixer.py # Orchestrator
│ └── strategies/
│ ├── base.py # FixStrategy abstract base
│ ├── credentials.py # CRED-001..003
│ ├── transport.py # TRANSPORT-001
│ └── pinning.py # SC-001/002
├── killchain/ # Decision engine over the attack-path graph
│ ├── recommender.py # Rank kill switches
│ ├── simulator.py # What-if simulation
│ ├── patches.py # Generate governance-policy denylist / PR-comment patch snippets
│ └── render.py # Markdown and JSON output
├── shadow/ # Shadow MCP server detection
│ ├── allowlist.py # Operator allowlist of sanctioned servers
│ ├── classifier.py # Pure sanctioned-vs-shadow classification given server + allowlist
│ ├── risk.py # RiskLevel scoring for a single server
│ ├── events.py # Structured events for --continuous daemon mode
│ └── state.py # first_seen / last_seen state (0o600)
├── snapshot/ # Forensic snapshot rehydrate/diff
│ ├── rehydrate.py # Rebuild the attack-path graph of a snapshot
│ └── diff.py # "What changed since the snapshot?"
├── output/ # Formatters (BaseFormatter)
│ ├── base.py # BaseFormatter abstract class
│ ├── terminal.py # Rich-formatted console output
│ ├── sarif.py # SARIF for GitHub Security integration
│ ├── nucleus.py # Nucleus FlexConnect formatter
│ ├── dashboard.py # Self-contained HTML dashboard (one template string)
│ ├── check.py # `check` verdict
│ ├── advisory.py # OSV records for `scan --format advisory`
│ ├── cyclonedx.py # CycloneDX SBOM formatter
│ ├── snapshot.py # Snapshot formatters: CycloneDX AI/ML-BOM and native JSON
│ ├── pdf.py # PDF compliance report
│ ├── reach.py # Terminal output for `reach`
│ └── reach_pdf.py # `reach --report pdf`
├── extensions/
│ ├── models.py # Extension models
│ ├── discovery.py # discover_extensions(), parse_manifest()
│ ├── policy.py # EXTPOL-001..003: editor extension allowlists
│ └── analyzer.py # analyze_extensions()
├── registration/
│ ├── models.py # Registration payload models
│ ├── manager.py # Load, save, clear (0o600)
│ └── client.py # post_registration() / post_ping()
├── sast/
│ ├── runner.py # Run semgrep and map its output
│ └── bundler.py # Bundled rule path in frozen builds
├── fleet/
│ └── merger.py # Fleet merge and HTML
└── data/
├── known_npm_packages.yaml # Legacy npm package list
├── exploit-signals.json # KEV / EPSS / public-PoC snapshot
├── research-records.json # Credited research records with no CVE
├── header_dark.png # Header image for the PDF report
└── d3.v7.min.js # Bundled D3 v7Standalone rule pack at repo root:
semgrep-rules/— 91 Semgrep rules (47 Python, 44 TypeScript) across 6 categories; runnable withsemgrep --config semgrep-rules/ <path>without Credenzo installed; bundled in the pip wheel and PyInstaller binary; seedocs/sast-rules.md
Data files at project root:
registry/known-servers.json— curated dataset of 56 known-legitimate MCP servers; queried by the supply chain analyzer for typosquatting detection and by the toxic flow analyzer for authoritative capability tags (RegistryEntry.capabilities); ships in both the pip wheel and PyInstaller binaryregistry/known-malicious.json— mirror of OSVMAL-*records for npm/PyPI packages whose name containsmcpor that the registry lists (STORY-0097); written only byscripts/sync_registry_advisories.py --write(bulk export; a mirror, so withdrawn records are removed); matched offline by exact name for SC-008 andvet; ships in the wheel and all four specs;update-registrydoes not refresh it. Kept out ofknown-servers.jsonso the registry schema is unchangedrules/community/— 42 bundled community rules total: 41 real detection rules (COMM-001throughCOMM-039;COMM-032is intentionally reserved/unissued — seePROVENANCE.md) plusSTDIO-001/STDIO-002a/STDIO-002b(launch-command trust boundary, STORY-0067;STDIO-001shipsenabled: false— seeGAPS.md) plusTEMPLATE.ymlitself, which loads as the always-inertCOMM-000(contribution template —tests/test_rules.pyguarantees it never fires on a real config);BOUNTY.md(bounty program terms) ships alongside but is not a rule file. All ship in both pip wheel and PyInstaller binary and are available to every user with no gating — but "available to" is not "runs for": 40 of the 41 real rules run by default, andSTDIO-001does not run for anyone (enabled: false, no governance-policy toggle exists to turn it on — seeGAPS.md); seedocs/writing-rules.mdanddocs/contributing-rules.md
GitHub Action at project root:
action.yml— composite GitHub Action definition; allows any repo to wire Credenzo into CI with a single workflow addition; inputs:config-paths,severity-threshold,sarif-output,upload-sarif,check-vulns,verify-signatures,run-sast,sast-path,baseline-name,fail-on-findings,version; outputs:findings-count,grade,sarif-path. Usesgithub/codeql-action/upload-sarif(v4, pinned to a commit SHA like every third-partyuses:ref inaction.yml,setup-action/and.github/—tests/test_action_yaml.py::test_every_third_party_action_ref_is_sha_pinned) withcontinue-on-error: trueso repos without Code Scanning enabled still run cleanly. Marketplace-ready — passestests/test_action_yaml.pystructural and safety checks.
Credenzo Team action (team/, the one paid offer; docs/team.md):
team/action.yml+team/credenzo_team.py— composite action, one step, standard library only. Runscredenzo lock --verify --if-present --format json(the command must already be on PATH; stopped afterVERIFY_TIMEOUT_SECONDS) and returns its exit code: everything after the check runs in_alerts()under oneexcept Exception, so a fault in an alert never changes the result. On a push, a schedule or a manual run (ALERT_EVENTS) on the default branch it keeps one issue for each check ("MCP lock drift";Scope= workflow, job, path, connect, resolve; the marker in the body holds the scope key and a fingerprint of the findings, so the same drift is reported once and a passing check does not close the issue of another check) and POSTs{"text": ...}toalert-webhook.GitHub.open_drift_issuereads an issue as its own only when its author is the token's account (GET /user, elsegithub-actions[bot]), or a bot account and the issue has the label: a stranger cannot plant an issue with the marker. No redirect is followed (_NoRedirect). An alert holds finding IDs, severities, cleaned server/tool names (clean_name) and "not verified" names, never a finding's own text or a reason.decide()is the whole pricing rule: personal account or public repository = alerts; else the licence list (read_offer): not readable or not live = alerts, owner digest in the list = alerts, otherwise the check runs and one notice is printed in a run where an alert was held back.MEANINGSmust hold every LOCK ID the lock package reports (a test reads the source).team/offer.json— price, seats,live_since, checkout link, payment link ID. Written byscripts/team_go_live.py.scripts/team_licenses.py+.github/workflows/team-licenses.yml— Stripe (restricted read key,team-licensesenvironment) toindex.jsonon theteam-licensesbranch:offerplusowners, SHA-256 digests padded with HMAC fillers to a multiple of 64. A failed Stripe request writes nothing. Thepublishjob replaces the branch with one parentless commit.scripts/paid_path_report.py— weekly public numbers (gh+ pypistats) anddecide()for the experiment; the paid numbers are arguments, never read or stored.
Pre-commit hook at project root:
.pre-commit-hooks.yaml— pre-commit hook definition;language: python,entry: credenzo(the old idsmcp-auditandmcp-audit-lock-verifystay, withentry: mcp-audit),pass_filenames: false(Credenzo uses its own discovery),types: [json](fires only on staged JSON files),always_run: false; default args runscan --severity-threshold high; seedocs/pre-commit.md
CI workflow and example workflows:
.github/workflows/mcp-audit-example.yml— runs Credenzo on this repo on push/PR; also the reference workflow users copyexamples/github-actions/basic.yml— minimal setup (visibility only, never fails build)examples/github-actions/strict.yml— fail on MEDIUM or higherexamples/github-actions/with-baseline.yml— drift detection against a committed baselineexamples/github-actions/team-drift-alerts.yml— Credenzo Team: lock check on pull requests, pushes and a daily run, with the drift alertexamples/pre-commit/basic.yaml— minimal pre-commit config (blocks on HIGH+)examples/pre-commit/strict.yaml— strict pre-commit config (blocks on MEDIUM+)
Build and distribution scripts at project root:
scripts/install.sh— curl-based end-user installer for GitHub Releases
Measurement scripts (dev tooling, not in the package):
scripts/bench_poisoning.py— POISON-* recall and clean-tool flag rate on MCPTox (fetched by hand at release time, never in CI, never committed; any severity and HIGH-or-above) and precision on the top-100 npm corpus (re-measured 2026-10-29 on 0.23.0, Q-045: 1 of 46 real; labels indocs/research/poisoning-benchmark/top100-labels.jsonwithlabelled_patterns_fingerprint,precisionprints STALE once the code differs; the 2026-10-22 0.21.x labels kept astop100-labels-2026-10-22.json) plus a replay of the corpus's committed evidence fragments; pinned indocs/research/poisoning-benchmark/results.json.tests/test_bench_poisoning.pyfingerprints the whole source ofanalyzers/poisoning.pyandmcp_client.build_runtime_server_config: any change to either forces a re-measure (precision --write,recall --write, then update the numbers indocs/poisoning.md,GAPS.mdandREADME.md); seedocs/poisoning.md(STORY-0088). Thedelegationsubcommand (STORY-0100) measures DELEG-001..003 on MCPTox in two session models (poisoned tool on its own server; among the target server's tools), counts flagged clean tools with all 45 servers in one session and each alone, and applies the gate (gate_decision);tests/test_delegation.pyfails ifanalyzers/delegation.pychanges withoutdelegation --write, or ifSHIPPED_SEVERITYdiffers from the recorded decisionscripts/bench_competitors.py— head-to-head benchmark harness (STORY-0146, dev-only, never in CI):corpuswrites/validates the committed corpus (docs/research/head-to-head/corpus/, SHA-256 pinned inmanifest.json),run --mcptox PATH [--tools ...] [--write]runs the installed scanners (SkillSpector static, Cisco mcp-scanner YARA only, Credenzo; Snyk agent-scan is always "not run: needs remote analysis") and pinsdocs/research/head-to-head/results.json,reportprints the table. It never installs a scanner; a missing one is "not run", never zero. MCPTox is generated into a temp dir outside the repo and only its hashes are committed. Competitor output parsers follow public docs and were run against real output on 2026-11-19 (SkillSpector v2.12.0, Cisco mcp-scanner 4.8.7; 1,686 inputs each, no parse error); results inresults.json.tests/test_bench_competitors.py; seedocs/research/head-to-head/README.md
Key conventions
- Every module has a corresponding test file in tests/ (e.g., test_discovery.py)
- Detection patterns are hardcoded in each analyzer (regex constants); supply-chain data is now sourced from
registry/known-servers.jsonviaregistry/loader.py - All findings use the
FindingPydantic model from models.py - Analyzers inherit from
BaseAnalyzerand implement ananalyze()method. Exception:rug_pull.pyandtoxic_flow.pyhave a no-opanalyze()— real work is inanalyze_all()(they need the full server list).attack_paths.pyis not aBaseAnalyzersubclass — it is a standalone module exposingsummarize_attack_paths().collision.pyis also not aBaseAnalyzersubclass — it exposesdetect_tool_collisions(pairs)and is called inrun_scan_async()after the--connectloop, before_run_static_pipeline(). _run_static_pipeline()inscanner.pyis the canonical implementation of the analysis pipeline. Bothrun_scan(sync) andrun_scan_async(async, after live--connectenumeration completes) delegate to it. The helper is intentionally synchronous and runs steps 1–7 in this exact order (after step 0,analyze_configper config file, and step 0b, SANDBOX-001..005sandbox.analyze_sandbox_files, which reads ignore files and the user's settings, checks each settings file in its owntry, and reports read failures and crashes inresult.errors; only when aConfigHygieneAnalyzeris in the list): (1) per-server analyzers, (2)RugPullAnalyzer.analyze_all, (3)ToxicFlowAnalyzer.analyze_allwith the shared registry, (4)summarize_attack_paths, (5) policy-as-code rule engine, (5b) PERM-007 (permissions.analyze_flagged_server_allows:mcp__<server>allow rules on servers with HIGH+ findings, which needs every finding above; only when aConfigHygieneAnalyzeris in the list), (5c) instruction-file drift INSTR-001/002 (agent_files/drift.py, scans with no explicit path, needs every finding above), (5c2) guardrail drift GUARD-001/002 (guardrails.guardrail_drift_findings, STORY-0143: Claude Code/Codex/Gemini CLI settings files, scans with no explicit path, same skip rules as 5c), (5d) exploit signals (apply_exploit_signals: KEV, EPSS and public-PoC data on CVE findings, STORY-0124), (6)calculate_score, (7) attachregistry_stats. Wire new analyzers or pipeline changes here, not in either entry point. Exception:detect_tool_collisions()fromcollision.pyruns inrun_scan_async()inside theif connect:block, immediately after the per-server enumeration loop and before_run_static_pipeline(). It is not part of_run_static_pipeline()because it requires liveServerEnumerationdata that is not available in the static pipeline.detect_tool_name_squats()(COLLIDE-002, STORY-0173) anddetect_description_copies()(COLLIDE-003, STORY-0174) run right after it on the same pairs.detect_delegation()fromdelegation.py(DELEG-001..003, STORY-0100) runs after that in the same block, over the same pairs, for the same reason. So doesdetect_annotation_contradictions()fromannotations.py(ANNOT-001, STORY-0136), after delegation.- Output formatters inherit from
BaseFormatterand implement aformat()method - The dashboard HTML template is a single large string (
_DASHBOARD_HTML) embedded inoutput/dashboard.py. All scan data is injected via a__SCAN_DATA_JSON__placeholder at render time. D3 v7 is bundled fromdata/d3.v7.min.jsand injected via__D3_JS__. Do not split the template into separate files. - Scoring runs after all analyzers complete inside
scanner.pyand attaches aScanScoretoScanResult. Analyzers never call the scorer directly. Seescoring.pyanddocs/scoring.md. - Registry resolution order for the supply chain analyzer: explicit
--registry PATHCLI flag → user-local cache at<user-config-dir>/mcp-audit/registry/known-servers.json(written byupdate-registry; path resolved viaplatformdirs) → PyInstallersys._MEIPASS/registry/→importlib.resources(pip-installed wheel atmcp_audit/registry/known-servers.json) → dev repo-root fallback (registry/known-servers.json). Pass--offline-registryto skip the user-local cache step. All bundled resource resolution (registry, rules, semgrep-rules, extension vulns) goes through the sharedresolve_bundled_resource()helper in_paths.py. - Terminal output includes a dim one-liner registry stats line after the summary (e.g. "Registry: 60 known servers (v1.0, updated 2026-04-20)") pulled from
ScanResult.registry_stats; omitted silently ifregistry_statsisNone. - SARIF output adds a
run.propertiesblock withmcp-audit/grade,mcp-audit/numericScore,mcp-audit/positiveSignals, andmcp-audit/deductionswhenScanResult.scoreis notNone; the block is absent when--no-scoresuppresses scoring. SupplyChainAnalyzeracceptsregistry=KnownServerRegistryorregistry_path=Pathin__init__to allow test injection without touching the filesystem.TransportAnalyzeraccepts an optionalregistry=KnownServerRegistryin__init__to tierTRANSPORT-003severity by registry membership: verified entries suppress the finding, known-but-unverified entries fire at LOW, unknown packages fire at MEDIUM.get_default_analyzers()andcli/scan.py::_build_custom_analyzersshare the sameSupplyChainAnalyzer.registryinstance so the JSON is read from disk exactly once per scan. ConstructingTransportAnalyzer()without a registry preserves the historic "always MEDIUM" behaviour for tests that don't need the registry path.- Every Finding carries an OWASP MCP Top 10 mapping in
Finding.owasp_mcp_top_10(list ofMCP01–MCP10codes; empty list = unmapped). The single source of truth for codes/names issrc/mcp_audit/owasp_mcp.py. SARIF output exposes the mapping via aruns[0].taxonomiesblock and per-rulerelationships. The full per-finding-ID mapping is documented indocs/severity-framework.md. Terminal output shows codes inline;credenzo scan --owasp-reportprints a category-level aggregation. - Community rules always run. The policy-as-code rule engine loads
rules/community/for every scan. Authoring tools (rule validate,rule test) and custom rule directories (--rules-dir,<user-config-dir>/mcp-audit/rules/; path resolved viaplatformdirs) are available to everyone — gating has been removed. The engine is invoked via_run_rules_engine()inscanner.pyafter all built-in analyzers complete. Rule findings useanalyzer="rules"andid=rule.id. - Rule engine resolution order for community rules: PyInstaller
sys._MEIPASS/rules/community/→importlib.resources(installed wheel atmcp_audit/rules/community/) → dev repo-root fallback (rules/community/). - Supply chain attestation (
attestation/) implements Layer 1 hash-based integrity verification.scan --verify-hashesdownloads package tarballs, computes SHA-256, and compares against pins inRegistryEntry.known_hashes.credenzo verifyis a standalone command for interactive package verification. Attestation findings useanalyzer="attestation"; CRITICAL for mismatches, INFO for unverifiable cases. Seedocs/supply-chain.md. scan()pipeline conventions (cli/scan.py): thescancommand is a thin orchestrator that delegates each optional phase to a named helper. Helpers are_apply_*for pipeline stages that mutate/inject intoScanResult(baseline drift, governance, SAST, extensions, agent-files, advisory feed, severity threshold) and_write_*for output-layer dispatch (_write_formatted_output). Preflight validation lives in_preflight_checks. Each helper has a docstring that states when it is called and its contract when the feature is not requested. Future scan-pipeline additions should follow this_apply_*/_write_*naming and be inserted intoscan()as a single-line delegation — do not inline new phases in the command body. Test-patched symbols (verify_server_hashes,discover_extensions,analyze_extensions,run_semgrep) are imported as their containing module (e.g.from mcp_audit.sast import runner as _sast_runner) sopatch("mcp_audit.sast.runner.run_semgrep", ...)continues to intercept.- Capability tags for toxic flow detection are stored in
RegistryEntry.capabilities(optionallist[str]inregistry/known-servers.json) and consulted byanalyzers/toxic_flow.py::tag_server(server, registry=...)before any keyword or tool-name heuristic fallback. Whenregistryis supplied and resolves a known package whosecapabilitiesfield is notNone, those tags are returned verbatim — the registry is the single source of truth. The in-moduleKNOWN_SERVERSdict intoxic_flow.pyis retained as a deterministic fallback for (a) unit tests that inject no registry and (b) cases where the registry is present but the entry hascapabilities=None.scanner.pypasses theSupplyChainAnalyzer.registryinstance toToxicFlowAnalyzer(registry=…)so the JSON file is read from disk exactly once per scan. Rules that follow from this (history and measurements:docs/archive/claude-md-2026-11-16.md):- The registry overrides the heuristics, so an incomplete
capabilitieslist on an entry is worse than no list. Declare every capability. scripts/audit_registry.pyruns four offline checks before its network loop: undeclared capabilities, capability strings that are notCapabilitymembers, dead capabilities (againsttoxic_flow.KNOWN_TAG_ONLY_CAPABILITIES, where every entry needs a reason), and entries whose whole capability set is tag-only.tests/test_audit_registry.pypins all four clean against the shipped registry. Run it withuv run python3: the script refuses to measure anmcp_auditthat is not this repo's.Capability.CLOUDis tag-only on purpose.FILE_WRITE + SHELL_EXECisINTEG-001inINTEGRITY_PAIRS, a separate list fromTOXIC_PAIRS; consumers useTOXIC_AND_INTEGRITY_PAIRS.FILE_WRITE + NETWORK_OUTwas measured twice and declined (GAPS.md, "FILE_WRITE integrity axis").Capability.COMMS_OUTis a wired sink (TOXIC-008..011); its keyword rule matches platform names as whole tokens and skips path arguments. Measurements:docs/severity-framework.md.- The registry-submission issue template has exactly one checkbox per
Capabilitymember (tests/test_registry_submission_template.py).
- The registry overrides the heuristics, so an incomplete
- Agent-file scanning (
agent_files/) covers the non-MCP-config instruction surfaces an agent reads: Claude Code commands/memory, Cursor.mdcrules, and Copilot instruction/prompt files. It is not part of_run_static_pipeline(); the standaloneagent-files discover|scancommands call it directly, andscan --include-agent-fileswires it via_apply_agent_files()incli/scan.py(same_apply_*additive convention as--include-extensions). Findings useanalyzer="agent_files"(SKILL-001/002/003/004, MEM-001/002) — except POISON-041/042 (concealment channels, STORY-0068), which this module also emits but which always carryanalyzer="poisoning", matching the config surface, because the shared builderbuild_concealment_finding()lives in and is owned byanalyzers/poisoning.py(see that module's docstring andagent_files/analyzer.py's own "documented exception" note). Detection patterns are imported fromanalyzers/poisoning.py— never forked. MEM-003/MEM-004 (STORY-0098: imports from outside the folder or of a.gitignore'd file; heartbeat output suppression) also run in a defaultscan/check(cwd-root instruction files, skipped when cwd is$HOME, plus~/.openclaw/workspace/HEARTBEAT.md) and inscan --project, throughagent_files/reach.py; findings are deduplicated across the three paths (reach.finding_key) and only a symlink leaving the folder (TRUST-002 HIGH) is reported on the first two.tests/conftest.pystubs the user heartbeat lookup. HOOK-001/002 (network-egress and config-write hook commands) deliberately live inanalyzers/config_hygiene.py::analyze_config(pipeline step 0), not inagent_files/, because they inspect the parsedhookssection of a Claude config file; they are distinct IDs from CFHYG-005 (which fires on mere presence of ahookssection) and the conditions do not overlap. Subagent definitions (.claude/agents/**/*.md, STORY-0094) are the exception to "not part of the pipeline": their frontmatter is a config surface, so the files areDiscoveredConfigs (clientclaude-code-agent),parse_config()reads their inlinemcpServers, and AGENT-001..004 + HOOK-001/002 run at step 0 in the defaultscan/checkandscan --project(discover_project_agent_configs, kept out ofdiscover_project_configssolocknever sees them). Only their body text follows the skills opt-in (--include-agent-files, which passesinclude_definitions=False).
Critical implementation details
- VS Code uses
"servers"as its MCP config root key; all other clients use"mcpServers" - MCP protocol communication is async — use asyncio and pytest-asyncio
- Core scanning MUST work fully offline — no network calls by default
- OSV.dev lookups are implemented via
scan --check-vulns(deps.dev transitive graph + OSV.dev CVE batch query; shipped v0.6.0). The--offlineflag enforces mutual exclusion with network-touching opt-in flags (--verify-hashes,--verify-signatures,--check-vulns,--connect); a plain scan already makes no network calls, so--offlineis a no-op for the default configuration - Credenzo does not implement semver range resolution anywhere — no semver library appears in
src/mcp_audit/vulnerability/orsrc/mcp_audit/attestation/. For an unpinned npm server,resolve_latest_version()asksregistry.npmjs.org/<pkg>/latest(thelatestdist-tag, npm-pick-manifest's own first-preference rule) rather than computing a highest-satisfying version, so the class of resolver bug an external measurement (issue #88) found in a from-scratch range resolver — preferring a higher non-latest-tagged version over the dist-tag — cannot reach us; we declined to implement the thing that has the bug. For PyPI,info.versionfrom the PyPI JSON API is documented to report the latest stable release (pre-releases excluded), matching pip's/uvx's/pipx's own default install behaviour, so it errs the same direction a real install would.resolver.is_version_range()(R36) is a syntactic, non-semver detector for a config entry that carries a floating specifier (^1.2.3,~1.2.3,>=1.0.0,1.2.x,*,1.0.0 - 2.0.0,latest) rather than an exact pin;check_vulnerabilities()andcredenzo sbomboth check it before callingfetch_transitive_deps(), because deps.dev requires an exact(name, version)key and 404s on a range — without the check, that 404 was caught byfetch_transitive_deps()'s ownexcept URLError/HTTPErrorand silently degraded to a top-level-only result carrying the literal range string as its "version," with no warning. Both call sites now resolve a concrete version first (same as the existing "unpinned" path) and surface a visibleVULN-UNPINNEDfinding / Rich console warning naming the original range and the resolved version. See "Known limitation: the published graph vs. the installed tree" indocs/supply-chain.mdfor the measured, externally-contributed error-rate bound on the deps.dev-vs-real-install gap this same issue established. - Rug-pull state is stored in
<user-config-dir>/mcp-audit/state/state.json(resolved viaplatformdirs; macOS:~/Library/Application Support/mcp-audit/state/); a one-time migration copies state files from the legacy~/.mcp-audit/location on first access - No feature gating in the package. Credenzo is fully open source (Apache 2.0); every feature ships in every binary. Do not re-introduce conditional feature availability at any layer of
src/mcp_audit. The one paid offer is the Credenzo Team action inteam/(see "Business model"): it gates its own alerts, never a command. - Watcher callback serialisation.
_McpConfigEventHandler._fire()holds_scan_lockfor the entire duration of the user callback to prevent tworun_scancalls from racing onstate_<hash>.json. Events arriving while a scan is in flight are stored in_pending_rescan(tuple of latest(path, event_type)) and coalesced into a single re-trigger when the active callback returns. Never release the scan lock before the callback finishes. - Exit codes: 0 = clean, 1 = findings found, 2 = error
- JSON output includes a nested
scoreobject fromScanScore:{"numeric": int, "grade": str, "positive_signals": [], "deductions": []}—numericis 0–100,gradeis "A"–"F",positive_signalsanddeductionscarry the per-signal strings displayed in the terminal score panel; HTML dashboard displays a colour-coded grade badge in the header scan --no-scoresuppresses the grade panel in terminal output only; score is still calculated and present in JSON/HTMLscan --registry PATHoverrides the bundled and cached registry for that runscan --offline-registryuses the bundled registry only, skipping the user-local cache at<user-config-dir>/mcp-audit/registry/known-servers.json; typosquatting detection still runs using bundled datascan --baseline NAME(or--baseline latest) loads a saved baseline and appendsDriftFindings converted toFindingobjects (analyzer="baseline") into all output formats after the normal scanscan --output-file PATH(alias for--output/-o) writes scan results to a file; parent directories are created automatically; required for the GitHub Action SARIF upload stepscan --severity-threshold LEVELfilters findings to only those at or above the given level and drives exit code; default isINFO(all findings);--severity-threshold highexits 1 only if HIGH or CRITICAL findings existscan --rules-dir PATHloads additional YAML rule files from PATH for this scan; available to all users; community rules always run regardlessscan --project <dir>walks the directory tree of a repository for project-level MCP config files (.mcp.json,.cursor/mcp.json,.claude/settings.json,.claude/settings.local.json,.cursor/settings.json,.vscode/mcp.json,.amazonq/mcp.json,.codex/config.toml,.gemini/settings.json, plus the gateway files.mcptoon.json,.mcptoon.tomland.mcphub/servers.json) and emitsTRUST-001(HIGH) for every server found; runs the full analyzer pipeline on project-scoped servers too; tree walk caps at depth 8, skipsnode_modules/.git;--projectpath is validated to exist (exit 2 on failure); use before opening a freshly cloned repo in an AI editor; additive — default scan is unchanged. CWE-829 / OWASP MCP09. Symlink handling (TRUST-002/TRUST-004/TRUST-005, added 2026-09-08): a symlinked directory is still never followed (unchanged loop/blow-up protection) but now emitsTRUST-005(LOW) naming it instead of vanishing silently; a symlinked config/agent-file candidate is included and parsed normally (coverage was never actually at stake —Path.read_text()follows a symlink transparently) and reported asTRUST-002(HIGH outside the scanned root, MEDIUM inside, INFO if broken) for project/cwd-scoped candidates orTRUST-004(always INFO — the GNU Stow/chezmoi/yadm dotfile-manager shape) for user-global/explicit ones. Applies uniformly acrossdiscovery.py(six sites) andagent_files/discovery.py(three sites). A config candidate reached through a symlinked parent directory (.claude -> /elsewhere) is treated like a symlinked file (is_symlink=True, TRUST-002) in both the--projectwalk and the default scan's cwd check (STORY-0108,discovery._reached_through_symlink, the rule STORY-0090 applies to auto-run files); agent-file discovery never descends a symlinked parent (TRUST-005). Seehumans/decisions/2026-09-08-trust-002-symlink-sites.md(marcus repo).- CI workflows (STORY-0091). A scan with no explicit path reads
<cwd>/.github/workflows/throughci_workflows.scan_workflows()inscanner._discover_and_parse(findings are scored, like plugin findings;checkno longer short-circuits to "No MCP config files found" when findings exist);--projectreads the project and nested repo roots in_apply_project_scan, de-duplicated against the cwd copy.analyzer="ci_workflow",client="github-actions",server=job id,tool=step. Noaction.ymlchange was needed: the Action's default run is a cwd scan. update-registryfetchesregistry/known-servers.jsonfrom GitHub and saves it to the user-local cache; available to all users- Baseline storage uses 0o700 dir / 0o600 file permissions, same pattern as rug-pull state files; env values are never stored, only key names (security — prevents secrets being persisted to disk)
scan --policy PATHloads a governance policy file; governance findings are appended toresult.findingsafter the scan completes (and after baseline drift) so they flow through all output formatters automatically.--policy,policy init, andpolicy checkare all available to every user.- Governance policy resolution order when
--policyis not given: explicit flag → cwd → git repo root →<user-config-dir>/mcp-audit/policy.yml(resolved viaplatformdirs). ReturnsNone(no check) if no file found. scan --verify-hashesdownloads package tarballs and verifies SHA-256 againstknown_hashespins in the registry; requires network; free for all tiers; findings appended toresult.findingsafter the scan.
Advisory feed invariants
The advisory feed is a published, externally-consumed artifact. Breaking any of the following silently breaks downstream consumers, so treat them as contract:
- Determinism is the whole product. The same finding must produce byte-identical
advisory JSON on every host, forever. Advisory IDs are derived from ecosystem +
package + rule ID + finding class (+ normalized location when set) — never from a
filesystem path, hostname, or timestamp. Timestamps come from
--published-at, thenSOURCE_DATE_EPOCH, and only then wall-clock; never calldatetime.now()insidebuild_advisory. canonical.pyimplements RFC 8785, not "JSON with sorted keys". Object keys sort by UTF-16 code unit (not code point) and numbers use ECMAScriptNumber::toString. These differ fromjson.dumps(sort_keys=True)for non-BMP keys and for floats. Signatures are over canonical bytes, so any change here invalidates every published signature.src/mcp_audit/owasp_mcp.pyis the only definition of the OWASP MCP Top 10. The advisory package must never hold its own copy of the code list. It publishes the bareMCP01..MCP10form that SARIF output anddocs/owasp-mapping.jsonalready use, so records join to the rest of Credenzo's output without translation, andscripts/validate_owasp_mapping.pystays the single CI gate.owasp_codes_for()validates againstowasp_mcp.pyand drops anything unrecognised;Advisoryraises on an unknown code. A finding with no clean mapping getsowasp_mcp: []and anowasp_mcp_todostring — it does not get a guessed code. Two tests enforce this: an AST scan for year-suffixed codes in the advisory package's code (docstrings are exempt —owasp_codes_fordocuments that it accepts that form on input), and a check thatmcp_audit.advisory.owaspstays deleted.- The index is the integrity root.
index.jsonrecords acanonical_sha256per advisory plus thesigningblock, and is itself signed.verify_feedre-canonicalizes each advisory, checks its digest against the signed index, verifies its signature, and fails on any advisory file present on disk but absent from the index. Do not add a verification path that trusts a per-advisory signature alone — that would let an attacker swap in a differently-but-validly signed record. - Feed freshness lives only on the index.
snapshot_version,published_at, andexpiresare Credenzo fields onindex.json(feed_version1.1). They are never copied onto OSV advisory records.feed verifyhard-fails on expiry or rollback;scan --advisory-feedskips matching, emitsfeed_status, and still completes. There is no--allow-expired. Clientseen.jsonis keyed on the signing identity (workflow ref + OIDC issuer), not a certificate fingerprint; changing that identity resets rollback protection..github/workflows/advisory-feed-publish.ymlis the only publisher; the minisign project key's private half is theMCP_AUDIT_FEED_SIGNING_KEYsecret (environmentfeed-signing,mainonly) and the public half iskeys/mcp-audit-feed.pub.publishmust copyindex.json.sigwithindex.json(test_publish_copies_index_json_sig_alongside_index_json; the first signed publish, 2026-09-07, shipped without it). A stateless client accepts any unexpired validly-signed snapshot; TTL is the only lever. Stolen key, a publisher omitting advisories at a new version, a client clock in the past, and mix-and-match (already bound bycanonical_sha256) are not covered. - Publishing is two-phase.
write_feed()emits the unsigned index;sign_feed()rewrites it with thesigningblock and then signs it. Determinism assertions must compare pre-signing output. - A feed is signed with a static project key, not Sigstore keyless. This is the
documented divergence from
snapshot --sign, and it is threat-model driven: a snapshot is a one-off forensic artifact verified online where the human identity is the evidence; a feed is consumed offline, reproducibly, against a stable project identity.advise --signtherefore requires--key/$MCP_AUDIT_SIGNING_KEYand fails fast viaSigningConfig.require_signing_key()before writing any signature.--keylessstays reachable for one-off attestations but must never become the default. Do not re-point this atsigstore-python: it is keyless-only, cannot use a static key, and is excluded from the PyInstaller binary. - cosign and minisign are optional external tools. A missing backend degrades
exactly like a missing semgrep in
sast/runner.py— an actionable message naming the install step and--no-sign, never a traceback. Never vendor the crypto into the binary to avoid this. - Signatures stay detached and over canonical bytes, so rotation never rewrites a
record. Nothing signature-shaped is ever stored inside an advisory, and the signed
payload is the JCS canonicalization rather than the on-disk file. Together these make
a key rotation invisible to anyone consuming records instead of signatures — IDs,
digests, and bytes are unchanged, and mirrors see no diff. Inlining a signature or
certificate into a record would make every rotation churn the whole feed; signing raw
file bytes would freeze the feed into one byte layout and break re-serialising
mirrors.
TestRotationLeavesRecordsUntouchedintests/test_advisory_sign.pypins this; no other test would catch either regression. - An unsigned feed is a supported artifact.
examples/feed/ships unsigned because signing it reproducibly would mean committing a private key — this stays true even now that the live published feed on thefeedbranch is signed with the real project key; the two are deliberately different artifacts.verify_feedreportssigned=Falseand checks integrity only; tampering is still caught throughcanonical_sha256. A feed whose index carries asigningblock still fails when a signature is missing, so this can never become a silent downgrade. The signing path is proven by ephemeral-keypair tests intests/test_advisory_sign.py.canonical_sha256is the only integrity guarantee consumers of the in-repoexamples/feed/get — no signature covers that fixture, sotest_a_mutated_record_still_fails_when_unsignedis load-bearing rather than redundant with the signed-feed tests. Do not weaken it. x_MCPSAprefix is deliberate. OSV restrictsidprefixes to a registered allowlist plus thex_experimental namespace, so records validate today. Drop thex_only onceMCPSAis registered upstream.- Not every finding is an advisory.
classify.py::is_advisable()excludes informational/stateful IDs (RUGPULL-000/003, ATTEST-010/015, BL-001, COMM-000, CFHYG-004). New non-vulnerability finding IDs belong inNON_ADVISORY_IDS.observationdistinguishespackage-intrinsic(the package itself is affected) fromdeployment(this installation is misconfigured) — consumers rely on it to decide whether the record indicts the upstream package. - Advisory prose is published to the world.
feed.py::redact()scrubsSECRET_PATTERNSmatches from summary/details before write. Any new field that carries analyzer text must go through it. - The OSV schema is vendored, not fetched.
advisory/osv_schema/osv-1.6.0.jsonis pinned so validation is offline and stable. Bumping it is a deliberate act: updateOSV_SCHEMA_VERSION, re-run the round-trip tests, and re-sign the example feed. All four PyInstaller specs and the wheel must keep bundling it.
Governance vs Rule Engine
The rule engine (rules/) pattern-matches inside server configs and produces Finding objects with analyzer="rules". The governance engine (governance/) enforces organisational requirements — approved server lists, minimum scan scores, transport constraints, registry membership, finding tolerances — and produces Finding objects with analyzer="governance". They are complementary: run together in every scan when a policy file is present.
Key differences:
- Rule engine: detects security issues in how servers are configured (e.g. credential leaks, poisoning patterns)
- Governance engine: enforces which servers are allowed and what quality bar the configuration must meet
- Community rules always run; custom rules,
rule validate, andrule testare all available to everyone (no gating) - Governance
--policyflag,policy init, andpolicy checkare all available to every user - Governance findings appear in a distinct "Policy Violations" panel in terminal output (yellow border)
Security hardening invariants
The following invariants were established during the pre-launch security hardening pass (2026-04-17) and must be maintained in all future changes:
subprocess.run()always uses list form withshell=False(implicit default). Never construct a shell command as a string and pass it tosubprocess.run(). TheSEMGREP_TIMEOUT_SECONDS = 300constant insast/runner.pymust be used for any subprocess timeout; hardcoded timeout integers are forbidden.- Baseline and registry cache files are always created at 0o700 dir / 0o600 file.
Use
os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)for sensitive writes. Never usePath.write_text()for files under the user config directory (resolved viaplatformdirs.user_config_dir("mcp-audit")) unless achmod(0o600)immediately follows. - No bare
except:clauses. Useexcept Exception:at minimum, or a more specific type. Verify withgrep -rn "except:" src/— must return zero matches. - All user-supplied paths resolved with
Path.resolve()before use. For baseline paths, confirm the resolved path stays within the storage directory viacandidate.relative_to(self._storage_dir). For--registryand--policypaths,resolve()is sufficient (no boundary check needed). - All
--path,--registry,--sast, and--policyCLI arguments are validated to exist before use, producing a clean exit code 2 and human-readable message on failure, never a Python traceback.
Quality gates
Dev extras required: Run uv sync --extra dev before running tests for the
first time, or after a fresh clone. A plain uv sync omits pytest-asyncio
and other dev tools — async tests will silently fail with unknown-mark warnings
if this step is skipped.
- Before each commit, run the
verifyskill (.claude/skills/verify/SKILL.md): lint, the tests for the changed code, then the demo scan againsttests/golden/demo_scan_findings.jsonand therundemo. Its rules: stop after three failed fix rounds; never skip a flaky test or edit a golden file to make a change pass - Run
uv run pytestafter every change - Run
uv run ruff check src/ tests/before committing - Run
uv run bandit -r src/ -ll -f txtperiodically (we're a security tool — act like it) - Run
./scripts/update_test_count.pybefore tagging a release (or after any PR that changes test count, SAST rule count, community rule count, or analyzer count) to sync all hand-maintained count references inREADME.mdandCLAUDE.md. The script now covers: test count, SAST rule count (total + Python/TypeScript breakdown), community rule count, concrete analyzer count, and the release pin (v<pyproject version>): everyuses: adudley78/credenzo[/setup-action]@tag or@mainref and pinnedversion:input in README.md and the Action docs (_ACTION_REF_DOCS,_VERSION_INPUT_DOCS), every pre-commitrev:for this repo (_PRE_COMMIT_PIN_FILES), andcredenzo==indocs/enterprise-deployment.md; prose citing an old release is never rewritten, andtests/test_update_test_count.pyfails if any example takes a shape the script would miss (STORY-0102), so a release PR fails--checkuntil it updates them. CI runs the same script with--checkon the ubuntu/py3.12 leg and fails on drift. - Run
python scripts/validate_owasp_mapping.pyafter adding any new finding ID to verify it is mapped indocs/owasp-mapping.json. CI runs this on the ubuntu/py3.12 leg and fails when any finding ID is missing from the mapping file. Every PR that adds a new finding ID must also add a mapping entry. - Type hints on ALL function signatures
- Docstrings on all public functions and classes
Bandit must report no medium or higher issue. A suppression is
# nosec <rule id> with a one-line reason, never a bare # nosec
(grep -rn --include=*.py "nosec" src/ | grep -v "nosec B[0-9]" prints nothing). Bandit does not
flag a TLS context with verify_mode = CERT_NONE: review any change to ssl use
by hand (push-nucleus shipped with checks off until 2026-11-21).
When to flag for Opus review
If a task involves designing a new module interface, changing how analyzers interact with each other, restructuring data models, or you find yourself uncertain between two fundamentally different approaches — stop and say: "⚡ Architecture decision — consider switching to Opus for this." Do not attempt to resolve architectural ambiguity by guessing. Flag it.
Current state
What each feature does is in README.md, docs/README.md (the index of every document) and CHANGELOG.md. Known limits are in GAPS.md. The long feature history that used to be here is in docs/archive/claude-md-2026-11-16.md.
Counts that scripts/update_test_count.py keeps in sync:
- 8 analyzers: poisoning, credentials, transport, supply chain, rug-pull, toxic flow, config hygiene, auth
- 11330 tests passing;
ruff check src/ tests/clean (zero errors);ruff format src/ tests/clean (zero files requiring reformatting) — verify withuv run pytest --collect-only -qbefore each release - 35 top-level CLI commands: affected, vet, reach, check, fix, run, guard, wrap, unwrap, scan, discover, pin, diff, lock, dashboard, watch, version, update-registry, merge, verify, sast, sbom, push-nucleus, shadow, killchain, snapshot, register, advise, baseline (5 sub-commands: save, list, compare, delete, export), rule (3 sub-commands: validate, test, list), policy (3 sub-commands: validate, init, check), extensions (2 sub-commands: discover, scan), agent-files (2 sub-commands: discover, scan), plugins (2 sub-commands: discover, scan), feed (1 sub-command: verify) — verify with
credenzo --helpbefore each release - 56-entry curated dataset of legitimate MCP servers (
registry/known-servers.json,docs/registry.md) - 42 community rules ship bundled; the breakdown is under "Data files at project root" above
- Demo: 75 findings on a first scan of
demo/configs/(67 once rug-pull state exists; 76 and 68 up to 0.33.0, before STORY-0171 moved the bare "do not mention" out of POISON-012; POISON-070 still reports that text). Recount before each release:credenzo scan --path demo/configs/ --format json.tests/test_demo_scan_golden.pypins the first-scan findings without CFHYG-001/002 (67) intests/golden/demo_scan_findings.json
Provenance
All detection patterns are original implementations based on published security research. No code was copied from existing scanners. Full source attribution is documented in PROVENANCE.md — read it before adding new detection patterns. Every new pattern must cite its research source. The project now has 8 analyzers with patterns sourced from the research listed in PROVENANCE.md. Update PROVENANCE.md when adding new detection patterns or analyzers. See GAPS.md for known detection quality limitations, severity calibration issues, and untested areas. Consult before claiming detection completeness or accuracy.
Commit history audit (2026-04-17)
A full audit of the git history before the public release found no real credentials, internal URLs or key material. Every match was a synthetic test fixture (for example the ghp_aBcDeF… and sk-abcdef… strings in tests, Semgrep rule fixtures and demo/configs/). The full record is in docs/archive/claude-md-2026-11-16.md.
Release engineering
PyInstaller path resolution — test coverage (2026-04-17)
| Behaviour | Test coverage | Notes |
_resolve_bundled_path() returns _MEIPASS/registry/known-servers.json when sys.frozen=True | tests/test_registry.py::TestMeipassResolution | Patches sys.frozen + sys._MEIPASS via monkeypatch |
KnownServerRegistry loads from a simulated _MEIPASS layout | tests/test_registry.py::TestMeipassResolution::test_frozen_registry_loads_via_patched_bundled_path | Monkeypatches BUNDLED_REGISTRY_PATH |
Corrupt PyInstaller bundle (missing registry file) raises FileNotFoundError | tests/test_registry.py::TestMeipassResolution::test_locate_raises_when_bundled_path_missing | Both user-cache and bundled path missing |
| Binary entry point and bundled data intact after build | Shared composite + scripts/smoke_test.py | .github/actions/build-binary/ is invoked by CI binary-smoke and release.yml build |
CI workflow (.github/workflows/ci.yml)
Triggers on every pull request and on pushes to main (until 2026-11-19 also on every branch push, which ran each pull-request commit twice and left macOS jobs waiting for a runner until their time limit). Runs a 3×2 matrix (6 combinations):
- OS:
ubuntu-latest,macos-latest,windows-latest - Python:
3.11,3.12 fail-fast: false— a failure on one leg does not cancel the others.
Each test-matrix leg runs: pip install uv → uv pip install -e ".[dev]" --system → pytest tests/ -x -q → ruff check src/ tests/ → ruff format --check src/ tests/. The matrix uses actions/setup-python so uv installs into the runner's system Python via --system.
wheel-check (every push/PR) uses setup-uv + CPython 3.12.14, builds the wheel, fetches the publish action's runtime.txt at the pinned SHA, and runs that Twine (uvx twine==… check --strict) so a Core-Metadata bump fails on the PR, not at the tag. Hatchling stays unpinned; the Twine version is not copied into ci.yml.
The workflow status badge is in README.md.
Release workflow (.github/workflows/release.yml)
Triggers on v*.*.* tags (e.g. git tag v0.2.0 && git push --tags), and on workflow_dispatch: a dry-run of the build job (no GitHub Release, no PyPI) unless dispatched on a vX.Y.Z tag with publish: true, which is how release-on-version-bump.yml starts a release. Builds four binaries in parallel, then creates a GitHub Release with all four attached and auto-generated release notes.
Merging a version bump to main is the release (R73, 2026-10-15). .github/workflows/release-on-version-bump.yml runs on pushes to main that touch pyproject.toml; scripts/release_gate.py tag tags the commit (through the refs API, which refuses an existing tag) only if that commit itself changed [project].version (compared with its parent), the version is untagged and above every release tag, and CHANGELOG has a non-empty ## [X.Y.Z] section (checked with compose_release_notes.extract_changelog_section, the same parser the release job uses, so empty notes can't fail release after publish-pypi has used up the version). It then dispatches release.yml on the tag with publish=true, because a tag pushed with GITHUB_TOKEN starts no workflow. Every publishing job in release.yml (release, publish-pypi, tag-major) needs the gate job (scripts/release_gate.py publish): the ref must be a vX.Y.Z tag on main matching pyproject.toml, with a non-empty CHANGELOG section and no higher release tag, and a dispatch must say publish: true (a plain dispatch is decided as a dry run before anything is read); every refusal fails the run with its reason. release.yml has concurrency: release-${{ github.ref }} so a tag never runs twice at once. Recovery when the tag exists but the dispatch failed: gh workflow run release.yml --ref vX.Y.Z -f publish=true (re-running the bump workflow only reports "already tagged"). Do not switch the tag push to a personal token (it would start release.yml by itself and the dispatch would publish a second run). Pinned by tests/test_release_gate.py and tests/test_ci_binary_smoke.py::test_release_dispatch_is_a_dry_run.
Shipped binaries are built by .github/actions/build-binary/. CI binary-smoke and this workflow's build job both call it (CPython 3.12.14 via uv python install, uv sync --all-extras, spec, PyInstaller, PYZ inspect, smoke, size). Do not copy those steps into either workflow. History of the three CI/release drifts: docs/building-binaries.md.
| Runner | Spec file | Output binary |
macos-15-intel | mcp-audit-darwin-x86_64.spec | mcp-audit-darwin-x86_64 |
macos-latest | mcp-audit-darwin-arm64.spec | mcp-audit-darwin-arm64 |
ubuntu-latest | mcp-audit-linux-x86_64.spec | mcp-audit-linux-x86_64 |
windows-latest | mcp-audit-windows-x86_64.spec | mcp-audit-windows-x86_64.exe |
macos-15-intelbuilds the x86_64 macOS binary (macos-13was retired on 2025-12-08;macos-latestis arm64 and would silently produce the wrong architecture). GitHub supports the Intel label through 2027-08.
PyInstaller spec files
Four spec files live at the repo root: mcp-audit-darwin-x86_64.spec, mcp-audit-darwin-arm64.spec, mcp-audit-linux-x86_64.spec, mcp-audit-windows-x86_64.spec. All use a portable SPECPATH-relative root instead of hardcoded absolute paths:
import os
root = os.path.dirname(os.path.abspath(SPECPATH))All four specs include identical datas (7 entries: mcp_audit/data, the three registry JSONs — known-servers.json, known-extension-vulns.json, known-malicious.json — rules/community/, semgrep-rules/, and the vendored OSV schema; tests/test_pyinstaller_specs.py pins the registry files) and the same full hiddenimports list. The only difference between specs is the name= field in the EXE block.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

