Thanks for your interest in improving MCP security tooling.
- Node.js >= 22
- npm >= 10
git clone https://github.com/KryptosAI/mcp-seatbelt.git
cd mcp-seatbelt
npm installnpm run dev # runs the CLI with tsx
npm run build # compiles TypeScript to dist/
npm run test # runs the test suite
npm run typecheck # checks TypeScript types without emittingmcp-seatbelt/
├── src/
│ ├── index.ts # CLI entry point (commander)
│ ├── types.ts # All shared TypeScript types
│ ├── audit.ts # Signed audit log (HMAC)
│ ├── owasp-mapping.ts # OWASP LLM Top 10 & compliance taxonomy
│ ├── commands/ # CLI subcommand implementations
│ │ ├── init.ts # mcp-seatbelt init
│ │ ├── check.ts # mcp-seatbelt check
│ │ ├── proxy.ts # mcp-seatbelt proxy
│ │ ├── report.ts # mcp-seatbelt report
│ │ ├── diff.ts # mcp-seatbelt diff
│ │ ├── dashboard.ts # mcp-seatbelt dashboard
│ │ ├── import-observatory.ts # mcp-seatbelt import-observatory
│ │ ├── fuzz.ts # mcp-seatbelt fuzz
│ │ ├── rbac-init.ts # mcp-seatbelt rbac-init
│ │ ├── simulate.ts # mcp-seatbelt simulate
│ │ ├── test-policy.ts # mcp-seatbelt test-policy
│ │ ├── benchmark.ts # mcp-seatbelt benchmark
│ │ └── baseline.ts # mcp-seatbelt baseline
│ ├── detectors/ # MCP config detectors per client
│ │ ├── index.ts # detectAll(), parseMcpServers()
│ │ ├── risk.ts # assessRisk() — risk scoring engine
│ │ ├── cursor.ts # Cursor IDE
│ │ ├── claude-desktop.ts # Claude Desktop
│ │ ├── chatgpt-desktop.ts # ChatGPT Desktop
│ │ ├── vscode.ts # VS Code + Copilot Chat
│ │ ├── codex.ts # OpenAI Codex
│ │ └── jetbrains.ts # JetBrains IDEs
│ ├── policy/ # Policy engine & security
│ │ ├── engine.ts # PolicyEngine class
│ │ ├── schema.ts # validatePolicy()
│ │ ├── defaults.ts # DEFAULT_POLICY, generateDefaultPolicy()
│ │ ├── yaml.ts # YAML parse/stringify helpers
│ │ ├── rbac.ts # Casbin RBAC (initRBAC, checkAccess)
│ │ ├── threat-intel.ts # ThreatFox IOC lookup
│ │ └── llm-judge.ts # LLM-as-judge semantic analysis
│ ├── security/ # Defense-in-depth security modules
│ │ ├── index.ts # Re-exports
│ │ ├── attack-chains.ts # XState multi-step attack tracking
│ │ ├── honeytokens.ts # Decoy credential injection & detection
│ │ ├── forensics.ts # Signed .mcpcap.json session capture
│ │ ├── fuzzer.ts # JSON Schema fuzzing for policy bypass
│ │ └── schema-validator.ts # AJV schema validation & path safety
│ ├── proxy/ # Runtime proxy
│ │ ├── index.ts # Re-exports
│ │ ├── server.ts # ProxyServer, StdioClient, HttpClient, SseClient
│ │ ├── intercept.ts # Request interception and response filtering
│ │ └── notifications.ts # MCP notification handler
│ ├── report/ # Report generators
│ │ ├── generator.ts # Markdown + JSON reports
│ │ └── sarif.ts # SARIF 2.1.0 report
│ └── integrations/ # External tool bridges
│ └── observatory.ts # mcp-observatory bridge
├── tests/ # Vitest test suite (18 files, 485 tests)
├── scripts/ # Benchmark harness (run-benchmarks.ts, bench-*.ts)
├── templates/ # Policy template shipped with the package
└── .github/workflows/ # CI/CD (GitHub Actions)
- Detect —
detectAll()scans the filesystem for MCP configs from all supported clients - Assess —
assessRisk()scores each server with 13 risk rules - Wrap —
ProxyServerstarts an Express HTTP server. Each registered server gets a URL path (/serverName) - Enforce —
interceptRequest()evaluates everytools/callagainst thePolicyEngine. Denied calls return an error. Warned calls pass through with a log message. - Filter —
filterToolsListResponse()strips denied tools fromtools/listso the agent never sees them.
Rules are checked sequentially. The first matching rule's action takes priority:
deny>warn>allow- The
allowlist.toolsbypasses all rules - In
auditmode, all calls are allowed but flagged
- Create
src/detectors/<client>.ts - Export an async function
detectX(): Promise<McpClientConfig[]> - Register it in
src/detectors/index.tsdetectAll() - Add tests in
tests/detectors.test.ts - Add to README supported clients list
Each detector follows the same pattern:
- Check platform-specific config paths
- Parse JSON configs looking for
mcpServerskey - Run
assessRisk()on each parsed server - Return typed
McpClientConfig[]
- Add an entry to the
RISK_RULESarray insrc/detectors/risk.ts - Each rule has a
checkfunction that inspectsMcpServerConfig - Each rule has a
ruleID,description, andseverity - Add tests for the new rule in
tests/detectors.test.ts - If the rule should be enforced by default, add it to
DEFAULT_POLICYinsrc/policy/defaults.ts
npm test # run all tests
npm run test:watch # watch modeTests are written with Vitest. Test files mirror the source structure:
tests/policy.test.ts— PolicyEngine, validation, YAML utilstests/detectors.test.ts— Config detection, risk assessmenttests/proxy.test.ts— Request interception, response filteringtests/proxy-server.test.ts— ProxyServer lifecycle, HTTP endpointstests/report.test.ts— Report generation (markdown + JSON)tests/cli.test.ts— CLI arg parsing and integration teststests/integration.test.ts— End-to-end proxy + policy integrationtests/rbac.test.ts— Casbin RBAC initialization and access checkstests/threat-intel.test.ts— ThreatFox IOC lookuptests/llm-judge.test.ts— LLM-as-judge semantic analysistests/attack-chains.test.ts— Attack chain state machinetests/honeytokens.test.ts— Honeytoken injection and detectiontests/forensics.test.ts— Forensic session capturetests/schema-validator.test.ts— Schema validation and path safetytests/audit.test.ts— Signed audit logtests/notifications.test.ts— MCP notification handlingtests/schema-notifications.test.ts— Schema notification handlingtests/baseline.test.ts— Behavioral baseline reports
- TypeScript with strict mode
- ES modules (
"type": "module") - 2-space indentation (see
.editorconfig) - Prefer no semicolons (TypeScript's ASI handles this)
- Single quotes for strings
chalkfor terminal output coloringjs-yamlfor YAML parsing/serialization
- Fork the repo and create a feature branch
- Add or update tests for your changes
- Run
npm run typecheckand ensure no errors - Run
npm testand ensure all tests pass - Open a PR against
main - PR description should explain what changed and why
When opening a pull request, please include:
- What — a clear description of the change
- Why — the motivation behind the change (reference an issue if applicable)
- How — a brief overview of the implementation approach
- Testing — how the change was tested and any new test coverage added
- Checklist:
-
npm run typecheckpasses -
npm testpasses - New behavior is covered by tests
- Documentation is updated (README, API.md, CONTRIBUTING.md as appropriate)
-
When filing an issue, use one of the following templates:
- Bug Report — unexpected behavior, crashes, or incorrect output. Include steps to reproduce, expected vs actual behavior, and environment details (OS, Node version, mcp-seatbelt version).
- Feature Request — describe the feature, the problem it solves, and any proposed approach.
- Security Vulnerability — do not open a public issue. See the Security section below.
If you discover a security issue in mcp-seatbelt itself, please do not open a public issue. Instead:
- Email william@banksey.com with details of the vulnerability
- Include steps to reproduce, affected versions, and any proposed mitigations
- See
SECURITY.mdfor our full security policy, supported versions, and responsible disclosure timeline
This project adopts the Contributor Covenant Code of Conduct. By participating, you agree to uphold its standards. All contributors and maintainers are expected to foster a welcoming and respectful community.
By contributing, you agree that your contributions will be licensed under the MIT License.