mcp-vol 0.1.0

Zero-LLM, deterministic MCP tool linter (24 rules), static Rust/TS/Python scanner, multi-server composer, RFC 6902 patcher, and pre-indexed BM25 eval harness for rmcp and AI agents.
Documentation

mcp-vol — Deterministic MCP Tool Volatility & Selection Auditor

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

Zero-LLM, sub-millisecond MCP tool linter (24 rules VOL001–VOL024), zero-build static Rust/TypeScript/Python source scanner with SARIF file:line:column annotations, multi-server stack composer, mechanical RFC 6902 auto-fixer, prompt-cache drift detector, and pre-indexed 39.6 µs/query BM25 / hybrid tool-selection eval harness — engineered from the ground up for AI coding agents and Rust (rmcp) CI gates.

$ 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.
  fix: Set annotations.read_only_hint = Some(false) on 'delete_index' (and destructive_hint appropriately)...
[ERROR] VOL009 (undocumented-schema-parameter) find_docs
  Tool 'find_docs' has 1 parameter(s) missing JSON Schema `description`: query.
  fix: Add a non-empty `description` in inputSchema for: query.
[WARN] VOL005 (missing-sibling-disambiguation) find_docs <-> search
  Overlapping siblings 'find_docs' and 'search' (similarity=0.61) do not cross-reference each other.

$ mcp-vol compose --server github=benchmarks/catalogs/github.json --server gitlab=benchmarks/catalogs/gitlab.json --format text
mcp-vol compose: 2 servers | 35 tools | score 3.13/5.00 (Tier C) | ~4146 tokens (~$2.49/200t uncached, ~$0.26 cached)
cross-server collisions: 8 exact duplicate(s), 3 semantic overlap(s) | if namespaced: score 3.46/5.00 (0 exact duplicates)

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 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), and Python (FastMCP / Field) 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 ...), local Streamable HTTP (--http) + 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 Server Tools Score Tier Worst Tool Est. Tokens Est. $/200t Errors Warnings Info Key Verified Findings
mcp-vol mcp (self-audit) 7 5.00 A 5.00 2,772 $1.66 0 0 0 Continuous CI gate (--fail-on info)
time (2026 ref) 3 4.92 A 4.85 347 $0.21 0 1 0 VOL015 (1 shadowing pair)
sequentialthinking (2026) 1 4.85 A 4.85 530 $0.32 0 1 0 VOL012 (~253 tokens, right at 250-token cap)
filesystem (2026 ref) 16 4.58 A 4.33 3,391 $2.03 0 18 0 VOL004 (13), VOL015 (1), VOL018 (3 unbounded lists)
memory (2026 ref) 9 4.47 B 4.18 1,819 $1.09 0 13 0 VOL004 (6), VOL008 (4), VOL010 (3)
slack 8 4.21 B 3.95 780 $0.47 0 21 0 VOL005 (get_users ↔ get_user_profile, sim 0.63), VOL011 (timestamp)
puppeteer 7 4.12 B 3.88 614 $0.37 0 20 4 VOL007 (7), VOL008 (4), VOL011, VOL024 (4 opaque actions)
postgres 1 4.05 B 4.05 33 $0.02 1 2 0 VOL009 (sql lacks description), VOL007, VOL018
google-maps 7 4.04 B 3.60 661 $0.40 2 17 1 VOL009 nested locations[].latitude/longitude, VOL018, VOL024
git (2026 ref) 14 3.97 B 3.68 1,435 $0.86 12 24 1 VOL009 (12 tools omit param descriptions), VOL005, VOL024
gitlab 9 3.87 B 3.68 1,017 $0.61 7 23 2 VOL009 (7), VOL007 (9), VOL008 (5), VOL024 (2)
github 26 3.60 B 2.83 3,129 $1.88 15 87 0 VOL002 (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

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

# Instant prebuilt binary via cargo-binstall (or compile via `cargo install mcp-vol-cli`)
cargo binstall mcp-vol-cli

# 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), and Python (FastMCP)
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

# 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

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.1.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

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"]
    }
  }
}

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

Built-In Rules (VOL001–VOL024)

Code Dimension Default Slug What It Catches
VOL001 Purpose Clarity error missing-description Missing or blank tool description (caps Purpose to 1.0)
VOL002 Purpose Clarity error tautological-description Description merely restates tool name/title
VOL003 Purpose Clarity warn vague-action-verb Opens with vague boilerplate (handles, manages, helper for)
VOL004 Usage Guidelines warn missing-usage-cue Multi-tool catalog (≥5 tools) missing when-to-use / exclusion cue
VOL005 Usage Guidelines warn missing-sibling-disambiguation Overlapping siblings do not name each other to mark boundaries
VOL006 Behavioral Transparency error annotation-contradiction ToolAnnotations contradict tool name/prose (caps Behavior to 1.0)
VOL007 Behavioral Transparency warn missing-behavior-annotations Omits readOnlyHint / destructiveHint / idempotentHint / openWorldHint
VOL008 Behavioral Transparency warn undisclosed-side-effect-or-limit Mutating or open-world tool omits side-effect, auth, or limit disclosure
VOL009 Parameter Semantics error undocumented-schema-parameter Parameter (including nested objects, array items, and $refs) omits description
VOL010 Parameter Semantics warn unconstrained-string-enum Closed-set parameter (status, mode, format, sort) has no enum/pattern
VOL011 Parameter Semantics warn opaque-parameter-or-format Opaque param name (data, value, arg) or unspecified date/regex format
VOL012 Conciseness warn token-budget-exceeded Tool description (>250 tok) or full catalog (>15k tok) exceeds budget
VOL013 Conciseness info schema-prose-duplication Prose duplicates parameter lists already documented in inputSchema
VOL014 Contextual Completeness error tool-intent-collision Duplicate names or high semantic/name/param similarity (≥0.72)
VOL015 Contextual Completeness warn shadowed-tool-asymmetry Low-argument sibling shadows a heavier filtered sibling (TDQS cost ratio)
VOL016 Contextual Completeness warn empty-or-untyped-output-schema Declared outputSchema is an empty {"type":"object"} stub
VOL017 Contextual Completeness warn inconsistent-naming-convention Violates MCP SEP-986 charset or mixes snake_case/camelCase/kebab-case
VOL018 Behavioral Transparency warn unbounded-list-or-search List/search/query tool lacks pagination/limit param and states no result cap
VOL019 Behavioral Transparency error coercive-routing-or-hidden-directive Hidden zero-width/BiDi Unicode, XML/HTML directives, or coercive routing overrides (caps Behavior to 1.0)
VOL020 Parameter Semantics error incompatible-or-broken-input-schema Non-object root inputSchema, root oneOf/anyOf/allOf, or external/unresolvable $ref
VOL021 Parameter Semantics error unsatisfiable-schema-constraint required references undeclared property, empty enum: [], or inverted min/max bounds
VOL022 Contextual Completeness warn duplicate-or-placeholder-description Unfinished TODO/TBD/{{template}} placeholders or verbatim duplicate descriptions across distinct tools
VOL023 Conciseness warn excessive-schema-complexity Over-complex inputSchema (>12 parameters or >4 nesting depth) harming model argument accuracy
VOL024 Behavioral Transparency info missing-return-contract Tool 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.


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>;
}

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).
  • crates/mcp-vol-cli (mcp-vol binary): adds only clap plus zero-dependency JSON-RPC 2.0 stdio (--stdio) and local Streamable HTTP (--http, pure std::net::TcpStream with Mcp-Session-Id & SSE support) clients and the 7-tool stdio MCP server (mcp-vol mcp).

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.