assay-mcp-server
by Rul1an
README.md
<p align="center">
<h1 align="center">Assay</h1>
<p align="center">
<strong>Check MCP tool calls against a policy and review the decisions offline.</strong><br />
<span>Put Assay between your MCP client and a local stdio server. In enforcement mode, Assay checks each routed <code>tools/call</code> request before forwarding it. Its open evidence profile records decisions and, when available, observations of what happened next.</span>
</p>
<p align="center">
<a href="https://crates.io/crates/assay-cli"><img src="https://img.shields.io/crates/v/assay-cli.svg" alt="Crates.io"></a>
<a href="https://github.com/Rul1an/assay/actions/workflows/ci.yml"><img src="https://github.com/Rul1an/assay/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://github.com/Rul1an/assay/blob/main/LICENSE"><img src="https://img.shields.io/crates/l/assay-core.svg" alt="License"></a>
</p>
<p align="center">
<a href="#quickstart">Quickstart</a> ·
<a href="#enforcement-and-evidence">How it works</a> ·
<a href="#see-it-work">See it work</a> ·
<a href="examples/mcp-quickstart/">MCP example</a> ·
<a href="docs/security/OWASP-MCP-TOP10-MAPPING.md">OWASP MCP Top 10</a> ·
<a href="https://github.com/Rul1an/assay/discussions">Discussions</a>
</p>
</p>
---
Try the [MCP quickstart](examples/mcp-quickstart/) to see the decision for a read request sent to a local mock. The decision records permission to forward the call. A real file read would require separate evidence from the server or operating system.
**One golden path:** the [release-pinned agent journey](docs/guides/agent-golden-path.md) records the nine driven CLI/MCP steps and their exit/stdout contracts. Its protected-action fixture lives in [examples/privileged-action-gate/](examples/privileged-action-gate/).
### Enforcement and evidence
- **Enforce.** In enforcement mode, the gate decides `tools/call` requests routed through it before forwarding, with the precise reason for each allow or deny. Separate controls on supported Linux hosts include cgroup eBPF IPv4/TCP connect filtering (whose hook error path allows connections) and Landlock TCP-connect port allowlisting. `assay sandbox --enforce` refuses an unavailable backend or conflicting filesystem policy unless `--allow-audit-fallback` is explicit. `--enforce-net` requires `--enforce`; active Landlock network enforcement rejects policies it cannot express as TCP-port allowlists, even with audit fallback enabled.
- **Inspect.** Configured producers can export recorded decisions and observations in a bundle. Run `assay evidence verify` on a saved bundle to review the result. The privileged-action flow carries the verdict, pre-call establish journey, and declared-vs-observed conformance for CI review without a hosted backend. `assay mcp wrap --decision-log` records tool-call decisions; `assay evidence prepare-incident-package` turns that log into an incident package `verify-incident-package` accepts, with the surface grades the verifier derives. The package is not a count of all calls, not completeness of capture, not proof of what the server did, and an allow is not proof a human accepted.
- **Stay honest.** Trust Basis classifies supported claims as `verified`, `self_reported`, `inferred`, or `absent`; its gates check the declared claim boundaries. A tool returning "success" is the provider's assertion, never proof. Assay ships no single safety score; read each artifact’s source, coverage and non-claims before relying on it.
### Quickstart
Install the CLI on Linux or macOS:
```bash
curl -fsSL https://getassay.dev/install.sh | sh
assay --version
```
If you prefer to build from source, run `cargo install assay-cli --version 8.0.0 --locked`.
For installation diagnostics, run `assay doctor`.
From an empty directory, run a local demo:
```bash
assay demo
```
The demo creates rules in `assay-demo/assay.yaml` and a sample trace in
`assay-demo/traces.jsonl`. To try it with your coding agent, ask:
> Change the Calculate operation in the demo trace from `add` to `multiply`.
> Run the command below and explain which rule caught the change.
```bash
assay validate --config assay-demo/assay.yaml --trace-file assay-demo/traces.jsonl
```
The original trace passes. After the edit, validation exits with code 1 because
the rule allows only `add` and `subtract`.
To see a tool call go through the MCP gate, open a source checkout or an
extracted CLI archive and run:
```bash
python3 examples/mcp-quickstart/run.py
```
For v8.0.0, run the last command from a source checkout or an extracted published CLI archive.
The installer is binary-only and does not carry the bounded quickstart assets. The live
`getassay.dev` installer verifies the selected archive against its published SHA-256 sidecar before
extraction. Set `ASSAY_REQUIRE_PROVENANCE=1` to additionally require GitHub artifact provenance;
the default reports `provenance_not_requested` and strict success reports `provenance_verified`.
A checksum proves byte equality with the published sidecar, not producer identity. Provenance
identifies the source and build, not runtime safety or semantic correctness.
Captured runner output (the bundled local mock performs no external action):
```text
assay quickstart: PASS
mcp_requests=initialize,tools/list,tools/call
decision=allow tool=read_file
decision_artifact=.assay/quickstart/decisions.ndjson
non_claim=forwarded_to_local_mock_only
```

Released surfaces:
- Static project manifests are shipped for Claude Code and Cursor; Codex uses the equivalent TOML entry documented in the [editor MCP recipe](docs/guides/editor-mcp-recipe.md). Manifest presence is not host-discovery proof. `assay mcp config-path` supports Claude Desktop and Cursor only.
- Published v8.0.0 CLI archives cover Linux x86_64/arm64, macOS x86_64/arm64, and Windows x86_64. The Python wheels cover CPython 3.12, 3.13, and 3.14 on macOS x86_64/arm64 and Linux x86_64; other interpreters and platforms are not claimed.
- Published `assay-mcp-server` archives cover Linux x86_64/arm64. MCPB and `server.json` package descriptors are also published; their presence is not host-discovery proof.
- CI: [GitHub Action](https://github.com/marketplace/actions/assay-ai-agent-security). Core flows need no hosted backend or API key. New to the threat model? The [OWASP MCP Top 10 mapping](docs/security/OWASP-MCP-TOP10-MAPPING.md) states, per risk, what Assay covers and deliberately does not.
## What ships
| Output | What it is |
|--------|------------|
| **Policy gate** | `assay mcp wrap` — deterministic allow/deny before tools run, with the reason. |
| **Evidence bundle** | Offline-verifiable, tamper-evident archive for audit and replay. |
| **Trust Basis / Trust Card** | Canonical `trust-basis.json` (bounded claim classification) plus review-friendly `trustcard.{json,md,html}`. |
| **External receipts** | Eval outcomes, runtime decisions, and model inventory as bounded receipts with JSON Schema contracts. |
| **Tool-decision logs** | For handled known-tool calls, the `assay-mcp-server` stdio server emits an info-level `tool_decision` event when enabled by its log filter; `decision` contains a JSON-encoded observed decision entry with projected target fields. |
| **SARIF / CI** | GitHub Action, Security-tab integration, policy gates on PRs. |
| **Attestation** | Sign an evidence bundle as a DSSE-wrapped in-toto v1 Statement with the evidence-bundle/v1 predicate. |
```text
Agent ──► Assay ──► MCP Server
├─ ✅ ALLOW / ❌ DENY (policy, with reason)
├─► 📋 Evidence bundle (offline-verifiable)
└─► 📊 Trust Basis → Trust Card → SARIF / CI
```
Install pin: [`v8.0.0`](https://github.com/Rul1an/assay/releases/tag/v8.0.0). [CHANGELOG.md](CHANGELOG.md) and release notes remain the authority for released behavior; the install pin advances after publication checks.
Launch definition and support commitment: [docs/LAUNCH.md](docs/LAUNCH.md).
## Is this for me?
**Yes** if you already have eval output, runtime decisions, inventory artifacts, or MCP tool-call tests, and you want a small reviewable CI artifact instead of a dashboard — bounded auditability, not a scalar trust badge.
**Not yet** if you need Assay to judge model correctness for you, want a hosted dashboard as the product, or want a compliance claim rather than a bounded evidence boundary. Assay is not a trust-score engine, a generic eval dashboard, or a hosted observability product — see [what it is and is not](docs/concepts/scope.md).
## See it work
An agent tries a privileged action — `github.add_deploy_key` — through the enforcing proxy, decided per call **before it forwards**, offline against a local mock (no real credentials):
```bash
cd examples/privileged-action-gate && ./run.sh
```

A deny is fail-closed caution, not a verdict on intent; an allow is the decision to forward, never proof the action happened. Declared-vs-observed conformance is recorded **beside** the verdict, never as a gate. Full walkthrough: [privileged-action-gate](examples/privileged-action-gate/).
## Pick your path
| You have | What you get | Start here |
|---|---|---|
| Promptfoo JSONL from CI evals | Eval outcome receipts + verified bundle + Trust Basis diff | [Promptfoo JSONL](docs/use-cases/evidence-receipts-from-promptfoo-jsonl.md) |
| OpenFeature `EvaluationDetails` | Decision receipt + verified bundle | [OpenFeature](docs/use-cases/openfeature-evaluationdetails-to-ci-review-artifact.md) |
| CycloneDX ML-BOM model component | Inventory receipt + verified bundle | [CycloneDX ML-BOM](docs/use-cases/cyclonedx-mlbom-model-to-inventory-receipt.md) |
| MCP tool calls | Allow/deny audit trail + observed-behavior evidence | [MCP Quick Start](examples/mcp-quickstart/) |
| A GitHub PR gate | Trust Basis diff, gate status, SARIF/JUnit-ready output | [CI Guide](docs/guides/github-action.md) |
| A Runner archive / coverage annotation | Coverage descriptors + claim-class cells + a claimed-vs-observed check | [Coverage-honesty walkthrough](examples/coverage-honesty-walkthrough/) |
The workflow stays small: import or record a bounded outcome, bundle and verify it, compile `trust-basis.json`, gate the Trust Basis diff. Assay doesn't make the upstream tool the source of truth; it makes the evidence boundary inspectable. For privileged tool actions, the MCP proxy records each `tools/call` as a structured [tool-decision surface](docs/reference/tool-decision-surface.md) — keeping the asserted-versus-verified line honest.
## Policy is simple
This policy allows the time tool. Other tool names are denied.
```yaml
version: "2.0"
name: "my-policy"
tools:
allow: ["get_time"]
```
For a filesystem example, generate the hardened preset with `assay init --preset hardened`.
The server opening files must enforce its permitted directories after resolving paths.
`assay init --from-trace trace.jsonl` generates the runtime-observation policy used by the trace-generation flow (`files`, `network`, and `processes`); it is not an MCP authorization policy. Migrate a legacy MCP `constraints:` policy with `assay policy migrate`. See [Policy Files](docs/reference/config/policies.md).
## Why Assay
| | |
|---|---|
| **Canonical evidence** | Assay's evidence model is the stable contract; OpenTelemetry and protocol adapters (ACP / A2A projection profile / UCP) map into it. |
| **Deterministic** | The policy gate uses explicit rules; its decision depends on the request, policy and applicable session state. This does not make live evaluators or external effects deterministic. |
| **Bounded claims** | Explicit about **verified** vs **visible** vs **absent** — no score-first UX. |
| **Offline-first** | No backend required for core enforcement and bundle verification. |
| **Checkable provenance** | Which piece of the source-class and coverage model shipped when, as commits you can `git log` rather than claims you have to take — [provenance](docs/PROVENANCE-SOURCE-CLASS.md), prior art credited first. |
## Learn more
- [MCP Quickstart](examples/mcp-quickstart/) · [Editor MCP recipe](docs/guides/editor-mcp-recipe.md) — policy-enforcing MCP in Cursor / Claude Code / Codex
- [MCP 2025/2026 protocol-era parity](https://docs.getassay.dev/mcp/protocol-era-parity/) — pinned `resultType` and interim-result compatibility corpus
- [Coding-agent governance](docs/guides/coding-agent-governance.md) · [OpenTelemetry & Langfuse](docs/guides/otel-langfuse.md) — observed runs → evidence
- [Evidence Receipts in Action](docs/notes/EVIDENCE-RECEIPTS-IN-ACTION.md) — Promptfoo / OpenFeature / CycloneDX receipt families
- [CI Guide](docs/guides/github-action.md) · [Evidence Store](docs/guides/evidence-store-aws-s3.md) (S3 / B2 / MinIO)
- [OWASP MCP Top 10 mapping](docs/security/OWASP-MCP-TOP10-MAPPING.md) · [Security experiments](docs/architecture/SYNTHESIS-TRUST-CHAIN-TRIFECTA-2026q2.md)
- Positioning: [ADR-033](docs/architecture/ADR-033-OTel-Trust-Compiler-Positioning.md) · [RFC-005](docs/architecture/RFC-005-trust-compiler-mvp-2026q2.md)
<details>
<summary>Evidence epistemology, latency, and the internal Runner</summary>
Trust claims use explicit epistemology, not a single safety score: `verified` (direct evidence or offline verification), `self_reported` (emitted without independent corroboration), `inferred` (bounded, documented rules), `absent` (no trustworthy evidence). Assay ships no aggregate trust score or `safe/unsafe` badge as the main output — see [ADR-033](docs/architecture/ADR-033-OTel-Trust-Compiler-Positioning.md).
The historical fragmented-IPI [experiment results](docs/ops/EXPERIMENT-MCP-FRAGMENTED-IPI-2026Q1-RESULTS.md), dated 2026-03-02 and naming commit `289a43ecc144`, report `0.771ms` p50 / `1.913ms` p95 for the deterministic set. The harness times complete local mock `tools/call` round trips, including JSON-RPC transport and the tool response. These reported timings do not isolate policy-decision overhead or establish current-release or end-to-end model performance.
[Assay-Runner](docs/reference/runner/index.md) is an internal/experimental measured-run subsystem behind the delegated Linux/eBPF acceptance path. Its crates are included in the workspace publication process so dependent packages can resolve them; publication does not make Runner a standalone product or give its APIs a separate stability commitment.
</details>
## Ecosystem
Related projects for evidence generation, verification, and reviewability; each has its own interface and scope:
- [assay-action](https://github.com/Rul1an/assay-action) — GitHub Action: verify bundles, PR summaries, SARIF ([Marketplace](https://github.com/marketplace/actions/assay-ai-agent-security)).
- [Assay-Harness](https://github.com/Rul1an/Assay-Harness) — recipe, gate, and report layer over canonical evidence artifacts.
- [observed-effect-v0](https://github.com/Rul1an/observed-effect-v0) — worked examples of the bounded observed-effect evidence record and its neutral carriers (in-toto, SCITT, MCP evidenceRef).
- [gateway-evidence-replay](https://github.com/Rul1an/gateway-evidence-replay) — deterministic offline replay verifier for gateway-path evidence bundles.
- [RGE-Bench](https://github.com/rge-bench/rge-bench) — a conformance kit for evidence reviewability, maintained separately under its own machine-checked neutrality guard. Reproduction there is **digest-scoped and does not carry forward**: the v1 71-vector digest `sha256:e769822bc6c9e31085da7b1a17b163b9747fe0d04314fbb8685d4e612087c7cb` and the historical v2 digest `sha256:ba0e3795d75c788fa48313ab462493f22d78759851d1b3275d8117051bb22fd0` (95 vectors) each carry one reported **independent implementation** by a second author on a different stack. JM-Lab reported the v2 95/95 reproduction on 2026-08-24, from the contract text and author-supplied inputs without reading `expected`. Neither reproduction transfers to the current 104-vector v3 candidate digest `sha256:93f8ae9654eb5a16dee28d882087669cae5183e02e116ba1e8071a30594cfb6a`, which the record lists as unreproduced. See its [REPRODUCTIONS.md](https://github.com/rge-bench/rge-bench/blob/main/REPRODUCTIONS.md).
## Open profile: privileged-mcp-action/v0
[`privileged-mcp-action/v0`](docs/profiles/privileged-mcp-action/v0.md)
is a composition and verification contract over evidence records that already exist: what a
privileged MCP tool call decided, what was observed of its effect, and what stays unproven. It adds
no new envelope and no aggregate verdict.
It ships with a [14-vector conformance corpus](conformance/privileged-mcp-action-v0)
(5 accept, 9 reject) whose digest is a **candidate**: it is not called reproduced until a non-author
implementation derives the expected outcomes from the specification text alone.
**That reproduction is open, and the invitation is real:
[#1840](https://github.com/Rul1an/assay/issues/1840).** Any language, any stack. The invitation
names the exact commit the current digest describes. The
[clean-room protocol](conformance/privileged-mcp-action-v0/CONFORMANCE-PROTOCOL.md) provides an
opaque, attested inputs pack, a one-command scoring action, and an implementation-report template
without supplying verifier logic or expected outcomes. The
[corpus README](conformance/privileged-mcp-action-v0/README.md) states the authorship boundary and
the claim ceiling.
## Contributing
```bash
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
```
See [CONTRIBUTING.md](CONTRIBUTING.md) and [GitHub Discussions](https://github.com/Rul1an/assay/discussions).
## License
[MIT](LICENSE)
TDQS
B3.1/5.0
Scored across 5 tools
Disambiguation5/5
Each tool targets a distinct aspect of policy analysis: argument validation, coverage, sequence validation, trace explanation, and policy decision. No overlap in purpose.
Naming Consistency5/5
All tools follow the consistent pattern 'assay_<verb>_<noun>', using snake_case throughout. The prefix 'assay_' unifies the set.
Tool Count5/5
Five tools is a well-scoped set for a policy analysis server. Each tool serves a clear role without redundancy, covering the core operations.
Completeness4/5
The tools cover essential policy checking operations (validate args, check coverage, sequence validation, explain traces, decide policy). Missing a tool to list or retrieve policies, but the set is otherwise solid for its domain.
Maintenance
ActivityActive
ResponsivenessUsually handled