mcpval-localmcp

v3.3.0
mcpval-localmcp Checked 1 day ago Published 1 day ago

Local MCP server that wraps the mcpval CLI — validate MCP servers from any AI agent

This codebase targets the 3.x release family. Upgrade the CLI and local MCP wrapper together. The current canonical assurance-result schema is 3.8.0; consumers must handle unavailable measurements as null and use recorded artifact paths rather than assume a flat output directory. Historical 2.x results remain readable through the documented migration path. See schema compatibility and available releases; local qualification does not establish publication. Or download a self-contained executable from Releases if you do not want a local .NET runtime.

Summary extracted from the README.

MCP Validator Logo

MCP Validator (mcpval)

CI OpenSSF Scorecard .NET 8 License: MIT NuGet npm

Assess an MCP server's protocol conformance, security posture, AI-facing risks and operational readiness using recorded evidence. MCP Validator produces separate assessments and shareable artifacts; missing evidence is not a pass, and an assessment is not a guarantee that a server is safe.

Distribution Channels

Need Public surface What it publishes
Install the CLI NuGet (McpVal) Cross-platform dotnet tool install package
Run as a local MCP server npm (mcpval-localmcp) Local MCP wrapper for desktop and agent tooling
Run in a container GHCR (ghcr.io/navalerakesh/mcp-validation-security) Container image
Download without a runtime GitHub Releases Standalone binaries, checksums, and SBOMs
Use in a workflow GitHub Marketplace Listing for the root composite action only; it does not replace the NuGet, npm, GHCR, or release-binary publishes

MCP Validator

Install

Upgrading from 2.x

This codebase targets the 3.x release family. Upgrade the CLI and local MCP wrapper together. The current canonical assurance-result schema is 3.8.0; consumers must handle unavailable measurements as null and use recorded artifact paths rather than assume a flat output directory. Historical 2.x results remain readable through the documented migration path. See schema compatibility and available releases; local qualification does not establish publication.

Breaking changes: Before upgrading automation, follow the 3.0 upgrade checklist, including comprehensive admission, strict configuration and artifact-path changes.

Install from NuGet:

dotnet tool install --global McpVal
mcpval --help

Or download a self-contained executable from Releases if you do not want a local .NET runtime.

For container-based environments:

docker run --rm ghcr.io/navalerakesh/mcp-validation-security:latest --help

Each GitHub release includes SHA-256 checksums plus an SPDX SBOM for the standalone binaries. NuGet, npm, and GHCR publishes include provenance and SBOM metadata.

Run Your First Validation

Start with explicit Safe inventory. The current comprehensive default requires admitted execution, pinned official conformance evidence, and the approved signed identity security baseline. Missing prerequisites fail before target contact; see comprehensive admission.

Inventory a remote MCP endpoint:

mcpval validate \
  --server https://example.test/mcp \
  --access public \
  --assurance inventory \
  --output ./mcp-reports

Validate an authenticated server and interpret the result for all documented client profiles:

mcpval validate \
  --server https://example.test/mcp \
  --access authenticated \
  --assurance inventory \
  --token "$MCP_TOKEN" \
  --output ./mcp-reports

Validate a local STDIO server:

mcpval validate \
  --server "npx -y @modelcontextprotocol/server-everything" \
  --access public \
  --assurance inventory \
  --output ./mcp-reports

validate and health-check support STDIO targets today. discover is currently HTTP-first and returns a clear not-supported error when pointed at a STDIO command.

CLI Surface

validate

Runs the full suite across protocol, tools, prompts, resources, security, and performance.

Option Description
-s, --server <url-or-command> MCP endpoint or STDIO command. Required unless supplied through config.
-o, --output <folder> Writes Markdown, HTML, JSON, and SARIF artifacts for the run.
--mcpspec <profile> Selects the embedded protocol profile, such as latest, 2026-07-28, or a supported historical revision. latest resolves visibly in the execution plan.
--access <public|authenticated|enterprise> Declares the intended exposure model so auth expectations are evaluated correctly.
--policy <advisory|balanced|strict> Applies host-side gating without mutating raw findings.
--assurance <comprehensive|inventory|ci|provider|native> Selects evidence requirements; comprehensive remains the default. The unreleased native contract provides explicitly admitted, non-certifying selected-scope diagnostics without requiring official conformance inputs.
--identity-baseline <selection.json> Supplies the approved signed identity controls, independently selected contract and observer public key. Required for comprehensive execution.
--validation-id <id> Supplies an independently reserved run ID; signed baseline evidence must match it. Otherwise the CLI generates the run ID.
--baseline <result.json> Compares this run with a compatible prior canonical result.
--conformance-results <wrapper.json> Imports a bounded, provenance-bearing wrapper for the pinned official conformance runner. External evidence remains separately attributable and affects only applicable claims.
--provider-harness <manifest.json> Supplies a signed set of prior repeated-run receipts bound to the target, protocol revision, and dry-run execution-plan digest. Provider assurance requires this input.
--provider-authorization-key <public-key.pem> Verifies both the authorization grant and harness manifest against an operator-trusted ECDSA P-256 public key. Signatures use SHA-256 with fixed-width P1363 encoding.
--extension <id> Explicitly selects an MCP extension. Repeat for more than one. Passive advertised-extension checks run automatically; active Skills content reads additionally require this option and standard/elevated mode.
--regression-only Blocks only new non-success claims or independent-assessment degradation relative to --baseline; execution failures still block.
--output-format <human|json> Emits human output or one versioned JSON stdout envelope with typed JSON stderr errors.
--sign-attestation Signs the final canonical JSON bytes using the ECDSA P-256 key in MCPVAL_ATTESTATION_PRIVATE_KEY_PEM; requires --output.
--client-profile <id> Narrows host-specific compatibility interpretation to profiles such as claude-code, vscode-copilot-agent, github-copilot-cli, github-copilot-cloud-agent, visual-studio-copilot, or all. When omitted, validate evaluates every documented host profile by default.
--mode <safe|standard|elevated> Applies the execution contract for the run. safe is the default.
--dry-run Prints the execution plan and exits without contacting the target.
--allow-host <host> Restricts outbound requests to specific hosts. Repeat to permit more than one host.
--allow-origin <origin> Restricts requests to exact HTTP origins, including scheme and effective port. Repeat for auxiliary origins.
--protocol-era <auto|legacy|modern> Selects negotiation policy. Explicit eras reject incompatible negotiated versions.
--allow-private-addresses Opts into loopback or private-address targets.
--max-requests <n> Caps the total outbound request budget for the run.
--timeout <seconds> Sets the per-request timeout budget used by the CLI transport layer.
--persistence-mode <ephemeral|explicit-output|session> Controls whether operational artifacts stay ephemeral, go only to the explicit output directory, or are persisted under a session directory.
--redact-level <strict|standard> Controls operational redaction for logs and companion artifacts.
--trace <off|redacted|full> Declares the trace capture mode for the run.
--confirm-elevated-risk Required acknowledgement for --mode elevated.
--enable-model-eval Emits a separate advisory model-evaluation companion artifact when an explicit supported provider is configured.
-t, --token <value> Supplies a bearer token for secured endpoints.
-i, --interactive Starts an interactive authentication flow when a strategy supports it.

| --max-concurrency <n> | Caps concurrent activity to avoid rate limits or server overload. Remote functional probes may still self-calibrate below this cap so transient throttling does not become a false protocol or tool failure. | | -c, --config <file> | Loads a JSON McpValidatorConfiguration for advanced scenarios. | | --report-detail <full|minimal> | Controls human report depth. full is the default and includes all sections with compact summaries; minimal keeps the executive view. | | -v, --verbose | Increases console and diagnostic logging detail. |

Public artifact schemas are published under docs/Schemas, with compatibility rules in docs/SchemaCompatibility.md. Audit manifests include SHA-256 digests for the validator, redacted config, target identity, rule/profile catalogs, imported external evidence, and final bytes of every listed subject artifact; the manifest intentionally excludes itself from that non-recursive list. See docs/OfficialConformanceAndExtensions.md for the wrapper contract and extension execution boundaries.

For automation, prefer the MCPVAL_TOKEN environment variable over --token so the credential does not appear in process arguments. An explicit --token value takes precedence. The GitHub Action uses the masked environment-variable path.

safe mode is discovery and static analysis only. It lists capabilities, tools, resources, and prompts, but does not invoke tools, read resources, render prompts with arguments, send malformed protocol messages, run attack simulations, or generate load. Reports preserve those unperformed dimensions as incomplete evidence, and the inventory profile never issues a provider certificate. Use standard only against an authorized test target when active conformance evidence is required; use elevated only with explicit risk acknowledgement.

Modern server/discover runs automatically inspect advertised Apps and Skills settings. Apps passive linkage checks run in safe mode; linked UI resource reads and bounded HTML/CSP analysis require standard/elevated mode. Skills catalog analysis remains Preview; SKILL.md reads require both standard/elevated mode and --extension io.modelcontextprotocol/skills. The validator never renders Apps HTML or executes skill instructions/scripts.

Client profile evaluation is a host-side interpretation layer. It consumes the neutral validation evidence from the run without changing the underlying findings. validate includes that interpretation by default; use --client-profile only when you want a smaller subset of host profiles.

Execution plans show the requested profile, resolved embedded schema, and protocol era before contact. MCP 2026-07-28 is the modern, stateless era; 2025-11-25 and earlier are legacy, initialization-based revisions.

Remote targets are resolved before active execution and again for every new raw or SDK socket connection. The governed handler connects directly to an approved address, blocks private, local, mapped-private, reserved, mixed, and rebound answers unless explicitly authorized, disables ambient proxies and automatic redirects, and enforces exact origins. Use --allow-origin when an authorized auxiliary endpoint uses a different scheme or port.

The standard artifact set is:

  • mcp-validation-<timestamp>-report.md - full Markdown report with compact action hints
  • mcp-validation-<timestamp>-report.html - full HTML report for sharing
  • mcp-validation-<timestamp>-result.json - canonical machine-readable validation object
  • mcp-validation-<timestamp>-results.sarif.json - SARIF findings feed for CI and code scanning
  • mcp-validation-<timestamp>-results.junit.xml - JUnit suites by assurance dimension; incomplete evidence is skipped, never passed
  • mcp-validation-<timestamp>-audit.json - execution audit manifest for the run

When client profile evaluation is enabled, validate also writes mcp-validation-<timestamp>-profile-summary.json with per-profile compatible, warning, and incompatible counts.

The HTML report opens with profile-aware assessment framing, the exact tested scope, and independent core, security, and operational outcomes. Inventory is presented as a completed assessment with no certificate issued, not as a failed provider certification. Semantic color is limited to status chips and rails; the executive decision is expanded first, while detailed evidence and terminology use accessible progressive disclosure. Missing evidence produces an explicit incomplete assessment and never earns pass credit. See docs/Reporting.md.

When experimental model evaluation is enabled, validate writes mcp-validation-<timestamp>-model-evaluation.json as a separate companion artifact. The canonical *-result.json file remains deterministic and does not embed experimental model output. --enable-model-eval now fails fast when no provider is configured; this build currently includes the deterministic companion provider builtin-rubric.

Other Commands

  • mcpval health-check - fast connectivity probe with auth hints; uses server/discover for modern endpoints and initialize for legacy/STDIO endpoints
  • mcpval discover - capability snapshot for remote endpoints in JSON, YAML, or table form; supports the same --dry-run, host allowlist, and persistence controls as validate
  • mcpval report - offline rendering from a saved JSON result or Markdown report path into html, xml, sarif, or junit
  • mcpval --list-spec-profiles - list embedded protocol profiles supported by the current build

Example offline rendering:

mcpval report \
  --input ./mcp-reports/mcp-validation-20260421-031745-result.json \
  --format junit \
  --output ./mcp-reports/mcp-validation-20260421-031745.junit.xml

Use --report-detail minimal on either validate or report when you only want the executive view.

GitHub Actions

When mcpval runs inside GitHub Actions, it writes a step summary and emits workflow annotations automatically. The repository root also includes a reusable composite action.

Use a release tag instead of main. The release workflow publishes immutable v<major>.<minor>.<patch> tags and keeps v<major> plus v<major>.<minor> aliases current for the action entrypoint.

name: Validate MCP Server

on:
  pull_request:
  workflow_dispatch:

jobs:
  validate-mcp:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Validate MCP server
        uses: navalerakesh/mcp-validation-security@24fa211842973f112bc9d3f658b2ab5aef0243e9 # v3.0.0
        with:
          server: https://example.test/mcp
          access: authenticated
          token: ${{ secrets.MCP_TOKEN }}
          policy: strict
          assurance: ci
          output-dir: ./mcp-validation-results

The composite action installs the published McpVal tool, runs mcpval validate, writes the standard artifact set, and uploads the output directory by default.

Once a tagged release is published, the same root action can be listed in GitHub Marketplace from the release page. That Marketplace entry is only for the GitHub Action surface. The same release still publishes the CLI and companion artifacts to NuGet, npm, GHCR, and GitHub Releases.

Why Teams Use MCP Validator

  • Independent core conformance, security assurance, and operational readiness assessments
  • Explicit provider certificate eligibility that fails closed on missing evidence
  • Typed RFC 2119 claims that distinguish MUST, SHOULD, and MAY authority
  • AI safety analysis covering schema quality, destructive actions, exfiltration risk, and error quality for self-correcting agents
  • Governed active auth and security testing in authorized standard/provider runs; safe inventory reports active coverage as incomplete
  • Structured findings with stable rule IDs, remediation guidance, and machine-readable outputs for CI workflows
  • Shared evidence model that can be interpreted against documented client profiles without forking validator logic

Assurance Model

Every V2 run projects typed claims into independent core conformance, security assurance, operational readiness, extension readiness, and client compatibility assessments. Automation uses the selected policy and certificate eligibility, never a weighted global score. See docs/Design/V2AssuranceArchitecture.md and docs/V2BreakingChanges.md.

Architecture

MCP Validator follows a clean boundary model:

  • Mcp.Benchmark.Core holds neutral domain models and abstraction contracts.
  • Mcp.Benchmark.ClientProfiles maps neutral evidence onto documented host expectations.
  • Mcp.Benchmark.Infrastructure owns transport, auth, validators, scoring, and reporting.
  • Mcp.Benchmark.CLI is the composition root and command host.
  • Mcp.Compliance.Spec vendors protocol schemas and version metadata.

See docs/Design/Architecture.md for the high-level system view and docs/Design/TechnicalArchitecture.md for the internal lifecycle and extension points.

Build From Source

git clone https://github.com/navalerakesh/mcp-validation-security.git
cd mcp-validation-security
dotnet build
dotnet run --project Mcp.Benchmark.CLI -- --help

Documentation

Contributing

  • Follow the workflow in CONTRIBUTING.md.
  • Run dotnet test before opening a pull request.
  • Update the relevant user-facing documentation whenever product behavior changes.

License

Distributed under the MIT License.