Metadata-Version: 2.4
Name: vouch-mcp-signer
Version: 4.0.0
Summary: Model Context Protocol server that issues and verifies Vouch Protocol credentials to authorize AI agent tool calls.
Author: Ramprasad Gaddam
License: Apache-2.0
Project-URL: Homepage, https://vouch-protocol.org
Project-URL: Source, https://github.com/vouch-protocol/vouch
Keywords: mcp,vouch,ai-agents,verifiable-credentials,identity,eddsa-jcs-2022
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: vouch-protocol[mcp-signer]>=4.0.0

# vouch-mcp-signer

A Model Context Protocol (MCP) server that lets AI agents **issue and verify**
[Vouch](https://vouch-protocol.org) Credentials, so every action an agent takes
carries cryptographic proof of who authorized it.

MCP standardized how agents call tools. It does not say *who* is calling, or on
*whose authority*. `vouch-mcp-signer` adds that layer: every authorized action carries
a W3C Verifiable Credential with an `eddsa-jcs-2022` Data Integrity proof (or the
post-quantum hybrid profile), and any party can verify one over the same MCP
connection.

**The key stays out of the model.** MCP already runs this server in its own
process, so the agent's private key lives here, never in the LLM's context. A
prompt-injected model cannot exfiltrate a key it never holds.

## When to use this vs `vouch.autosign`

Vouch gives you two front doors onto one signing primitive:

- **`vouch.autosign`** (in-process, Python): wrap a tool with `sign_tools([...])`
  and every call is signed deterministically, before the tool runs, with no
  LLM cooperation. Best when your agent is Python and you want zero-effort,
  can't-forget signing.
- **`vouch-mcp-signer`** (this package): the out-of-process, cross-language path. Any
  MCP client in any language calls `sign` / `verify` over the
  wire, and the key is isolated in the server process. Best for non-Python
  agents, key isolation, or exposing verification as a shared service.

Both call the same `sign_intent` core, so credentials are identical either way.

## Install

```bash
pip install vouch-mcp-signer          # or: uvx vouch-mcp-signer
```

This pulls in `vouch-protocol[mcp-signer]`, including the official MCP SDK. If you
install `vouch-protocol` itself instead, add the extra: `pip install "vouch-protocol[mcp-signer]"`.
This package was called `vouch-mcp` before release 4.0.
The post-quantum profile is bundled, so there is nothing more to install for it.

## Configure

The server signs as the identity `vouch init -y` saved in `~/.vouch/keys`
(`vouch whoami` prints its DID), so for a local client there is no key to set.
To name another key, set `VOUCH_KEY` (a key file, `keyring:<did>`, or the key
itself) and `VOUCH_DID`.

Everything else it trusts and allows comes from one policy file,
`vouch-policy.json` (`--policy`, else `VOUCH_POLICY`, else `./vouch-policy.json`).
The server will not start without one. `vouch policy init` writes a starter,
and `vouch policy check` prints every problem in a file. A minimal one:

```json
{
  "version": 1,
  "trust": { "issuers": ["did:key:z6Mk..."] },
  "rules": [
    {
      "did": "did:key:z6Mk...",
      "allow": [{ "action": "read", "target": "calendar", "resource": "https://api.example.org/calendar" }]
    }
  ]
}
```

Put the DID from `vouch whoami` in place of the placeholder. When the rules
have no entry for the server's DID, it refuses to start and names that DID
(unless `signing.allowAnyAction` is set, for local development).

The same rules cover every tool that signs: `sign`, `delegate`,
`create_session`, `disclose_ai_origin` and `create_authority_state`. Each one
checks what it is about to sign against the rules for this server's DID:

| Tool | action | target | resource |
|---|---|---|---|
| `sign` | the action | the target | the resource |
| `delegate` | the action | the target | the resource, and `resource/**` (a grant covers what is under it): the rules need a rule ending in `**`, `resource/*` is not enough. With `to`, the rules must allow that DID the same action and target |
| `create_session` | `create_session` | `session` | the purpose |
| `disclose_ai_origin` | `disclose` | `content_ref` (or `ai-generated-content`) | the content hash |
| `create_authority_state` | `create_authority_state` | `authority-state` | `<subject DID>/<status>`, for example `did:web:example.com/*` for every status or `did:web:example.com/suspended` for suspending only |

Nothing they sign lasts longer than `signing.maxValidity` (default `1h`, at
most `12h`); a longer `valid_seconds` is refused, not shortened.

`verify` and `check_revocation` answer only for issuers this server trusts:
`trust.issuers`, `trust.keys`, the chain starting points in `trust.roots`, and
this server's own DID. Anything else is `UNTRUSTED ISSUER`, however valid its
signature.

`create_authority_state` takes an `authority_epoch` that is a whole number from 0
to 2**53 - 1. Once the server has published a state for a subject, the next epoch
for that subject must be greater than the last and at most the last plus
`freshness.authorityEpochMaxStep` (default 1). `create_session` needs a
`decay_lambda` above 0 and at most 1 (per second), and an `initial_trust` from 0
to 1. `delegate` refuses a `to` that is not a DID.

The server keeps the last epoch in `$VOUCH_DIR/mcp/authority-epochs.json`
(`$VOUCH_DIR` is `~/.vouch` by default), so it survives a restart. It creates
the folder owner-only and will not start when the folder or the record belongs
to another user or can be written by others.

`check_action_aat` sources its rules from an AAT chain only when both
`--aat-chain` and `--aat-root-key` (the root public key it must start at, a PEM
file) are given.

## Run

**Local (stdio)** for Claude Desktop, Cursor, and desktop agents:

```bash
vouch-mcp-signer --policy vouch-policy.json
```

`vouch mcp-signer --policy vouch-policy.json` runs the same server.

**Remote (Streamable HTTP)** for hosted / networked deployments:

```bash
VOUCH_MCP_TRANSPORT=http VOUCH_MCP_HOST=127.0.0.1 VOUCH_MCP_PORT=8080 vouch-mcp-signer --policy vouch-policy.json
```

The server listens on `127.0.0.1` unless you set `VOUCH_MCP_HOST`, and on the
port in `VOUCH_MCP_PORT` (default 8080); if that port is taken, set another. It
has no login of its own, and it logs a warning at start when the host is not a
loopback address. To serve other machines, bind a non-loopback address behind a
proxy that authenticates callers, because the proxy decides who may ask the
server to sign, delegate or open sessions.

```jsonc
// Claude Desktop / Cursor MCP config
{
  "mcpServers": {
    "vouch": {
      "command": "vouch-mcp-signer",
      "args": ["--policy", "/path/to/vouch-policy.json"]
    }
  }
}
```

## Tools

| Tool | What it does |
|---|---|
| `sign(action, target, resource="", post_quantum=False, valid_seconds=None)` | Issue a credential authorizing one action, bound to that exact resource (signed as given, so it can be the JCS text of a call's arguments), when the policy's `rules` allow it (otherwise it returns a structured refusal). Pass `valid_seconds` to choose how long it stays valid, up to `signing.maxValidity`. Set `post_quantum=True` for the post-quantum profile, which returns a proof set with an `eddsa-jcs-2022` proof and an `mldsa44-jcs-2024` proof. |
| `verify(credential_json, public_key=None, trusted_issuers="", expected_action="", expected_target="", expected_resource="")` | Verify a credential another agent or service presented. Any MCP client can verify without installing an SDK. An issuer outside the trusted set answers `UNTRUSTED ISSUER` before anything is checked; `trusted_issuers` can only narrow the trusted set, it never adds trust. `public_key` counts only for a `did:key` issuer that encodes exactly that key; otherwise it is ignored and the answer says so. With `expected_action`, `expected_target` or `expected_resource`, a credential for some other intent is rejected without being used up. A sub-grant (a credential that names its parent grant by digest) verifies on its own, and the answer adds "This is a sub-grant: verify it with its grant chain." Each short-lived credential (valid 12 hours or less) verifies once per server: the server remembers what it accepted until it expires, so a second check of the same credential answers "this credential was already used". |
| `create_session(purpose, valid_seconds, decay_lambda, initial_trust)` | Issue a trust-decaying session voucher (Heartbeat Protocol). `decay_lambda` is above 0 and at most 1 per second, `initial_trust` is from 0 to 1. |
| `check_revocation(credential_json)` | Check a credential's `BitstringStatusList` entry for an issuer this server trusts: it verifies the credential, then the status list its issuer signed. Answers `ACTIVE`, `REVOKED`, `SUSPENDED`, `UNAVAILABLE`, `UNTRUSTED ISSUER`, `INVALID`, or not individually revocable. |
| `get_identity()` | Return the agent's DID. |
| `evaluate_freshness(tier, snapshot_json=None, now_iso=None)` | Bounded-staleness revocation gate for offline/DTN use: decide if a last-synced revocation snapshot is fresh enough for the action's consequence tier, failing closed when too old. |
| `check_intent_freshness(credential_json, last_pulse, tier='high', escrow_public_key=None, public_key=None, now_iso=None)` | Event-triggered intent recheck: verify a reasoned action's signature, then decide if its seal is fresh for its tier. A sensitive action needs a seal an escrow witnessed (pass the escrow's key) after the last heartbeat boundary, so timing the gap between heartbeats does not help. `public_key` counts only for a `did:key` issuer that encodes exactly that key; otherwise the agent's key comes from the issuer's DID document (a `did:web` issuer this server trusts) or from this server's own key. |
| `verify_disconnected_edge(credential_json, public_key)` | Authenticate any disconnected-edge (DTN) credential type (freshness token, presence, ephemeris grant, revocation, bundle custody, …); returns its type and subject. The signature is checked under the key you give; the answer says so when that key was not checked against the issuer. |
| `scan(text)` | Scan text (a diff, log, message, or file) for leaked Ed25519/hybrid private keys, seed env vars, and DID documents that embed a private key, before it crosses a trust boundary. |
| `decode_did(key)` | Decode a `did:key:z...` identifier or bare Multikey and report its algorithm and public-key size, so you can confirm a peer's key is the algorithm you expect before trusting it. |
| `delegate(action, target, resource, to=None, valid_seconds=None, reputation_score=None, parent=None)` | Issue a narrowed sub-delegation grant to a worker agent; every action it signs chains under the grant and can only narrow the authority, never widen it (Spec §9.3). Pass `parent` (the JSON of a grant, or of a grant chain, root first, that this identity was handed) with `to` to pass authority on: the result is the grant chain to hand to the worker. |
| `check_action(action, target, resource, did)` | Decide whether a DID may take one action on one resource under the policy's `rules`. This is the same rules check a guard applies before a tool runs. Answers `ALLOW` or `DENY` with a stable reason. |
| `check_trust(voucher_json, threshold=0.5, now_iso=None)` | Recompute a session voucher's *current* trust after decay (Trust Entropy) and compare it to the threshold the action requires; refuse when trust has fallen too far. |
| `disclose_ai_origin(content_hash, content_ref=None)` | Sign a Vouch Credential attesting this agent produced the content at `content_hash`, so downstream parties verify the AI-origin claim instead of trusting an unsigned label. |
| `create_authority_state(authority_epoch, status="active", valid_seconds=300, subject_did=None)` | Publish this authority's current state as a signed credential carrying a monotonic `authorityEpoch` and a status (`active`, `suspended`, `incident`, `exposure_breached`, `revoked`). Bump the epoch on every authority-relevant transition: it must be greater than the last epoch published for that subject and at most `freshness.authorityEpochMaxStep` more. |
| `verify_authority_state(credential_json, public_key)` | Verify an `AuthorityState` credential another authority published and report its epoch and status, which is what a verifier records as the highest epoch it has seen. The signature is checked under the key you give; the answer says so when that key was not checked against the issuer. |
| `check_authority_freshness(tier, voucher_epoch=None, last_seen_epoch=None, current_status=None, live_cosign_ok=False)` | Authority Freshness gate: refuse a session voucher minted under an epoch older than the highest one this verifier has seen, even when its time-decay trust still passes. `routine` is time-decay only, `sensitive` applies the epoch rule locally, `critical` also requires a live M-of-N quorum co-sign whose outcome you pass in. |
| `reputation(did, events_json)` | Compute an agent's reputation score and success rate from a history of recorded outcomes, to weigh how much to trust a peer with a track record. |
| `attribute(manifest_json, path=None)` | Attribute authorship from a signed attribution manifest: a whole-manifest human/AI/pre-existing split, or per-line blame for one file. |
| `check_action_aat(tool, args_json="{}")` | Decide whether an AAT delegation chain permits a tool call, including its arguments. The rules come from the verified chain's leaf. Needs `--aat-chain` (the chain file) and `--aat-root-key` (the root public key it must start at); with either missing it denies. |
| `robot_check_action(scope_json, action_json)` | Check a robot's proposed physical action against its capability scope. Answers `ALLOW`, or `DENY` with the limits exceeded. |
| `robot_check_conformance(credentials_json, profile_id)` | Check the credentials a robot presents against a built-in regulatory profile and report per clause: `CONFORMS` or the gaps. |
| `robot_verify_conformance_attestation(attestation_json, issuer_public_key_jwk)` | Verify a signed robot conformance attestation offline, including that the embedded report matches its bound digest. |
| `robot_verify_credential(credential_json, ed25519_public_key_jwk, mldsa44_public_key=None)` | Verify a robot credential, classical or post-quantum, auto-detected. |

## Why `verify` matters

Signing proves *you* acted. Verifying is how *everyone else* benefits: any
MCP-capable agent, in any framework, can confirm another agent's credential with
a single tool call and no SDK. That is what turns Vouch Protocol from a per-app
library into an interoperable trust layer.

### Verifying without a key

`verify` checks the cryptographic signature, so a credential that only looks
well-formed will not pass. When you do not pass a key, it resolves the issuer's
key from the credential's DID: `did:key` is
self-certifying and resolves offline, while `did:web` is fetched over HTTPS from
the issuer's own domain. If the key cannot be resolved, the credential is
rejected. A `did:key` issuer verifies fully offline. A `did:web` issuer's key always
comes from its DID document (or, for this server's own DID, from the server's own
key), and `public_key` is not a way to supply one: it counts only for a `did:key`
issuer that encodes exactly that key. A credential that names no issuer DID is
answered as malformed.

## Registry

This package ships a `server.json` manifest for the MCP registry, so it can be
discovered and installed like any other MCP server.

## License

Apache-2.0.

## MCP registry

This server is listed in the Model Context Protocol registry.

mcp-name: io.github.vouch-protocol/vouch-mcp-signer
