Repository avatar
AI Tools
v0.1.0
active

mcp-vol

io.github.utkuvolkanuzunhan/mcp-vol

Zero-LLM deterministic MCP linter (24 rules), stack composer, RFC 6902 patcher & BM25 eval server.

Documentation

mcp-vol

Clippy / Ruff for MCP tools. A zero-LLM, deterministic linter and CI gate for Model Context Protocol tool definitions. It audits all 16 official MCP reference servers (115 tools) in 36.6 ms, with $0 API cost and the same result on every run.

▶ Try it in your browser: paste a tools/list response or server source and get the score, findings and fix hints instantly. Runs locally in WebAssembly, nothing is uploaded.

CI Crates.io docs.rs Self-Audit License: MIT OR Apache-2.0 Rust 1.85+

mcp-vol scanning a Python FastMCP server: the scan fails with VOL002 and VOL009 errors and file:line locations, then a live stdio check of a clean server passes with 5.00/5.00

  • Catches what makes agents pick the wrong tool: 24 rules (VOL001–VOL024) for vague purpose, missing parameter docs, contradictory annotations, broken schemas, hidden Unicode, and token bloat.
  • Works on any MCP server: JSON catalogs, live stdio / Streamable HTTP servers, or a zero-build source scan of Rust (rmcp), TypeScript, Python and Go.
  • Fits CI: SARIF 2.1.0 with file:line:column, a drop-in GitHub Action, and RFC 6902 auto-fixes for mechanical defects.
  • Tiny core: 3 dependencies (serde, serde_json, thiserror). No LLM SDK, no async runtime, no HTTP client.
npx mcp-vol check tools.json --format text           # Node: no install, no Rust toolchain
uvx mcp-vol scan ./src --format text                 # Python: or `pipx run mcp-vol ...`
cargo binstall mcp-vol-cli                           # Rust: or `cargo install mcp-vol-cli`
mcp-vol scan ./src --format sarif > mcp-vol.sarif    # scan source, no build needed
$ mcp-vol check examples/sample_tools.json --format text
mcp-vol audit: FAIL | score 3.74/5.00 (Tier B) | worst tool 3.45 | 3 tools | ~181 tokens (~$0.11/200-turn uncached, ~$0.01 cached)
findings: 3 error, 7 warn, 0 info | collisions: 0 | shadowing risks: 0

[ERROR] VOL006 (annotation-contradiction) delete_index
  Tool 'delete_index' implies mutation ('delete'), but annotations.readOnlyHint is true.
[ERROR] VOL009 (undocumented-schema-parameter) find_docs
  Tool 'find_docs' has 1 parameter(s) missing JSON Schema `description`: query.

More: Playground · Quick Start · GitHub Action · Benchmark · Rules · docs.rs


Why mcp-vol?

When MCP catalogs grow — or when agents mount 4–6 MCP servers simultaneously — models pick the wrong tool, pass invalid arguments, and burn thousands of prompt tokens:

  • 97.1% of public MCP tool descriptions contain at least one quality smell and 56% fail to state their purpose clearly (arXiv 2602.14878).
  • ~70% of public MCP tools omit per-parameter descriptions (arXiv 2602.18914).
  • Existing quality scorers (e.g., Glama TDQS) rely on an LLM judge—great for registries, but slow, costly, and non-deterministic in CI.
  • mcp-vol delivers Clippy / Ruff-speed deterministic checks across 24 research-backed rules (VOL001–VOL024) aligned with the 6-dimension rubric (Purpose Clarity, Usage Guidelines, Behavioral Transparency, Parameter Semantics, Conciseness, Contextual Completeness), zero-build static Rust (rmcp) / TypeScript / Python / Go source scanning, multi-server composition & deferral planning, structural JSON Schema integrity + recursive $ref walking, mechanical RFC 6902 auto-repair (fix / patch), prompt-cache drift diffs, and a pre-indexed 39.6 µs/query Bm25Index + explainability + NDCG@k eval harness — all with $0 LLM spend and 3 core dependencies (serde, serde_json, thiserror).

Closed-Loop AI Agent Workflow (Built for Agents, Not Hand-Coding)

flowchart LR
    A["Source (Rust/TS/Py) or Live MCP (stdio/HTTP)"] --> B["mcp-vol scan / check --compact"]
    A --> C["mcp-vol compose (Multi-Server Stack)"]
    B -->|Mechanical defects| D["mcp-vol fix / patch (RFC 6902)"]
    B -->|Prose & schema defects| E["mcp-vol plan (worst-tool-first)"]
    D --> F["mcp-vol gen-eval (--adversarial) & compare-rankers"]
    E --> F
    F --> G["mcp-vol explain & diff (Prompt-Cache Gate) & SARIF 2.1.0"]

Every API, error, and output is engineered for AI coding agents writing and executing code without guesswork:

  • Zero-boilerplate Rust API (#![deny(missing_docs)]): One-line use mcp_vol::prelude::*;, 1-line facades (audit_json, assert_catalog_clean, audit_rmcp, assert_rmcp_tools_clean, scan_path, compose_catalogs, explain_query, compare_rankers), and #[diagnostic::on_unimplemented] compiler hints on Ranker
  • Zero-build multi-language static scanning (mcp-vol scan ./src): Extracts MCP tools directly from Rust (rmcp #[tool]), TypeScript/JS (@modelcontextprotocol/sdk + Zod), Python (FastMCP / Field), and Go (mcp-go NewTool / official go-sdk mcp.AddTool) with exact file:line:column SARIF 2.1.0 physicalLocation annotations for GitHub PR inline diffs
  • Multi-server stack composition (mcp-vol compose): Parses claude_desktop_config.json / .mcp.json / .cursor/mcp.json, attributes per-server token/USD share, detects cross-server duplicate & semantic collisions, simulates <server>_ namespacing, and recommends on-demand deferral
  • Pre-indexed Bm25Index + IR diagnostics: 39.6 µs/query over 1,000 tools (495.6× faster than stateless BM25), per-term/per-field mcp-vol explain, graded NDCG@k & per-tool accuracy, adversarial sibling eval synthesis (gen-eval --adversarial), and side-by-side compare-rankers
  • Deterministic RFC 6902 Auto-Fix (mcp-vol fix / mcp-vol patch / apply_patches): Mechanically repairs VOL006, VOL007, VOL016, VOL017, VOL018, VOL020, and VOL021 with verified before/after score lift and guaranteed idempotency
  • Canonical JSON (default) with --compact single-line output, --max-findings <N> caps, structured JSON stderr error envelopes, 10 Draft 2020-12 JSON Schemas (mcp-vol schema ...), Streamable HTTP (--http, with --header / --bearer-token-env auth and opt-in https TLS) + hardened --stdio inspection, 7-tool self-audited mcp-vol mcp server (5.00/5.00 Tier A), and distroless Dockerfile
  • Agent discovery ready out of the box: ships with llms.txt, llms-full.txt, context7.json, server.json, skills/mcp-vol-audit/SKILL.md, AGENTS.md, and fast prebuilt-binary GitHub Action action.yml

Real-World Benchmark (16 Official MCP Reference Servers, 115 Tools)

Auditing all 16 official Model Context Protocol reference servers (benchmarks/catalogs/, 115 published tools, ~15,130 serialized tokens) against all 24 rules (VOL001–VOL024) takes 36.6 ms merged (81.6 ms across 16 cold process spawns) with $0 LLM spend and 0 false positives across VOL019–VOL023:

Official ServerToolsScoreTierWorst ToolEst. TokensEst. $/200tErrorsWarningsInfoKey Verified Findings
mcp-vol mcp (self-audit)75.00A5.002,772$1.66000Continuous CI gate (--fail-on info)
time (2026 ref)34.92A4.85347$0.21010VOL015 (1 shadowing pair)
sequentialthinking (2026)14.85A4.85530$0.32010VOL012 (~253 tokens, right at 250-token cap)
filesystem (2026 ref)164.58A4.333,391$2.030180VOL004 (13), VOL015 (1), VOL018 (3 unbounded lists)
memory (2026 ref)94.47B4.181,819$1.090130VOL004 (6), VOL008 (4), VOL010 (3)
slack84.21B3.95780$0.470210VOL005 (get_users ↔ get_user_profile, sim 0.63), VOL011 (timestamp)
puppeteer74.12B3.88614$0.370204VOL007 (7), VOL008 (4), VOL011, VOL024 (4 opaque actions)
postgres14.05B4.0533$0.02120VOL009 (sql lacks description), VOL007, VOL018
google-maps74.04B3.60661$0.402171VOL009 nested locations[].latitude/longitude, VOL018, VOL024
git (2026 ref)143.97B3.681,435$0.8612241VOL009 (12 tools omit param descriptions), VOL005, VOL024
gitlab93.87B3.681,017$0.617232VOL009 (7), VOL007 (9), VOL008 (5), VOL024 (2)
github263.60B2.833,129$1.8815870VOL002 (5 tautologies), VOL009 (10), VOL005 (12), VOL015 (13)

Multi-server & scale highlights:

  • DevOps Stack (github + gitlab + slack + redis + sentry + postgres, 49 tools): mcp-vol compose catches 8 exact duplicate names (sim = 1.00) + 3 semantic overlaps, shows github consumes 58.4% of total context, and proves <server>_ namespacing lifts quality from 3.28 (Tier C) → 3.57 (Tier B) (8 → 0 exact duplicates).
  • Coding Agent Stack (filesystem + git + github + memory + fetch + sequentialthinking, 67 tools, ~10,597 tokens): catches github::create_branch ↔ git::git_create_branch (sim = 0.62) and recommends deferring filesystem (saves ~3,391 tokens / ~$2.03 per 200-turn session).
  • 1,000-Tool Bm25Index Latency: 39.6 µs/query (495.6× faster than stateless BM25; 100/100 Top-1 hits; reproducible via cargo run --release -p mcp-vol --example bm25_scale_bench). Across 44 real eval queries on filesystem, slack, github, and git, Bm25Index scores 100.0% Top-1 / 100.0% Recall@3 / 1.0000 NDCG@3. See benchmarks/REPORT.md for full tables.

Quick Start

0. Try It in the Browser (No Install)

The playground runs the same auditor compiled to WebAssembly. Paste a tools/list JSON or Rust / TypeScript / Python / Go server source, or pick one of the 16 official reference servers, and get the 1–5 score, every VOL finding with its JSON pointer and fix_hint, the RFC 6902 patches, and the auto-fixed catalog. "Copy share link" encodes the input in the URL so you can send a result to a teammate.

1. CLI (Works with ANY MCP Server: Rust, TypeScript, Python, Go)

Pick whichever package manager you already have. Every channel ships the same prebuilt native binary (Linux x64/arm64 static, macOS x64/arm64, Windows x64; https:// support included):

You useRun without installingInstall permanently
Node.js / npmnpx mcp-vol <command>npm install -g mcp-vol
Python (uv / pipx / pip)uvx mcp-vol <command> or pipx run mcp-vol <command>uv tool install mcp-vol / pipx install mcp-vol / pip install mcp-vol
Rust / cargo—cargo binstall mcp-vol-cli (prebuilt) or cargo install mcp-vol-cli
Anything else—Download an archive from GitHub Releases

npm and PyPI packages are published from v0.2.0 onwards.


# Bootstrap `.mcp-vol.json` (and optional `tests/mcp_vol_gate.rs` with `--rmcp`)
mcp-vol init --rmcp

# Zero-build static source scan across Rust (rmcp), TypeScript (SDK/Zod), Python (FastMCP), and Go (mcp-go / go-sdk)
mcp-vol scan ./src --format sarif > mcp-vol.sarif

# Audit a JSON catalog, live stdio server, or local Streamable HTTP MCP server
mcp-vol check examples/sample_tools.json --format text
mcp-vol check --stdio "npx -y @modelcontextprotocol/server-memory" --compact --max-findings 20
mcp-vol check --http http://127.0.0.1:8080/mcp --compact

# Audit a multi-server agent stack (from files, stdio/HTTP, or claude_desktop_config.json / .mcp.json)
mcp-vol compose --server github=github.json --server gitlab=gitlab.json --fail-on-duplicates --format markdown
mcp-vol compose --mcp-config ~/.cursor/mcp.json --format text  # uses command/args/url; export each server's env vars first

# Auto-apply deterministic mechanical RFC 6902 fixes (VOL006/007/016/017/018/020/021)
mcp-vol fix examples/sample_tools.json --min-confidence medium --compact
mcp-vol fix tools.json --min-confidence high --write

# Bootstrap baseline or adversarial sibling eval suites, compare rankers (with NDCG@k), & explain queries
mcp-vol gen-eval benchmarks/catalogs/github.json --adversarial > adv_evals.json
mcp-vol compare-rankers --tools benchmarks/catalogs/github.json --suite benchmarks/evals/github_eval.json --format markdown
mcp-vol explain --tools benchmarks/catalogs/github.json --query "create pull request review" --format text

# Inspect all 10 Draft 2020-12 JSON Schemas (audit|eval|diff|plan|patch|apply|compose|scan|compare|config)
mcp-vol schema compose

# Detect quality regressions & LLM prompt-cache-busting schema mutations between commits
mcp-vol diff baseline.json current.json --fail-on-regression --format markdown

# Self-audit mcp-vol's own 7-tool MCP server (scores 5.00/5.00 Tier A)
mcp-vol check --stdio "mcp-vol mcp" --fail-on info --format text

# Print a README badge for the score (see "Show the Score in Your README" below)
mcp-vol badge --scan ./src

Place a .mcp-vol.json in your repository root (see examples/mcp-vol.json) to persist thresholds, disabled rules, and token pricing automatically.

2. Drop-In GitHub Action (action.yml — Zero Rust Required)

Downloads the prebuilt release binary in ~1 second (works natively in TypeScript, Python, Go, and Rust repos) with automatic cargo install fallback. Supports scan: (zero-build inline PR annotations), stdio:, http:, or file::

- uses: utkuvolkanuzunhan/MCP-vol@v0.2.0
  with:
    scan: "./src"            # or stdio: "node dist/index.js" / http: "http://127.0.0.1:8080/mcp" / file: "tools.json"
    format: markdown
    fail-on: error
    sarif-output: mcp-vol.sarif

Remote / authenticated servers: prebuilt binaries (npm, PyPI, GitHub Releases / cargo binstall), the GitHub Action and the Docker image include https:// support. From source it is an opt-in build feature (pure-Rust rustls; the default cargo install build stays dependency-free):

cargo install mcp-vol-cli --features https
MCP_TOKEN=... mcp-vol check --http https://mcp.example.com/mcp --bearer-token-env MCP_TOKEN
# Other schemes: --header "X-Api-Key: ..." (repeatable); private CAs: --ca-cert ca.pem

pre-commit: with mcp-vol on PATH (pipx install mcp-vol, npm install -g mcp-vol or cargo binstall mcp-vol-cli), add the static scan hook to .pre-commit-config.yaml:

- repo: https://github.com/utkuvolkanuzunhan/MCP-vol
  rev: v0.2.0
  hooks:
    - id: mcp-vol-scan
      args: ["./src", "--format", "text", "--fail-on", "error"]

3. Rust Library + rmcp v3.12 CI Gate & Sub-Millisecond Bm25Index

[dev-dependencies]
mcp-vol = { version = "0.1", features = ["rmcp"] }
use mcp_vol::prelude::*;

#[test]
fn rmcp_tools_pass_selection_audit() {
    let tools: Vec<rmcp::model::Tool> = my_server_tools();

    // 1. One-line deterministic 24-rule audit gate (panics with worst-tool-first RepairPlan)
    assert_rmcp_tools_clean(&tools);

    // 2. Or inspect report, RFC 6902 patches, and sub-millisecond Bm25Index routing accuracy
    let catalog = Catalog::from_rmcp(&tools);
    let report = audit_rmcp(&tools);
    let _patches = suggest_patches(&catalog, &report);

    let index = Bm25Index::build(&catalog);
    let suite = EvalSuite::from_json(include_str!("tool_evals.json")).unwrap();
    let eval = suite.run(&catalog, &index, 3);
    assert!(eval.top1_accuracy >= 0.90 && eval.ndcg_at_k >= 0.92, "{}", eval.to_markdown());
}

4. Register as an MCP Server for AI Coding Agents (Native Binary or Distroless Docker)

{
  "mcpServers": {
    "mcp-vol": {
      "command": "mcp-vol",
      "args": ["mcp"]
    }
  }
}

Without a global install, use "command": "npx", "args": ["-y", "mcp-vol", "mcp"] or "command": "uvx", "args": ["mcp-vol", "mcp"].

A minimal distroless Dockerfile (labeled with io.modelcontextprotocol.server.name="io.github.utkuvolkanuzunhan/mcp-vol") is also included for containerized agent runtimes.

Exposed MCP tools (7 read-only, deterministic, zero-network tools with full outputSchema, self-audited at 5.00/5.00 Tier A):

  • audit_mcp_tools — Full VOL001–VOL024 audit + 1–5 dimension scores + token/USD cost + fix_hints
  • generate_repair_plan — Compact worst-tool-first repair checklist for agent loops
  • suggest_tool_patches — Deterministic RFC 6902 JSON Patch proposals (VOL006, VOL007, VOL016, VOL017, VOL018, VOL020, VOL021)
  • detect_tool_collisions — Pairwise similarity matrix & TDQS shadowing analysis
  • compose_mcp_catalogs — Multi-server token/USD share, cross-server duplicates/overlaps, <server>_ namespace simulation & deferral recommendations
  • benchmark_tool_routing — Pre-indexed bm25, tfidf, or hybrid RRF routing accuracy, NDCG@k & confusion pairs
  • get_vol_rule_catalog — Static metadata for all 24 rules

5. Show the Score in Your README (Optional Badge)

mcp-vol badge prints a badge for the same sources as check, plus --scan <path> or --report report.json (an existing check --format json report). It only formats text: nothing is sent anywhere.

mcp-vol badge --scan ./src
# [![mcp-vol: 4.78/5 (A)](https://img.shields.io/badge/mcp--vol-4.78%2F5%20%28A%29-brightgreen)](https://github.com/utkuvolkanuzunhan/MCP-vol)

Paste the printed line into your README. Other formats:

  • --format svg > docs/mcp-vol.svg writes a self-contained SVG, for READMEs that should not load images from shields.io.
  • --format json > docs/mcp-vol.json writes a shields.io endpoint document, so a CI job can refresh the score and the badge follows https://img.shields.io/endpoint?url=<raw URL of the file>.
  • --label changes the left-hand text and --link the link target (for example your own CI run).

Using the badge in a public project? You can add it to USED_BY.md with a pull request. Entirely optional.


Built-In Rules (VOL001–VOL024)

CodeDimensionDefaultSlugWhat It Catches
VOL001Purpose Clarityerrormissing-descriptionMissing or blank tool description (caps Purpose to 1.0)
VOL002Purpose Clarityerrortautological-descriptionDescription merely restates tool name/title
VOL003Purpose Claritywarnvague-action-verbOpens with vague boilerplate (handles, manages, helper for)
VOL004Usage Guidelineswarnmissing-usage-cueMulti-tool catalog (≥5 tools) missing when-to-use / exclusion cue
VOL005Usage Guidelineswarnmissing-sibling-disambiguationOverlapping siblings do not name each other to mark boundaries
VOL006Behavioral Transparencyerrorannotation-contradictionToolAnnotations contradict tool name/prose (caps Behavior to 1.0)
VOL007Behavioral Transparencywarnmissing-behavior-annotationsOmits readOnlyHint / destructiveHint / idempotentHint / openWorldHint
VOL008Behavioral Transparencywarnundisclosed-side-effect-or-limitMutating or open-world tool omits side-effect, auth, or limit disclosure
VOL009Parameter Semanticserrorundocumented-schema-parameterParameter (including nested objects, array items, and $refs) omits description
VOL010Parameter Semanticswarnunconstrained-string-enumClosed-set parameter (status, mode, format, sort) has no enum/pattern
VOL011Parameter Semanticswarnopaque-parameter-or-formatOpaque param name (data, value, arg) or unspecified date/regex format
VOL012Concisenesswarntoken-budget-exceededTool description (>250 tok) or full catalog (>15k tok) exceeds budget
VOL013Concisenessinfoschema-prose-duplicationProse duplicates parameter lists already documented in inputSchema
VOL014Contextual Completenesserrortool-intent-collisionDuplicate names or high semantic/name/param similarity (≥0.72)
VOL015Contextual Completenesswarnshadowed-tool-asymmetryLow-argument sibling shadows a heavier filtered sibling (TDQS cost ratio)
VOL016Contextual Completenesswarnempty-or-untyped-output-schemaDeclared outputSchema is an empty {"type":"object"} stub
VOL017Contextual Completenesswarninconsistent-naming-conventionViolates MCP SEP-986 charset or mixes snake_case/camelCase/kebab-case
VOL018Behavioral Transparencywarnunbounded-list-or-searchList/search/query tool lacks pagination/limit param and states no result cap
VOL019Behavioral Transparencyerrorcoercive-routing-or-hidden-directiveHidden zero-width/BiDi Unicode, XML/HTML directives, or coercive routing overrides (caps Behavior to 1.0)
VOL020Parameter Semanticserrorincompatible-or-broken-input-schemaNon-object root inputSchema, root oneOf/anyOf/allOf, or external/unresolvable $ref
VOL021Parameter Semanticserrorunsatisfiable-schema-constraintrequired references undeclared property, empty enum: [], or inverted min/max bounds
VOL022Contextual Completenesswarnduplicate-or-placeholder-descriptionUnfinished TODO/TBD/{{template}} placeholders or verbatim duplicate descriptions across distinct tools
VOL023Concisenesswarnexcessive-schema-complexityOver-complex inputSchema (>12 parameters or >4 nesting depth) harming model argument accuracy
VOL024Behavioral Transparencyinfomissing-return-contractTool declares neither a typed outputSchema nor a prose return/output contract

Run mcp-vol rules --format json to inspect the full machine-readable rule registry.

A field that is open on purpose. VOL010 is a name heuristic (warn, never fails the default --fail-on error gate). When a closed-sounding parameter such as provider or type is deliberately free text, either give it a pattern that states the accepted shape (e.g. ^[a-z0-9_]+$, which also tells the model what to send), or turn the rule off for the repository with "disabled_rules": ["VOL010"] in .mcp-vol.json. Rules are switched off per repository, not per field.


Pluggable Ranker Trait & Pre-Indexed Bm25Index

mcp-vol ships with four zero-dependency rankers (Bm25Index precomputed inverted index, stateless Bm25Ranker, TfIdfRanker, and Reciprocal Rank Fusion HybridRanker), and exposes a single-method trait (annotated with #[diagnostic::on_unimplemented]) so you can benchmark any embedding model, rmcp::tool_search index, or LLM router against the exact same EvalSuite with compare_rankers:

pub trait Ranker: Send + Sync {
    fn rank(&self, query: &str, catalog: &Catalog, top_k: usize) -> Vec<RankedTool>;
}

Local embeddings example: examples/fastembed-ranker is a standalone crate (not a workspace member, so fastembed / ONNX Runtime never enter mcp-vol's dependency tree) that implements Ranker with fastembed (bge-small-en-v1.5) plus a BM25 + embedding RRF fusion, and prints a side-by-side compare_rankers table:

cd examples/fastembed-ranker
cargo run --release -- ../../benchmarks/catalogs/filesystem.json ../../benchmarks/evals/filesystem_eval.json

Architecture & Minimal Dependencies

  • crates/mcp-vol (core library, #![deny(missing_docs)]): depends only on serde, serde_json, thiserror. Zero async runtime, zero HTTP client, zero LLM SDKs. Optional features: sarif (default, zero extra deps) and rmcp (rmcp 3.12, default-features = false).
  • Minimum Rust: library 1.82, CLI 1.85 (clap 4.6), library with the rmcp feature 1.88 (rmcp 3.12's own minimum).
  • crates/mcp-vol-cli (mcp-vol binary): adds only clap plus zero-dependency JSON-RPC 2.0 stdio (--stdio) and Streamable HTTP (--http, pure std::net::TcpStream with Mcp-Session-Id & SSE support; TLS only behind the opt-in https feature) clients and the 7-tool stdio MCP server (mcp-vol mcp).
  • crates/mcp-vol-wasm (unpublished): a C-ABI wrapper that compiles the core to wasm32-unknown-unknown for the browser playground (playground/, built with ./playground/build.sh). No wasm-bindgen, no extra dependencies beyond the core and serde_json.

Links, Contributing & Security

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features

License

Dual-licensed under either of Apache License, Version 2.0 or MIT License at your option.

CARGO
mcp-vol-cli
Install Command
cargo install mcp-vol-cli