mcphound 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. mcphound-0.1.0/.claude/agents/redteam.md +18 -0
  2. mcphound-0.1.0/.claude/agents/rule-reviewer.md +16 -0
  3. mcphound-0.1.0/.claude/hooks/on-edit.sh +25 -0
  4. mcphound-0.1.0/.claude/settings.local.json +8 -0
  5. mcphound-0.1.0/.claude/skills/incident-teardown/SKILL.md +17 -0
  6. mcphound-0.1.0/.claude/skills/release/SKILL.md +16 -0
  7. mcphound-0.1.0/.claude/skills/rule-authoring/SKILL.md +81 -0
  8. mcphound-0.1.0/.env.example +18 -0
  9. mcphound-0.1.0/.github/workflows/ci.yml +54 -0
  10. mcphound-0.1.0/.gitignore +18 -0
  11. mcphound-0.1.0/.mcp.json +21 -0
  12. mcphound-0.1.0/.pre-commit-config.yaml +21 -0
  13. mcphound-0.1.0/.serena/.gitignore +2 -0
  14. mcphound-0.1.0/.serena/project.local.yml +5 -0
  15. mcphound-0.1.0/.serena/project.yml +169 -0
  16. mcphound-0.1.0/CHANGELOG.md +107 -0
  17. mcphound-0.1.0/CLAUDE.md +33 -0
  18. mcphound-0.1.0/GOVERNANCE.md +16 -0
  19. mcphound-0.1.0/LICENSE +205 -0
  20. mcphound-0.1.0/Makefile +22 -0
  21. mcphound-0.1.0/PKG-INFO +89 -0
  22. mcphound-0.1.0/README.md +56 -0
  23. mcphound-0.1.0/RELEASE.md +93 -0
  24. mcphound-0.1.0/ROADMAP.md +95 -0
  25. mcphound-0.1.0/docs/incidents/.gitkeep +2 -0
  26. mcphound-0.1.0/docs/troubleshooting.md +50 -0
  27. mcphound-0.1.0/mcp-policy.example.yaml +39 -0
  28. mcphound-0.1.0/mcp-security-tool-build-plan.md +203 -0
  29. mcphound-0.1.0/opencode.jsonc +101 -0
  30. mcphound-0.1.0/pyproject.toml +61 -0
  31. mcphound-0.1.0/sandbox/README.md +18 -0
  32. mcphound-0.1.0/sandbox/docker-compose.sandbox.yml +40 -0
  33. mcphound-0.1.0/scripts/self-scan.sh +22 -0
  34. mcphound-0.1.0/src/mcphound/__init__.py +3 -0
  35. mcphound-0.1.0/src/mcphound/cli.py +115 -0
  36. mcphound-0.1.0/src/mcphound/discovery/__init__.py +0 -0
  37. mcphound-0.1.0/src/mcphound/discovery/clients.py +167 -0
  38. mcphound-0.1.0/src/mcphound/models.py +39 -0
  39. mcphound-0.1.0/src/mcphound/output.py +68 -0
  40. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-001.yaml +17 -0
  41. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-002.yaml +16 -0
  42. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-003.yaml +17 -0
  43. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-004.yaml +17 -0
  44. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-005.yaml +18 -0
  45. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-006.yaml +19 -0
  46. mcphound-0.1.0/src/mcphound/rules/MCP-STATIC-007.yaml +19 -0
  47. mcphound-0.1.0/src/mcphound/rules/__init__.py +0 -0
  48. mcphound-0.1.0/src/mcphound/rules/data/known_servers.yaml +13 -0
  49. mcphound-0.1.0/src/mcphound/rules/engine.py +176 -0
  50. mcphound-0.1.0/src/mcphound/rules/loader.py +19 -0
  51. mcphound-0.1.0/tests/__init__.py +0 -0
  52. mcphound-0.1.0/tests/conftest.py +7 -0
  53. mcphound-0.1.0/tests/fixtures/configs/claude_desktop.json +11 -0
  54. mcphound-0.1.0/tests/fixtures/configs/cursor_mcp.json +8 -0
  55. mcphound-0.1.0/tests/fixtures/configs/gemini_mcp.json +8 -0
  56. mcphound-0.1.0/tests/fixtures/configs/windsurf_mcp_config.json +9 -0
  57. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-001/mcp-benign.json +12 -0
  58. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-001/mcp-malicious.json +12 -0
  59. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-002/mcp-benign.json +9 -0
  60. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-002/mcp-malicious.json +9 -0
  61. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-003/mcp-benign.json +9 -0
  62. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-003/mcp-malicious.json +9 -0
  63. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-004/mcp-benign.json +9 -0
  64. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-004/mcp-malicious.json +9 -0
  65. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-005/mcp-benign.json +10 -0
  66. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-005/mcp-malicious.json +10 -0
  67. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-006/mcp-benign.json +9 -0
  68. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-006/mcp-malicious.json +9 -0
  69. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-007/mcp-benign.json +9 -0
  70. mcphound-0.1.0/tests/fixtures/static/MCP-STATIC-007/mcp-malicious.json +9 -0
  71. mcphound-0.1.0/tests/test_cli.py +68 -0
  72. mcphound-0.1.0/tests/test_discovery.py +96 -0
  73. mcphound-0.1.0/tests/test_rules.py +114 -0
  74. mcphound-0.1.0/uv.lock +584 -0
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: redteam
3
+ description: Adversarial tester for mcpvet. Crafts poisoned MCP server fixtures and evasion attempts to break the detectors before real attackers do.
4
+ tools: Bash, Read, Write, Edit, Grep, Glob
5
+ ---
6
+
7
+ You are an offensive security researcher testing the mcpvet scanner's detection coverage.
8
+
9
+ Your job:
10
+ 1. Read the current rules in `src/mcpvet/rules/` and the detection engine.
11
+ 2. Construct MCP server configs and tool descriptions that SHOULD be caught but might evade: obfuscated prompt-injection (zero-width chars, base64, polyglot instructions), tool-shadowing with subtle naming, rug-pull via description-only changes that keep hash collisions where possible, egress to typosquatted lookalike domains.
12
+ 3. Add each as a test under `tests/fixtures/redteam/` (canary marker `MCPVET-FIXTURE-CANARY` required in every fixture).
13
+ 4. For every evasion that succeeds, either write the missing rule (via the `rule-authoring` skill) or file a GitHub issue tagged `evasion` with the exact bypass.
14
+
15
+ Hard constraints:
16
+ - NEVER execute a fixture outside the Docker sandbox runner. NEVER network-access real third-party services from fixtures — use RFC2606/`example.com` and localhost mocks.
17
+ - Do not target any real organization or publish working exfiltration payloads; demonstrate intent with canary strings only.
18
+ - Report results as: attempt id, technique, expected rule, caught? (y/n), issue/rule link.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: rule-reviewer
3
+ description: Reviews new/changed detection rules for false-positive risk, OWASP mapping correctness, and deterministic output. Read-only.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are a detection-quality reviewer. For each rule change, check and report:
8
+
9
+ 1. **False-positive risk**: will this fire on legitimate, popular MCP servers? Cite concrete examples (e.g. a rule flagging all `postinstall` scripts will fire on half of npm — is that intentional severity?).
10
+ 2. **Benign fixture quality**: is the benign fixture a *realistic* legitimate case, not a strawman?
11
+ 3. **OWASP mapping**: does the id (LLMxx/ASTxx) actually match the technique? Flag mismatches.
12
+ 4. **Determinism**: does the rule depend on network, timestamps, or LLM calls? All free-tier static findings must be fully deterministic; LLM-dependent findings must be marked and separable in output.
13
+ 5. **Severity/confidence calibration**: match against similar existing rules.
14
+ 6. **SARIF validity**: output parses with a SARIF validator.
15
+
16
+ Do not edit code. Produce a review block with verdict (approve / request-changes) and a numbered fix list.
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ # Claude Code PostToolUse hook: auto-format/lint Python files on edit.
3
+ # Never fails the agent's turn (exit 0) — formatting is best-effort.
4
+ set -euo pipefail
5
+
6
+ input=$(cat)
7
+ file=$(echo "$input" | python3 -c '
8
+ import sys, json
9
+ try:
10
+ d = json.load(sys.stdin)
11
+ print(d.get("tool_input", {}).get("file_path", ""))
12
+ except Exception:
13
+ print("")
14
+ ' 2>/dev/null || true)
15
+
16
+ case "$file" in
17
+ *.py)
18
+ if command -v ruff >/dev/null 2>&1; then
19
+ ruff check --fix "$file" >/dev/null 2>&1 || true
20
+ ruff format "$file" >/dev/null 2>&1 || true
21
+ fi
22
+ ;;
23
+ esac
24
+
25
+ exit 0
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(rtk git *)",
5
+ "Bash(rtk ls *)"
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: incident-teardown
3
+ description: Use when a new MCP/agent-supply-chain attack or worm is disclosed (e.g. another Miasma/ClawHavoc). Produces the analysis-to-rule pipeline.
4
+ ---
5
+
6
+ # Turning a disclosed attack into detections (fast)
7
+
8
+ Speed matters — being first with a public analysis is the distribution playbook.
9
+
10
+ 1. **Collect primary sources**: the disclosing lab's blog (Invariant, Koi, Snyk, OX, UpGuard, Antiy CERT), CVE if assigned, sample configs/IOCs, OWASP/CSA analysis. Save URLs.
11
+ 2. **Extract the kill chain** into `docs/incidents/<date>-<name>.md`: initial access (registry entry? repo PR?), poisoning technique (which field, what markers), action (credential theft? config rewrite?), persistence.
12
+ 3. **Write detection rule(s)** using the `rule-authoring` skill:
13
+ - Static: match the IOC/pattern (e.g. specific config-rewrite path, hidden comment style, endpoint).
14
+ - Dynamic: what egress/tool-shadowing behavior did it exhibit? Add a sandbox assertion.
15
+ 4. **Build fixtures from the real IOCs** (sanitized, canary-marked) — real attacks make the best regression tests.
16
+ 5. **Publish**: short public teardown on the site/blog, X/LinkedIn thread, HN if novel, responsible-disclosure email to affected registries. Include "detected by mcpvet rule MCP-xxx" in the post with a link to the server's reputation page.
17
+ 6. Bump version per `release-checklist` if the rule is time-critical (patch release).
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: release
3
+ description: Use before cutting a release of mcpvet or publishing the GitHub Action. Full pre-flight checklist.
4
+ ---
5
+
6
+ # Release checklist
7
+
8
+ 1. `uv run pytest -q` — all green.
9
+ 2. `uv run ruff check .` — clean.
10
+ 3. `uv run mcpvet scan .mcp.json opencode.jsonc --fail-on high` — scanner passes over the repo's own agent configs (dogfood, same command as `make scan-self`). Zero unacknowledged high/critical findings.
11
+ 4. Scan the 5 most-downloaded community MCP servers as a canary batch; compare scores to previous release — document any score changes in CHANGELOG.
12
+ 5. SARIF output verified to load in GitHub code scanning (test on a throwaway branch).
13
+ 6. Version bumped in `pyproject.toml`; CHANGELOG entry with Conventional Commits; git tag `vX.Y.Z`.
14
+ 7. GitHub Action's `action.yml` references the new version (or `@v1` major tag moved intentionally).
15
+ 8. Release notes include: new rule ids, OWASP mapping changes, any breaking output-format changes.
16
+ 9. **Human runs the publish commands** — the agent prepares everything but never executes `uv publish`, `git push --tags`, or marketplace publish without approval.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: rule-authoring
3
+ description: Use when adding a new detection rule to mcpvet (static or dynamic). Covers the YAML rule schema, fixtures, OWASP mapping, and tests.
4
+ ---
5
+
6
+ # Authoring a new mcpvet detection rule
7
+
8
+ Every rule MUST land with four artifacts: YAML rule, malicious fixture, benign fixture, pytest.
9
+
10
+ ## 1. Rule file: `src/mcpvet/rules/<id>.yaml`
11
+
12
+ ```yaml
13
+ id: MCP-STATIC-0xx # next unused number — check src/mcpvet/rules/ before picking one
14
+ title: Dangerous install command (curl pipe shell)
15
+ owasp: LLM01 # LLMxx = OWASP LLM Top10, ASTxx = OWASP Agentic Top10
16
+ phase: static # static | dynamic
17
+ severity: high # low | medium | high | critical
18
+ confidence: high
19
+ description: >
20
+ MCP server launch commands that pipe a remote script into a shell
21
+ execute attacker-controlled code at startup.
22
+ detect:
23
+ target: command # which field of the server config to inspect: command | url | env | raw
24
+ pattern: '(curl|wget)\s+[^\s|]+\s*\|\s*(sh|bash|zsh)'
25
+ recommendation: Vendor the script or use a pinned package from a registry.
26
+ references:
27
+ - https://invariantlabs.ai/blog/mcp-security-notification-tool-poisoning-attacks
28
+ ```
29
+
30
+ Most detections are a regex against `target` text — that's "rules are data, not code." One
31
+ exception exists: **typosquat checks need edit-distance, not a regex**, so they use a second
32
+ `detect` shape with dedicated engine support in `rules/engine.py`:
33
+
34
+ ```yaml
35
+ detect:
36
+ type: typosquat
37
+ target: command # only "command" is supported today
38
+ reference_list: known_servers.yaml # YAML list under src/mcpvet/rules/data/
39
+ max_distance: 2 # flag names within N edits of a reference name,
40
+ # but not an exact match (exact = it IS that package)
41
+ ```
42
+
43
+ A third exists for checks that need live registry data — **npm provenance**:
44
+
45
+ ```yaml
46
+ network: true # REQUIRED alongside this detect.type — see below
47
+ detect:
48
+ type: npm_provenance
49
+ target: command # only npx-launched packages are checked
50
+ ```
51
+
52
+ Any rule whose `detect` needs the network (not just this one) MUST set the top-level `network: true`
53
+ field. `cli.py`'s `_collect()` filters those rules out unless `--deep` is passed — per
54
+ GOVERNANCE.md, network-dependent checks must be marked and kept separable from the default free
55
+ scan. The actual HTTP call must live in its own small function (see `_fetch_npm_metadata` in
56
+ `rules/engine.py`) so tests can `monkeypatch` it instead of hitting the real registry — `pytest`
57
+ must never make live network calls.
58
+
59
+ Don't add a fourth `detect.type` casually — every new type is engine code, not a community-PR-able
60
+ YAML rule. Prefer extending the regex path unless the check is genuinely not regex-expressible.
61
+
62
+ ## 2. Fixtures
63
+ - Malicious: `tests/fixtures/static/<id>/mcp-malicious.json` — contains the triggering pattern AND the canary string `MCPVET-FIXTURE-CANARY` somewhere in the file.
64
+ - Benign: `tests/fixtures/static/<id>/mcp-benign.json` — the closest legitimate config (false-positive guard). For install-command rules, a pinned `npx -y pkg@1.2.3`.
65
+
66
+ ## 3. Test: add cases to `tests/test_rules.py`
67
+ - Use the `_finding_ids(fixture, rule_dir)` helper already in that file.
68
+ - Assert the malicious fixture fires with the exact rule id.
69
+ - Assert the benign fixture does NOT fire the rule.
70
+ - The existing `test_every_finding_is_owasp_mapped` / `test_sarif_serializes` cases cover OWASP-code presence and SARIF validity for all rules automatically — no per-rule duplication needed.
71
+
72
+ ## 4. Before you commit
73
+ - `uv run pytest tests/test_rules.py -q` passes.
74
+ - Run `uv run mcpvet scan tests/fixtures/static/<id>/mcp-malicious.json --json` and eyeball the output.
75
+ - No separate rule index to update — `rules/loader.py` globs every `*.yaml` in `src/mcpvet/rules/` automatically.
76
+ - Never run the malicious fixture's server — static rules never execute anything. Dynamic rules only execute inside the Docker sandbox runner.
77
+
78
+ ## Rule numbering convention
79
+ - `MCP-STATIC-0xx` static config/package checks
80
+ - `MCP-DYNAMIC-0xx` sandbox runtime checks
81
+ - `SKILL-0xx` agent-skill/tool-description language checks
@@ -0,0 +1,18 @@
1
+ # Copy to .env (gitignored). Never commit real values.
2
+
3
+ # Read-only Postgres DSN for the postgres MCP server / local dev DB.
4
+ # Create a ROLE with SELECT only, on the DEV database — never production.
5
+ MCPVET_DATABASE_URL_RO=postgresql://mcpvet_ro:password@localhost:5432/mcpvet_dev
6
+
7
+ # Optional: local LLM deep-analysis mode (free tier never needs these)
8
+ OPENAI_API_KEY=
9
+ ANTHROPIC_API_KEY=
10
+ # Local model option:
11
+ # OLLAMA_HOST=http://localhost:11434
12
+
13
+ # GitHub token for the GitHub MCP (fine-grained, read + issues/PRs scope only, no admin)
14
+ GITHUB_PERSONAL_ACCESS_TOKEN=
15
+
16
+ # Optional research MCPs (add to ~/.claude.json or global opencode config if wanted)
17
+ # EXA_API_KEY=
18
+ # FIRECRAWL_API_KEY=
@@ -0,0 +1,54 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v5
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - name: Install
18
+ run: uv sync --all-extras
19
+ - name: Lint
20
+ run: uv run ruff check .
21
+ - name: Tests
22
+ run: uv run pytest -q
23
+ - name: SARIF output smoke test
24
+ run: uv run mcpvet scan tests/fixtures --sarif -o mcpvet-results.sarif || true
25
+ - name: Upload SARIF (works once findings exist)
26
+ if: hashFiles('mcpvet-results.sarif') != ''
27
+ uses: github/codeql-action/upload-sarif@v3
28
+ with:
29
+ sarif_file: mcpvet-results.sarif
30
+
31
+ self-scan:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - name: Dogfood the scanner on our own agent configs
36
+ run: |
37
+ if [ -f pyproject.toml ]; then
38
+ pip install uv -q
39
+ uv sync
40
+ uv run mcpvet scan .mcp.json opencode.jsonc --fail-on high --json
41
+ else
42
+ echo "mcpvet not built yet"
43
+ fi
44
+
45
+ nightly-registry-scan:
46
+ # Phase 2+ : start as a weekly cron, promote to nightly when the poller exists.
47
+ if: ${{ false }} # flip on after Phase 2 ships
48
+ runs-on: ubuntu-latest
49
+ schedule:
50
+ - cron: "0 18 * * *" # daily ~04:30 Adelaide time
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - run: uv sync
54
+ - run: uv run mcpvet registry-poll --config config/registry.yaml
@@ -0,0 +1,18 @@
1
+ .env
2
+ .venv/
3
+ venv/
4
+ __pycache__/
5
+ *.pyc
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ .pytest_cache/
9
+ dist/
10
+ build/
11
+ *.egg-info/
12
+ .mcp-scan*
13
+ scan-results/
14
+ sandbox/work/
15
+ .DS_Store
16
+ node_modules/
17
+ .claude/settings.json
18
+
@@ -0,0 +1,21 @@
1
+ {
2
+ "mcpServers": {
3
+ "context7": {
4
+ "type": "stdio",
5
+ "command": "npx",
6
+ "args": ["-y", "@upstash/context7-mcp@1.0.0"]
7
+ },
8
+ "github": {
9
+ "type": "http",
10
+ "url": "https://api.githubcopilot.com/mcp/",
11
+ "headers": {
12
+ "Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
13
+ }
14
+ },
15
+ "playwright": {
16
+ "type": "stdio",
17
+ "command": "npx",
18
+ "args": ["-y", "@playwright/mcp@0.0.40"]
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.6.9 # pin to a real release
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/gitleaks/gitleaks
10
+ rev: v8.21.0 # pin
11
+ hooks:
12
+ - id: gitleaks
13
+
14
+ - repo: local
15
+ hooks:
16
+ - id: mcpvet-self-scan
17
+ name: mcpvet self-scan of agent MCP configs
18
+ language: system
19
+ entry: scripts/self-scan.sh
20
+ files: '(\.mcp\.json|opencode\.jsonc?|\.claude/settings\.json)$'
21
+ pass_filenames: false
@@ -0,0 +1,2 @@
1
+ /cache
2
+ /project.local.yml
@@ -0,0 +1,5 @@
1
+ # This file allows you to locally override settings in project.yml for development purposes.
2
+ #
3
+ # Use the same keys as in project.yml here. Any setting you specify will override the corresponding
4
+ # setting in project.yml, allowing you to customise the configuration for your local development environment
5
+ # without affecting the project configuration in project.yml (which is intended to be versioned).
@@ -0,0 +1,169 @@
1
+ # the name by which the project can be referenced within Serena/when chatting with the LLM.
2
+ project_name: "MCP-Security-Tool"
3
+
4
+ # list of language servers to start when using the LSP backend; choose from:
5
+ # ada al angular ansible bash
6
+ # bsl clojure cpp cpp_ccls crystal
7
+ # csharp csharp_omnisharp cue dart deno
8
+ # elixir elm erlang fortran fsharp
9
+ # gdscript gleam go groovy haskell
10
+ # haxe hlsl html java json
11
+ # julia kotlin latex lean4 lua
12
+ # luau markdown matlab msl nextflow
13
+ # nix ocaml pascal perl php
14
+ # php_phpactor php_phpantom powershell python python_basedpyright
15
+ # python_jedi python_pyrefly python_ty qml r
16
+ # rego ruby ruby_solargraph rust scala
17
+ # scss solidity svelte swift systemverilog
18
+ # terraform toml typescript typescript_vts vue
19
+ # wolfram yaml zig
20
+ # (This list may be outdated; generated with scripts/print_language_list.py;
21
+ # For the current list, see values of the LanguageServerId enum here:
22
+ # https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
23
+ # For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
24
+ # Note:
25
+ # - For C, use cpp
26
+ # - For JavaScript, use typescript
27
+ # - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
28
+ # - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
29
+ # - For Deno projects, use deno (serves the same .ts/.js files as typescript; requires the deno CLI on PATH)
30
+ # - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
31
+ # - For Free Pascal/Lazarus, use pascal
32
+ # Special requirements:
33
+ # Some language servers require additional setup/installations.
34
+ # See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
35
+ # When using multiple language servers, the first language server that supports a given file will be used for that file.
36
+ # The first language server is the default language and the respective language server will be used as a fallback.
37
+ # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
38
+ language_servers:
39
+ - python
40
+
41
+ # the encoding used by text files in the project
42
+ # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
43
+ encoding: "utf-8"
44
+
45
+ # optional shell command to run before the language backend (LSP or JetBrains) is initialised.
46
+ # the command runs in the project root directory and is only executed if the project is trusted
47
+ # (see trusted_project_path_patterns in the global configuration).
48
+ # serena waits for the command to exit: a non-zero exit code is logged as an error but does not
49
+ # abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
50
+ # backstop for non-terminating commands; on expiry the process is killed and activation continues.
51
+ # example: activation_command: "npx nx run-many -t build"
52
+ activation_command:
53
+
54
+ # maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
55
+ # must be a positive number.
56
+ activation_command_timeout: 180.0
57
+
58
+ # line ending convention to use when writing source files.
59
+ # Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
60
+ # This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
61
+ line_ending:
62
+
63
+ # The language backend to use for this project.
64
+ # If not set, the global setting from serena_config.yml is used.
65
+ # Valid values: LSP, JetBrains
66
+ # Note: the backend is fixed at startup. If a project with a different backend
67
+ # is activated post-init, an error will be returned.
68
+ language_backend:
69
+
70
+ # whether to use project's .gitignore files to ignore files
71
+ ignore_all_files_in_gitignore: true
72
+
73
+ # advanced configuration option allowing to configure language server-specific options.
74
+ # Maps the language key to the options.
75
+ # The settings are considered only if the project is trusted (see global configuration to define trusted projects).
76
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
77
+ ls_specific_settings: {}
78
+
79
+ # list of workspace folder paths (LSP backend only).
80
+ # These folders will be used to build up Serena's symbol index.
81
+ # Paths must be within the project root and should thus be relative to the project root.
82
+ # Furthermore, the paths should not be filtered by ignore settings.
83
+ # Default setting: The entire project root folder (".") is considered.
84
+ # In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
85
+ # ls_workspace_folders:
86
+ # - "./subproject1"
87
+ # - "./subproject2"
88
+ ls_workspace_folders:
89
+ - "."
90
+
91
+ # list of additional workspace folder paths for cross-package reference support.
92
+ # Paths can be absolute or relative to the project root.
93
+ # Each folder is registered as an LSP workspace folder, enabling language servers to discover
94
+ # symbols and references across package boundaries, but these folders are not indexed by Serena,
95
+ # i.e. the respective symbols will not be found using Serena's symbol search tools.
96
+ # Example:
97
+ # additional_workspace_folders:
98
+ # - ../sibling-package
99
+ # - ../shared-lib
100
+ ls_additional_workspace_folders: []
101
+
102
+ # list of additional paths to ignore in this project.
103
+ # Same syntax as gitignore, so you can use * and **.
104
+ # Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
105
+ # Example:
106
+ # ignored_paths:
107
+ # - "examples/**"
108
+ # - ".worktrees/**"
109
+ # - "**/bin/**"
110
+ # - "**/obj/**"
111
+ # Note: global ignored_paths from serena_config.yml are also applied additively.
112
+ ignored_paths: []
113
+
114
+ # whether the project is in read-only mode
115
+ # If set to true, all editing tools will be disabled and attempts to use them will result in an error
116
+ # Added on 2025-04-18
117
+ read_only: false
118
+
119
+ # list of tool names to exclude.
120
+ # This extends the existing exclusions (e.g. from the global configuration)
121
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
122
+ excluded_tools: []
123
+
124
+ # list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
125
+ # This extends the existing inclusions (e.g. from the global configuration).
126
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
127
+ included_optional_tools: []
128
+
129
+ # fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
130
+ # This cannot be combined with non-empty excluded_tools or included_optional_tools.
131
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
132
+ fixed_tools: []
133
+
134
+ # list of mode names that are to be activated by default, overriding the setting in the global configuration.
135
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
136
+ # If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
137
+ # Otherwise, this overrides the setting from the global configuration (serena_config.yml).
138
+ # Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
139
+ # for this project.
140
+ # This setting can, in turn, be overridden by CLI parameters (--mode).
141
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
142
+ default_modes:
143
+
144
+ # list of mode names to be activated additionally for this project, e.g. ["query-projects"]
145
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
146
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
147
+ added_modes:
148
+
149
+ # initial prompt for the project. It will always be given to the LLM upon activating the project
150
+ # (contrary to the memories, which are loaded on demand).
151
+ initial_prompt: ""
152
+
153
+ # time budget (seconds) per tool call for the retrieval of additional symbol information
154
+ # such as docstrings or parameter information.
155
+ # This overrides the corresponding setting in the global configuration; see the documentation there.
156
+ # If null or missing, use the setting from the global configuration.
157
+ symbol_info_budget:
158
+
159
+ # list of regex patterns which, when matched, mark a memory entry as read‑only.
160
+ # Extends the list from the global configuration, merging the two lists.
161
+ read_only_memory_patterns: []
162
+
163
+ # list of regex patterns for memories to completely ignore.
164
+ # Matching memories will not appear in list_memories or activate_project output
165
+ # and cannot be accessed via read_memory or write_memory.
166
+ # To access ignored memory files, use the read_file tool on the raw file path.
167
+ # Extends the list from the global configuration, merging the two lists.
168
+ # Example: ["_archive/.*", "_episodes/.*"]
169
+ ignored_memory_patterns: []
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ All notable changes to mcpvet are documented here. Format loosely follows
4
+ [Keep a Changelog](https://keepachangelog.com/); this project doesn't use
5
+ SemVer strictly pre-1.0 (see ROADMAP.md).
6
+
7
+ ## [0.1.0] — 2026-08-29
8
+
9
+ First public release. Static-only scanning; nothing here ever executes an
10
+ MCP server.
11
+
12
+ ### What v0.1 does
13
+
14
+ mcpvet discovers the MCP servers configured in your AI coding clients
15
+ (Claude Desktop/Code, Cursor, Windsurf, Gemini CLI, OpenCode — both `.json`
16
+ and JSON5-style `.jsonc`) and runs a set of static detection rules against
17
+ each server's launch command, environment, and (optionally) npm registry
18
+ metadata. Every finding maps to an OWASP LLM Top 10 or Agentic/MCP Top 10
19
+ code. Output is human-readable by default, or `--json` / `--sarif` for
20
+ tooling and GitHub code scanning, with `--fail-on` exit codes for CI.
21
+
22
+ Install and run (published on PyPI as `mcphound`; `mcpvet` is kept as a
23
+ back-compat command alias):
24
+
25
+ ```bash
26
+ uvx mcphound scan
27
+ ```
28
+
29
+ ### Detection rules
30
+
31
+ | ID | Title | Severity | OWASP |
32
+ |---|---|---|---|
33
+ | `MCP-STATIC-001` | Hardcoded secret in MCP server environment | high | LLM02 |
34
+ | `MCP-STATIC-002` | Remote code download-and-execute in launch command (curl/wget \| sh) | critical | AST04 |
35
+ | `MCP-STATIC-003` | Over-broad host/filesystem permissions in launch command | high | LLM08 |
36
+ | `MCP-STATIC-004` | Unpinned or `@latest` package version in launch command | medium | AST04 |
37
+ | `MCP-STATIC-005` | Tool-description injection markers (hidden HTML comments, zero-width Unicode, exfiltration-imperative phrasing) | critical | LLM01 |
38
+ | `MCP-STATIC-006` | Typosquat of a known MCP server package name (Levenshtein distance) | high | AST04 |
39
+ | `MCP-STATIC-007` | npm package has no discoverable source repository — network-dependent, opt-in via `--deep` | medium | AST04 |
40
+
41
+ Every rule ships with all four required artifacts: the YAML rule, a
42
+ malicious fixture, a benign fixture (false-positive guard), and a pytest.
43
+
44
+ ### Not yet (post-v0.1)
45
+
46
+ - **Dynamic analysis** — Docker sandbox runner, egress-proxy network,
47
+ runtime rug-pull / description-drift detection. Planned for v1.5
48
+ (ROADMAP.md).
49
+ - **Reputation site + API** — registry poller, per-server score pages,
50
+ leaderboard, rate-limited API. Planned for v1.0-beta.
51
+ - **GitHub Action** — `mcp-policy.yaml` allowlist enforcement on PRs.
52
+ Planned for v1.0.
53
+
54
+ ### Added
55
+ - Config discovery for Claude Desktop/Code, Cursor, Windsurf, Gemini CLI,
56
+ and OpenCode (`.json` and `.jsonc`, including trailing-comma JSON5 style).
57
+ - `mcpvet inspect` — lists configured servers without executing them.
58
+ - `mcpvet scan` — runs detection rules; `--json`, `--sarif`, `--fail-on`,
59
+ `-o/--output`, and `--deep` (opt-in network-dependent checks).
60
+ - SARIF 2.1.0 output for GitHub code scanning.
61
+ - Seven static detection rules — see table above.
62
+
63
+ ### Fixed
64
+ - `_target_text`'s raw-JSON dump used `ensure_ascii=True`, silently hex-escaping
65
+ zero-width Unicode characters before MCP-STATIC-005 could see them.
66
+ - `.jsonc` configs with a trailing comma before `}`/`]` (valid JSON5, common
67
+ in hand-edited `opencode.jsonc`) failed to parse; the repo's own
68
+ `opencode.jsonc` hit this.
69
+ - SARIF `informationUri` pointed at a placeholder org/repo instead of the
70
+ real repository.
71
+ - SARIF `artifactLocation.uri` was a Windows-style path with a non-URI
72
+ `" :: server"` suffix appended, which is not a valid URI.
73
+ - SARIF `security-severity` was set to the severity word (`"high"`,
74
+ `"critical"`) instead of a numeric CVSS-like score; GitHub's code-scanning
75
+ ingestion rejects non-numeric values outright, so every SARIF upload would
76
+ have silently failed until this fix. Verified with a live upload to
77
+ GitHub's code-scanning API during release prep.
78
+
79
+ ### Known limitations
80
+ - Package provenance (`MCP-STATIC-007`) only checks for a missing npm
81
+ `repository` field. Postinstall-script inspection and registry-age checks
82
+ (both named in ROADMAP.md's W4) are not implemented yet.
83
+ - The typosquat reference list (`src/mcpvet/rules/data/known_servers.yaml`)
84
+ is a small hand-curated seed, not the official registry — Phase 2's
85
+ registry poller will supersede it.
86
+ - PyPI packages (`uvx`-launched) aren't covered by MCP-STATIC-007 yet, only
87
+ npm/`npx`.
88
+ - The PyPI *distribution name* is `mcphound`, not `mcpvet`. `mcpvet` on
89
+ PyPI belongs to an unrelated package; `mcp-vet` was rejected by PyPI as
90
+ "too similar to an existing project" (its name-similarity check strips
91
+ hyphens/underscores before comparing, so `mcp-vet` collided with
92
+ `mcpvet`); `mcpaudit` belongs to a different, actively-maintained MCP
93
+ security scanner. The importable module and CLI command are still
94
+ `mcpvet` — `pip install mcphound` installs both the `mcphound` and
95
+ `mcpvet` commands (same entry point), so `uvx mcphound scan` and
96
+ `uvx --from mcphound mcpvet scan` both work.
97
+
98
+ ### Dogfood / canary results
99
+ - `mcpvet scan .mcp.json opencode.jsonc --fail-on high`: zero findings against
100
+ this repo's own agent configs.
101
+ - `mcpvet scan --deep` against 5 well-known real MCP packages
102
+ (`@modelcontextprotocol/server-filesystem`, `-postgres`, `-everything`,
103
+ `@upstash/context7-mcp`, `@playwright/mcp`): one genuine finding —
104
+ `@modelcontextprotocol/server-postgres` has no `repository` field in its
105
+ npm metadata (confirmed against the live registry; the package is also
106
+ marked deprecated on npm, unrelated to this rule but worth knowing).
107
+ No previous release to diff against — this is the baseline.
@@ -0,0 +1,33 @@
1
+ # mcpvet — project rules for AI coding agents
2
+
3
+ > This file is read by Claude Code automatically, and by OpenCode via `instructions: ["./CLAUDE.md"]` in opencode.json. Keep it short — long procedures go in `.claude/skills/` and `.opencode/skills/`.
4
+
5
+ ## What we're building
6
+ Independent security reputation + policy-enforcement layer for MCP servers and agent skills. Three surfaces:
7
+ 1. **Scanner CLI** (`mcpvet`): discovers MCP configs, static + dynamic analysis, SARIF/JSON output.
8
+ 2. **Reputation DB + site/API**: continuous scanning of the public MCP registry; per-server risk pages.
9
+ 3. **Enforcement**: GitHub Action + `mcp-policy.yaml` allowlist enforcement.
10
+
11
+ ## Stack
12
+ - Python 3.12, Typer CLI, `mcp` official SDK, FastAPI (API), Postgres, Docker for dynamic sandboxing.
13
+ - Website: Next.js (separate `site/` directory later).
14
+ - Package management: `uv`. Tests: `pytest`. Lint/format: `ruff`.
15
+
16
+ ## Non-negotiable engineering rules
17
+ - **Every detection rule ships with**: a YAML rule file, a malicious fixture, a benign fixture (false-positive guard), and a pytest. No rule without all four.
18
+ - Rules are data, not code: add detections in `src/mcpvet/rules/*.yaml` using the rule schema (see skill `rule-authoring`).
19
+ - Every finding maps to an OWASP code (LLM Top 10 / Agentic-MCP Top 10). No uncategorized findings.
20
+ - Output must be deterministic in CI: `--json` and SARIF modes print no spinner/emojis.
21
+ - Tests must pass before you say a task is done. Run `uv run pytest -q`.
22
+
23
+ ## SAFETY RULES (this project handles malware-adjacent code — read twice)
24
+ - **Never execute a fixture MCP server on the host.** No `npx`, `uvx`, `node`, or `python` against anything in `tests/fixtures/` outside Docker. Dynamic analysis runs only via the sandbox runner (`docker` with a dedicated egress-proxy network, no mounted secrets, no host network).
25
+ - Every malicious fixture contains the canary marker string `MCPVET-FIXTURE-CANARY` and is never referenced from `.mcp.json`, `opencode.json`, or any agent config.
26
+ - Do not add new MCP servers to agent configs without: (a) pinned version, (b) a note in this commit message why it's needed, (c) running `mcpvet scan` (or mcp-scan as interim) against the changed config.
27
+ - Never put secrets in config files; use environment variables only (`.env`, gitignored).
28
+ - `git push`, package publishes, and `docker run` require explicit human approval — they are set to "ask" in both tools' permissions.
29
+
30
+ ## Conventions
31
+ - Conventional commits (`feat:`, `fix:`, `rule:`, `docs:`). Rule additions use `rule: MCP-0xx ...`.
32
+ - New public CLI flags need a docs update in the same PR.
33
+ - When researching attacks, prefer primary sources (Invariant Labs disclosures, CSA papers, OWASP, CVEs); cite URLs in code comments or PR descriptions.