Back to Browse

Amr MCP Server

by JC7333
Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Records who authorized an AI agent to do what, until when; signed tokens, hash-chained journal.

About

Records who authorized an AI agent to do what, until when; signed tokens, hash-chained journal.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (1 strong, 3 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.

4 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

file_system

Check that this permission is expected for this type of plugin.

database

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Absolute path of the SQLite registry file (default: amr_mandates.db in the client's current directory)Optional

Environment variable: AMR_DB_PATH

Absolute path of the registry's Ed25519 private key, created on first use; keep it out of version controlOptional

Environment variable: AMR_SIGNING_KEY_PATH

Absolute path of the registry's public key fileOptional

Environment variable: AMR_PUBLIC_KEY_PATH

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "mandatia": {
      "command": "uvx",
      "args": [
        "mandatia==0.1.4"
      ],
      "env": {
        "AMR_DB_PATH": "your-amr-db-path-here",
        "AMR_PUBLIC_KEY_PATH": "your-amr-public-key-path-here",
        "AMR_SIGNING_KEY_PATH": "your-amr-signing-key-path-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

mandatia

Records who authorized an AI agent to do what, until when.

mandatia is the public name. Inside the project it is still called AMR (Agent Mandate Registry): the repository, the Python module amr and the AMR_ settings keep that name.

mandatia is an open-source MCP server that registers, verifies, and audits mandates authorizing AI agents to act on behalf of principals. Here a mandate is the written authorization a person or a body gives for its agent: it binds the one who gives it, not the agent, which is not a person. It provides a cryptographically chained audit trail of who authorized which agent to do what, until when: evidence that supports the human-oversight and record-keeping duties of deployers under EU AI Act Article 26, with eIDAS 2.0 electronic mandates in mind. mandatia is a technical tool: it does not by itself make a system compliant.


Quickstart for agents

This section is written so that an AI agent (Claude Code, Cursor, any MCP client) can install mandatia and reach a first verified mandate on its own: no account, no email, no person to ask. Everything runs on your machine; mandatia makes no network call (two opt-in exceptions, both off by default: report_issue once the operator sets AMR_ISSUE_TOKEN, and the did:web key check once the operator sets AMR_DID_WEB_RESOLVE=1).

1. Run the server (needs uv).

uvx mandatia

The PyPI package is named mandatia; the Python module and the amr command keep their names. uvx amr installs a different, unrelated project: do not use it. To run the latest code of the repository instead:

uvx --from git+https://github.com/JC7333/amr amr

mandatia runs with version 1 and version 2 of the MCP Python SDK (mcp>=1.2,<3); no extra version pin is needed.

Or clone the repository and run uv sync && uv run amr.

2. Declare it in your MCP client.

Claude Code:

claude mcp add mandatia -- uvx mandatia

Cursor (.cursor/mcp.json) and other clients that read an mcpServers object:

{
  "mcpServers": {
    "mandatia": {
      "command": "uvx",
      "args": ["mandatia"],
      "env": {
        "AMR_DB_PATH": "/absolute/path/amr_mandates.db",
        "AMR_SIGNING_KEY_PATH": "/absolute/path/amr_signing_key.pem",
        "AMR_PUBLIC_KEY_PATH": "/absolute/path/amr_signing_key.pub"
      }
    }
  }
}

To run the repository code instead, the arguments are ["--from", "git+https://github.com/JC7333/amr", "amr"]. Set the three paths: by default mandatia writes its database and its signing key in the current directory of the client. Keep the .pem private key out of version control.

Give each side only its own tools. An agent that can create, sign or revoke its own mandate authorizes itself, and the mandate then proves nothing. Set AMR_TOOL_PROFILE in the env block of each client, all pointing at the same AMR_DB_PATH:

AMR_TOOL_PROFILEWho runs itTools
principalthe person or body that grants mandatescreate, sign, suspend, revoke, contest, prove, have the registry dated (create_mandate, register_principal_key, suspend_mandate, resume_mandate, revoke_mandate, contest_action, get_proof, export_insurer_dossier, record_registry_timestamp, ...)
agentthe agent that acts under a mandateverify_mandate, issue_action_token, log_action, issue_mandate_attestation, get_registry_public_key; create_mandate for sub-mandates under its own mandate only
receivera third party the agent acts uponcheck_action_token, record_action_receipt, get_registry_public_key
full (default)tests and single-user setupsevery tool

With agent, create_mandate refuses a mandate without parent_mandate_id (root_mandate_needs_principal).

3. Reach a first verified mandate. The tools, in the order an agent uses them:

  1. create_mandate: register who authorizes what (principal_id, agent_id, scope, legal_basis_regulation, legal_basis_article, duration_hours; add allowed_actions / forbidden_actions for a perimeter; only issue_action_token enforces it).
  2. verify_mandate(agent_id, action): authorized: true while the agent has an active mandate. It does not check action against the perimeter; issue_action_token does. Add mandate_id to check the one mandate the agent shows you: that mandate only.
  3. issue_action_token(mandate_id, agent_id, action, audience, action_type, action_metadata_json): before acting, the agent asks for a signed token. Under a perimeter, action_type is required (e.g. "invoice.pay"), and an amount goes in action_metadata_json as a decimal string: '{"amount": "120", "currency": "EUR"}'. Outside the perimeter or above a ceiling the answer is denied: true with reason: "action_out_of_scope" and a detail (forbidden:agent.create, amount_above_limit:500 EUR, ...). No token, no action. The receiver checks the token with check_action_token (profile receiver), and once it has dealt with the action leaves its receipt with record_action_receipt (executed, or refused and why).
  4. log_action(mandate_id, action, action_token=...): append an entry to the hash-chained journal. With the token of step 3, the action is logged only if that token is valid, was issued under this mandate and has not covered another action; its jti is sealed into the entry. With or without a token, the entry is the agent's declaration of what it did, not a proof that it took place; without a token, nothing is checked against an authorization; set AMR_REQUIRE_ACTION_TOKEN_FOR_LOG=true to refuse every action logged without one.
  5. issue_mandate_attestation + get_registry_public_key: a signed document a third party checks offline with python -m amr.verify_attestation.
  6. revoke_mandate(mandate_id, reason): the stop button. That mandate then issues no token, and verify_mandate answers authorized: false unless the agent holds another active mandate (with mandate_id set to the revoked mandate, it answers authorized: false in every case). Tokens and attestations already issued stay valid until they expire, except for a receiver that re-checks the token with check_action_token. To pause rather than end, suspend_mandate: a key the principal designated in the mandate (suspension_keys) stops it at once, and only the principal lifts the pause (resume_mandate).
  7. get_proof(mandate_id): the full audit bundle (mandate, actions, integrity). If the agent already did something it should not have, contest_action(mandate_id, action_id, reason, response_days) records that the act is disputed, and list_action_contests reminds the deadline the operator chose.
  8. report_issue(title, description, version, context): report a problem with mandatia itself. Without AMR_ISSUE_TOKEN it makes no network call and returns a pre-filled link to open; with it, it files the issue on GitHub. See docs/report-issue-spec.md.

The same flow, runnable and checked by the test suite, is in examples/quickstart_agent.py:

git clone https://github.com/JC7333/amr.git && cd amr && uv sync
uv run python examples/quickstart_agent.py   # prints every step, ends with "OK"

A worked case with three roles (principal, agent, receiver), a committee decision, a validated note and a signed withdrawal: docs/scribe-example.md (in French: docs/scribe-example.fr.md).

Machine-readable summaries for agents: AGENTS.md and llms.txt. To report a problem, call report_issue or open an issue at https://github.com/JC7333/amr/issues (never paste real mandate contents or personal data into it).


Why mandatia?

Modern AI agent infrastructure covers many concerns — but the record of who authorized an agent, for what and until when, is missing:

ConcernExisting toolsmandatia
Infrastructure & orchestration✅ LangChain, AutoGen, CrewAI—
Security & sandboxing✅ Docker, RBAC, network policies—
Permission & access control✅ OAuth, IAM, API keys—
Observability & tracing✅ OpenTelemetry, Langfuse—
Authorization record & accountability❌ Not covered✅ mandatia

EU AI Act Article 26 (Regulation (EU) 2024/1689) requires deployers of high-risk AI systems to assign human oversight and to keep the logs the system generates, to the extent they are under their control, for at least six months (Art. 26(6)). It applies from 2 December 2027 for Annex III systems and 2 August 2028 for Annex I systems (Regulation (EU) 2026/1744). Non-compliance with Article 26 can be fined up to €15 million or 3% of worldwide annual turnover, whichever is higher (Art. 99(4); for SMEs and start-ups, whichever is lower, Art. 99(6)). mandatia records who authorized an agent, for what and until when, and what it did, in a tamper-evident form that this oversight can rely on; it complements the system's own logs, it does not replace them.


Structural hard-stop enforcement

mandatia does not only record mandates — it enforces them. Agent runtimes must obtain a signed action token from mandatia before performing any action. The token is issued if and only if a valid, non-expired, non-revoked mandate authorizes that specific action for that specific agent. No mandate → no token → no action.

Tokens are JWS (RFC 7515) signed with Ed25519 (EdDSA), include replay prevention via the jti claim and the issued_tokens audit table, and carry the exact action hash and scope digest they authorize. Consumers verify offline with the mandatia public key and MUST check aud, exp, and amr_action_hash.

Perimeter enforcement and delegation control

A mandate can carry a structured perimeter: the action types the agent may request (allowed_actions), the ones it may never request (forbidden_actions, which always win and also reach sub-types: forbidding agent.create forbids agent.create.batch), whether it may delegate (delegation_allowed), and an optional amount ceiling (max_amount with currency, applied to amount_actions). The token issuer then checks the requested action against the perimeter, not only the existence of the mandate:

  • an action type outside allowed_actions, or matching forbidden_actions, gets no token (reason: "action_out_of_scope", with a detail and the mandate that refused it in refused_by);
  • a sub-mandate (parent_mandate_id) is created only if the parent is active, allows delegation, and was granted to the agent now delegating; the sub-mandate must stay inside the parent's allowed actions and limit, inherits the parent's prohibitions, and cannot outlive the parent;
  • every token issued under a sub-mandate re-checks the whole chain: revoke (revoke_mandate) or let expire the parent, and every sub-mandate below it stops getting tokens;
  • an optional cumulative ceiling (period_max_amount over a rolling window of period_days days, same currency and amount_actions) caps the total of the amounts of the tokens issued under the mandate and every sub-mandate below it in the window: for the actions that carry an amount (those reached by amount_actions, every action when it is empty, and any action that declares an amount), an agent cannot split a large purchase into small ones, nor spend the same budget again through a sub-agent (detail: "period_amount_above_limit:<max> <CUR>/<days>d", with the mandate whose budget is spent in refused_by). A token counts as soon as it is issued, used or not; a refused token counts for nothing. A sub-mandate's own ceiling may not exceed the parent's. The parent's ceiling is not copied into the sub-mandate's perimeter (it binds the sub-mandate all the same, at issuance): read the whole chain, as get_proof and the attestation do, to see every ceiling that applies. A sub-mandate that sets a ceiling under a parent with a per-action limit binds the union of both amount_actions (an empty list on either side means every action);
  • optional risk classes (risk_classes) bound how long a token stays usable, by what is at stake: each class names action types (reached with their sub-types, like forbidden_actions) and a max_token_seconds from 1 to 86400, for example {"name": "irreversible", "actions": ["invoice.pay"], "max_token_seconds": 30}. A token for an action reached by a class lives at most that long; the shortest class wins, in the mandate and in every mandate above it in the delegation chain, so a sub-mandate can shorten the window, never lengthen it: it inherits the parent's classes (shown in its own perimeter) and may reuse a class name only with a shorter or equal max_token_seconds (else limit_exceeds_parent). The matched class names are sealed in the token as amr_risk_classes. A class never lengthens a token beyond AMR_TOKEN_LIFETIME_SECONDS. Mandates without classes keep their exact hash and tokens. A class may also set "registry_check": true: its tokens then carry amr_registry_check: true, and the receiver re-checks them with check_action_token at the moment of acting, so a revocation in the meantime is seen. A sub-mandate inherits the flag and cannot drop it. Classes without it keep their exact form and hash.

Example: an assistant agent told never to create sub-agents.

create_mandate(..., allowed_actions=["report.*"], forbidden_actions=["agent.create"])
issue_action_token(..., action_type="agent.create")
→ {"denied": true, "reason": "action_out_of_scope", "detail": "forbidden:agent.create"}

Root mandates without a perimeter keep working as before (free-text scope, existence and validity checks only, same hashes). Perimeters without a cumulative ceiling keep their exact canonical form, so their hashes, perimeter digests and principal signatures are unchanged; schema v7 only adds the token_amounts table. Limits of the cumulative ceiling: tokens issued before schema v7 carry no recorded amount and are not counted (a older mandatia cannot issue tokens on a capped branch: it refuses the unknown perimeter fields); the ceiling binds one mandate and its branch, not every mandate of the same principal. Two changes are deliberate and breaking for sub-mandates: a new sub-mandate requires a parent that allows delegation (so a free-text parent can no longer delegate), and tokens under any sub-mandate, including ones created before v1.1, now require every parent to be active and unexpired.

Deployment rule. These controls hold only if agents cannot register their own mandates. create_mandate and register_principal_key are principal-side tools: expose them to the principal (or its back office), never to the agents it governs. An agent that can call create_mandate can mint itself a fresh root mandate for any principal without a key, and one that can call register_principal_key can claim a principal that has not registered a key yet. Principal signatures (below) close the first gap once each principal has registered its key; binding keys to a verified identity is on the roadmap.

Human validation required by the mandate

Some actions should only go out once a person has validated them: a consultation note sent to the patient record, a letter, an order. The principal can say so in the mandate itself, with validation_actions (same patterns as forbidden_actions: a pattern also reaches its sub-types):

create_mandate(..., allowed_actions=["note.*"], validation_actions=["note.send"])
issue_action_token(..., action_type="note.send")
→ {"denied": true, "reason": "action_out_of_scope",
   "detail": "validation_required:validated_by,validated_content_sha256", "refused_by": "..."}
issue_action_token(..., action_type="note.send", action_metadata_json=
    '{"validated_by": "user:dr-a", "validated_content_sha256": "<sha256 of the note>"}')
→ {"token": "...", ...}   # claims amr_validation_required, amr_validated_by,
                          # amr_validated_content_sha256

For those action types, the action metadata must carry validated_by (who validated, 1 to 200 characters) and validated_content_sha256 (SHA-256 of the content validated, 64 lowercase hex), or there is no token. Both values are sealed into the token and into its action hash (a token for one validated text does not cover another), returned by check_action_token and listed by get_proof under validated_actions. A sub-mandate inherits the requirement and cannot lift it.

Limit. The registry records the validator the agent declares. It does not authenticate that person and never sees the content: the receiver checks. It compares validated_by with the person it knows validated (who is signed in on its side) and validated_content_sha256 with the SHA-256 of what it receives, and refuses on a mismatch. A validation is not single-use: the same validator and hash can back several tokens, so a receiver that wants one action per validation deduplicates on its side.

Mandates without validation_actions are unchanged: same perimeter, same hash, same signed payload, same tokens. Schema v12 only adds the token_validations table. A mandatia version before this one refuses a perimeter that carries the key, so a rollback fails closed for such mandates (no token). See docs/token-issuance-spec.md, Human Validation.

Principal signatures: the principal signs the mandate

A principal can register its own Ed25519 public key once (register_principal_key). From then on, the registry accepts a mandate in its name only if the principal signed it: prepare_mandate_signature returns the exact bytes to sign, and create_mandate takes principal_signature and signed_at. The signature is sealed into the mandate's chain_hash, cannot be used twice in the same registry, and is kept in the Proof Pack with the public key and the signed bytes, so anyone can re-check it offline. Set AMR_REQUIRE_PRINCIPAL_SIGNATURE=true to refuse every unsigned mandate.

What a valid signature proves: the mandate was signed with the key first registered for that principal_id. For an ordinary principal_id the registry does not check who registers a key (first registration wins), so register each principal's key at onboarding, through the principal's own channel. An organisation can instead use a did:web:<its domain> identifier: the key is then accepted only if the domain publishes it in https://<domain>/.well-known/did.json, and the SHA-256 of that document is sealed with the key (opt-in network access, AMR_DID_WEB_RESOLVE=1). This proves control of the domain at registration time, not a qualified signature. Consumers that rely on a did:web principal must check did_web_unverified: false in the Proof Pack, the attestation or the insurer dossier.

The principal can also sign the mandate as a PDF with its own signature tool (prepare_mandate_pdf, then attach_signed_mandate_pdf): the registry checks the PAdES signature offline against the trust roots the operator chose and records the signer named by the certificate. It does not read the EU trusted lists or check revocation, and does not decide whether the signer may act for the principal.

Behaviour change (did:web keys): with the default configuration, registering a key for a did:web: identifier is now refused (did_web_resolution_disabled) instead of "first registration wins"; keys already registered stay valid and are reported as did_web_unverified. A scheme:method: prefix written with non-ASCII look-alike characters is refused (principal_id_lookalike). Mandates of principals without a key behave as before (same hashes; the result gains "principal_signature": null); mandates created before a key was registered stay valid. See docs/principal-signature-spec.md, including its known limits.

See docs/token-issuance-spec.md for the full specification.

Sector templates

A template is a ready-made, versioned perimeter for one kind of agent, with a catalog that says in plain words what each action type means. The first one, agent-sante-rgpd, covers an assistant agent in a medical practice: it may read the record, handle the schedule, draft letters and patient messages for a human to send, and order supplies under a ceiling; it may never prescribe, diagnose, rank patients by urgency, change or export the record, contact a patient itself, or create a sub-agent. The second one, agent-rh-recrutement, covers an agent assisting a recruiter: it may read the applications, draft a job posting, propose a shortlist to a human recruiter, propose and book interview slots and draft candidate messages; it may never reject or select a candidate, send an offer, a rejection or any candidate message, recognize emotions, categorize people from biometric data, infer sensitive data, export candidate data, or create a sub-agent. Every decision to reject, select or make an offer stays with a human. The third one, agent-credit, covers an agent assisting a credit analyst: it may read the credit application and the documents provided, draft a creditworthiness analysis, propose a reasoned decision to a human analyst and draft messages to the applicant; it may never grant or refuse a credit, set the final rate, amount or duration, send any message to the applicant, execute a payment, export the credit file, or create a sub-agent. Every decision on a credit stays with a human. Fraud detection is not part of it. The fourth one, agent-assurance-sante-vie, covers an agent assisting a life or health insurance underwriter: it may read the underwriting file, draft a risk assessment, propose a reasoned premium to a human underwriter and draft the contract documents and messages to the insured person; it may never accept or refuse an application, set the final premium, send any message to the insured person, use the result of a genetic test, export health data, or create a sub-agent. Every decision on an application stays with a human. Claims handling is not part of it. The fifth one, agent-support-client, covers an agent answering customers for a business: it may read the customer's account and history, answer a ticket while saying the answer comes from an AI, route a ticket, propose a commercial gesture and grant one under a ceiling (50 EUR per gesture by default, which a mandate may lower, never raise); it may never refuse a refund or a complaint, terminate a contract, close an account, change payment details, export the customer's data, or create a sub-agent. Every decision that goes against the customer stays with a human. mandatia does not read the answers: they must not carry a refusal or a promise of money.

from amr.templates import get_template

template = get_template("agent-sante-rgpd")
await create_mandate(..., **template.create_mandate_kwargs())

The mandate records template_id, template_version, template_digest and, when the template has a stewardship block, template_status in its metadata. That metadata is a label, not sealed into the chain hash; the perimeter is sealed and is what the token issuer enforces. Templates only fill in existing create_mandate arguments: existing mandates and their hashes are unchanged. They are a Python API for now (no MCP tool lists them yet). Like every perimeter, the template holds only if the agent cannot call create_mandate itself (see the deployment rule above). See docs/templates/agent-sante-rgpd.md, docs/templates/agent-rh-recrutement.md, docs/templates/agent-credit.md, docs/templates/agent-assurance-sante-vie.md and docs/templates/agent-support-client.md.

Each template published here is a provisional sector baseline. Its stewardship block says so (status provisional until a body of the sector takes it over, who holds it, the practitioner reviewers recorded: none so far); the block is part of the template digest and its status is copied into the mandate metadata as template_status. The template's risk classes are minimum thresholds (for agent-sante-rgpd, version 1.3.2: an order token lives at most 30 seconds and asks for a registry re-check; agent-rh-recrutement 1.0.1, agent-credit 1.0.1 and agent-assurance-sante-vie 1.0.1 set none, since none of their allowed actions is irreversible; agent-support-client 1.0.1 sets none either, and a mandate may add one for commercial_gesture.grant): create_mandate_kwargs(risk_classes=[...]) may tighten them or add classes, and refuses with a ValueError anything that would loosen them.

When a body (committee, board) authorized the agent, the mandate can record its decision (organ_decision: body, title, date, optional reference, designated persons or roles); the health template accepts it, create_mandate seals it into the chain hash (root mandates with a closed list of allowed actions only), and verify_mandate and get_proof return it. Mandates without it keep their exact hash.

Third-party verification: the receiver checks the mandate alone

An agent can show whoever receives it (a seller, a hospital, an insurer) a signed mandate attestation (issue_mandate_attestation). The receiver checks it alone, offline, with the registry's public key fetched once (get_registry_public_key): no account, no call to the registry. The attestation states that the mandate exists, who granted it (and whether the principal signed it; with include_principal_payload the receiver re-checks that signature itself), the agent, the scope and structured perimeter, the expiry, and that the mandate and every mandate above it were active when the attestation was issued.

python -m amr.verify_attestation attestation.jws --public-key registry.pub --audience seller:acme
# registry.pub: the PEM (or the JSON) returned by get_registry_public_key
# {"valid": true, "reason": "ok", "attestation": {"principal_id": "...", "perimeter": {...}, ...}}

What it does not prove: that the mandate is still active now. An attestation lives at most AMR_ATTESTATION_LIFETIME_SECONDS (default 15 minutes) and never outlives the mandate or a parent; a revocation made after issuance reaches an offline receiver only when the attestation expires. It is a bearer document: the receiver must make sure it is dealing with the agent named in agent_id. Pass audience to address it to one receiver. Mandate metadata is not disclosed unless include_principal_payload is set (it is inside the signed bytes). The registry trusts its own database: protect the file. Existing mandates and their hashes are unchanged; issuances are logged in a new append-only table, issued_attestations (schema v5). See docs/mandate-attestation-spec.md.

Public registry: a verification point the operator hosts (no account for the receiver)

mandatia runs over stdio next to each operator, so nobody else can query it. The public registry is a separate, read-only verification point that each operator hosts on its own domain (this repository deploys none, and mandatia.eu hosts none): the operator exports a signed snapshot of the registry, and a small WSGI application (standard library only) serves it. A receiver checks a mandate identifier or pastes an attestation, in a browser (HTML) or from a script (JSON), with no account.

python -m amr.public_registry export --out amr_public_registry.jws   # read-only, signed EdDSA
python -m amr.public_registry serve --export amr_public_registry.jws --public-key registry.pub
curl http://127.0.0.1:8080/mandates/<mandate-id>
# {"status": "active" | "revoked" | "expired" | "cut_by_parent" | ..., "verification_ms": 0.2, ...}

The snapshot holds, per mandate, the agent, a SHA-256 reference of the principal (never the identifier in clear), the perimeter, dates, recorded status, revocation date and chain hash; never the scope text, legal basis, metadata or revocation reason. The application verifies the snapshot with the pinned registry key before serving it (and serves it raw at /snapshot for receivers who verify it themselves; trust in the JSON answers is trust in whoever runs the app), has no write path, keeps no log and never reads the client's address. Every result gives the snapshot date and the time the verification took. Limit: a revocation made after the snapshot shows only at the next export; set AMR_PUBLIC_SNAPSHOT_MAX_AGE_SECONDS to refuse answers from an older snapshot. Deployment and domain are the operator's step. Existing mandates and their hashes are unchanged; no schema change. See docs/public-registry-spec.md.


Vision: from registry to enforcement

mandatia started as a mandate registry — it stores, verifies, and audits mandates. This is necessary but not sufficient.

The problem: if the mandate check is a voluntary call, agents skip it. The system degrades to advisory compliance within weeks of real-world deployment.

mandatia now provides structural enforcement: it is the layer that issues execution authorizations (issue_action_token). No valid mandate → no authorization → no action possible. The system refuses to work without the mandate — not because someone recommends checking, but because the receiver accepts no action without a token the registry signed.

LayerWhat it doesStatus
RegistryStore, verify, audit mandates. SHA-256 chain. MCP native.✅ Live
EnforcementMandate-gated execution authorization (issue_action_token, check_action_token). No mandate = no action.✅ Live
Ecosystemmandatia authorizes before the action. Certification proxies prove what happened during.Compatible today

Quick Start

git clone https://github.com/JC7333/amr.git
cd amr
uv sync
uv run amr

Claude Desktop Integration

Add mandatia to your Claude Desktop config file:

Location: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "mandatia": {
      "command": "uv",
      "args": ["--directory", "C:\\dev\\amr", "run", "amr"]
    }
  }
}

Restart Claude Desktop. All mandatia tools will be available immediately.


Tools

Every tool carries MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint, MCP specification 2025-03-26 onwards), which clients use to decide which calls need the user's approval (with mcp SDK 1.7 or later; an older SDK cannot send them):

ClassTools
read-only (records no mandate, action, token, contest or key and sends nothing; like every tool, may create the empty database on first use)verify_mandate, get_proof, check_action_token, prepare_mandate_signature, prepare_mandate_pdf, export_insurer_dossier, prepare_revocation_signature, prepare_suspension_signature, prepare_contest_signature, list_action_contests, prepare_registry_timestamp
appends to the registrycreate_mandate, log_action, issue_action_token, record_action_receipt, attach_signed_mandate_pdf, issue_mandate_attestation, suspend_mandate, resume_mandate, contest_action, record_registry_timestamp
writes, may reach the network (opt-in)register_principal_key (appends the key; reads the did:web domain with AMR_DID_WEB_RESOLVE=1), report_issue (files a GitHub issue with AMR_ISSUE_TOKEN, otherwise writes nothing)
destructive (final)revoke_mandate
idempotent writeget_registry_public_key (creates the registry signing key on its first call, then only reads it)

They are hints for the client, not a protection: mandatia applies its own rules whatever the client does with them. python -m amr.tools_list prints them with each tool.

Refusals are MCP errors, in one shape

Behaviour change. A refusal (unknown, revoked or expired mandate, action outside the perimeter, invalid input, ...) now reaches the MCP client as a tool error (isError: true), where it used to come back as an ordinary result that a client could take for a success. An agent framework that treated those answers as successes now sees them as errors.

Every refusal also carries three keys, the same for every tool, on top of the keys the tool already returned (none of them is removed or renamed, and a key the tool set is never overwritten):

KeyContent
codeA stable word: the tool's own code, else its reason (action_out_of_scope, mandate_not_found, mandate_status_revoked, mandate_expired, invalid_input, ...), else internal_error
messageOne readable sentence. A raw Pydantic validation text becomes <field>: <what is wrong>, without the input value or the Pydantic link
fieldThe input field at fault when mandatia knows it (mandate_id, duration_hours, ...), else null
{"error": "Mandate '550e8400-...' not found", "code": "mandate_not_found",
 "field": "mandate_id", "message": "Mandate '550e8400-...' not found"}

A refusal is an answer with an error key, or "denied": true, or, from check_action_token, "valid": false with reason invalid_input, internal_error or registry_unavailable (the check could not be made). verify_mandate given a malformed mandate_id is a refusal too (invalid_input; it keeps "authorized": false). The negative answers of the checking tools stay ordinary results: verify_mandate answering "authorized": false and check_action_token answering "valid": false for a bad, expired or revoked token answer the question asked. Successful answers are unchanged, byte for byte. No mandate, action log or hash changes.

This is done by the server when it registers the tools (src/amr/tool_errors.py): Python code that calls a tool function directly gets the same string as before, and only gains code and field on the refusals that had none. With mcp 1.19 or later (and 2.x) the error carries the JSON as its text and as structuredContent.result; an older SDK reports it as a tool error whose text contains the JSON. Arguments that do not match a tool's input schema at all (a missing required argument, a wrong type) are refused by the MCP SDK itself before mandatia runs, as before.

To go back: revert this change (no data migration is involved).

create_mandate

Register a new mandate: the written authorization a principal (a person or a body) gives for an AI agent to act on its behalf.

Parameters:

ParameterTypeDescription
principal_idstrPrincipal granting the mandate. E.g. "user:audric"
agent_idstrAgent receiving authorization. E.g. "agent:korvex-advisor-v1"
scopestrWhat the agent is authorized to do
legal_basis_regulationstrThe act that gives the signer the power to authorize: delegation of authority, body decision, contract. E.g. "Delegation of authority"
legal_basis_articlestrSection, item or clause of that act. E.g. "Section 2"
duration_hoursfloatDuration in hours (max 8760 = 1 year)
legal_basis_jurisdictionstrJurisdiction code (default "EU")
parent_mandate_idstr | nullUUID of parent mandate for delegation chains (parent must allow delegation)
metadatadictOptional string key-value pairs for annotations
allowed_actionslist[str] | nullAction types the agent may request: "invoice.pay", "invoice.*" or "*"
forbidden_actionslist[str] | nullAction types never allowed (win over allowed_actions). E.g. ["agent.create"]
delegation_allowedboolWhether the agent may grant sub-mandates (default false)
max_delegation_depthint | nullWith delegation_allowed: how many levels of sub-mandates may exist below this mandate, 1 to 16 (1 = the agent may delegate, its sub-agents may not). A deeper sub-mandate is refused with delegation_depth_exceeded; every ancestor's limit is checked. Absent: no limit from this mandate. Added to the sealed perimeter only when set, so existing mandates keep their hash. The limit is sealed with the mandate and checked each time a sub-mandate is created below it (a sub-mandate cannot declare more levels than its ancestors leave); it is not re-checked when a token is issued, and it binds only chains that declare their parent: the principal signature is what stops an agent from opening a separate root. Perimeters with this key cannot be read by older mandatia versions.
max_amountstr | nullCeiling per action, decimal string. E.g. "500"
currencystrISO 4217 code of max_amount (default "EUR")
amount_actionslist[str] | nullActions that must carry an amount under the ceiling (empty: all)
period_max_amountstr | nullCumulative ceiling over period_days, for this mandate and all its sub-mandates, decimal string. E.g. "2000"
period_daysint | nullRolling window of period_max_amount, 1 to 366 days (required with it). E.g. 30
risk_classeslist[dict] | nullClasses {name, actions, max_token_seconds, registry_check?} bounding the token lifetime of the actions they reach, here and in every sub-mandate; registry_check: true asks the receiver to re-check with check_action_token. E.g. [{"name": "irreversible", "actions": ["invoice.pay"], "max_token_seconds": 30, "registry_check": true}]
validation_actionslist[str] | nullAction types that need a human validation: their metadata must carry validated_by and validated_content_sha256, else no token. Inherited by sub-mandates. Added to the sealed perimeter only when set. E.g. ["note.send"]
principal_signaturestr | nullPrincipal's base64url Ed25519 signature of the prepare_mandate_signature payload (required once the principal has a registered key)
signed_atstr | nullISO 8601 timestamp with timezone placed in the signed payload (within 15 minutes of the registry clock)

Returns:

{
  "status": "created",
  "mandate_id": "550e8400-e29b-41d4-a716-446655440000",
  "principal_id": "user:audric",
  "agent_id": "agent:korvex-advisor-v1",
  "scope": "Compare and recommend financial products to retail clients",
  "perimeter": null,
  "parent_mandate_id": null,
  "principal_signature": null,
  "expires_at": "2026-05-13T20:00:00+00:00",
  "chain_hash": "a3f5c2d1e8b9..."
}

perimeter holds the structured perimeter when one was given (it is sealed into chain_hash). Perimeter and delegation errors return {"error": "...", "code": "..."} with a stable code: perimeter_invalid, parent_mandate_not_found, parent_mandate_<status>, parent_mandate_expired, delegation_not_allowed, delegator_mismatch, sub_mandate_requires_perimeter, perimeter_exceeds_parent, limit_exceeds_parent, expires_after_parent. A broken chain above the parent returns parent_mandate_<status>, parent_mandate_expired or delegation_chain_too_deep (more than 16 levels).

principal_signature is {"key_id", "signed_at"} for a signed mandate. Signature errors: principal_signature_required, principal_signature_incomplete, principal_key_not_registered, signed_at_invalid, principal_signature_stale, principal_signature_invalid, principal_signature_replayed.


Documentation truncated — see the full README on GitHub.

Reviews

No reviews yet

Be the first to review this server!