Skip to main content

MCP Server

What you get

When you ask a coding assistant like Claude Code or Cursor how to secure an AI agent, it normally guesses from general training data. This Model Context Protocol (MCP) server plugs the entire Safer Agentic AI catalogue and 241 concrete implementation patterns directly into your assistant, so it can look up exact subgoals, Safety Foundational Requirements (SFRs), evidence checklists, and code patterns while you build. The counts below reflect the current framework source tree (framework 1.3-draft, catalogue snapshot 2f012d55, pattern layer v1-draft). Published PyPI package 0.4.3 and the hosted endpoint currently serve snapshot b813d153 (239 subgoals, 812 SFRs, 1,005 evidence items) until the next wheel release.

In saferagenticai-mcp (source tree)Count
Suites (9 Drivers, 7 Inhibitors)16
Subgoals241
Safety Foundational Requirements (SFRs)824
SFRs marked normative656 (79.6%)
Evidence items1,017
Implementation Patterns: 126 code-applicable, 57 governance, 41 process, 17 ecosystem241
Exemplar patterns used as drafting references4
Operational heuristics15
MCP tools10
  • Implementation Patterns: one pattern per subgoal, each anchored to its SFRs and evidence requirements.
  • MCP tools for lookup, filtered listing, field-weighted search, cross-reference navigation, and task-first pattern discovery.
  • Task-first lookup: ask "what patterns apply to a tool-using agent executing shell commands?" and the server returns relevant patterns grouped by suite, ranked by field-weighted keyword matching.
  • Hot reload: pattern YAML edits are picked up on each tool call, no restart needed.

The Implementation Patterns layer provides non-normative developer guidance derived from the framework. Every pattern is a model-generated draft, and the library has no human-review process (see Review status). Claims about meeting a requirement rest on the framework itself.

Where to find it

The server is published to the canonical MCP catalogues, so registry-aware clients can discover and install it directly, or use any command in Install below.

Hosted endpoint (zero-install). A public Streamable-HTTP instance runs at https://mcp.saferagenticai.org/mcp: point any HTTP-capable MCP client at it, with nothing to install or run locally. It serves 10 read-only tools without authentication. The hosted instance runs 0.4.3 with catalogue snapshot b813d153 and the updated delegation patterns. See Configure for the one-line client snippet. Prefer a local install for offline use or a pinned, audit-reproducible version.

Also rolling out across the wider MCP ecosystem: mcp.directory (opens in new tab), mcpservers.org (opens in new tab), PulseMCP (opens in new tab) (via the registry ingest), and mcp.so (opens in new tab).

Worked example

Inside Claude Code, ask:

Use the saferagenticai MCP to find framework guidance for
sandboxing an autonomous agent that runs untrusted shell
commands with network access.

The assistant calls find_patterns_for_task. Response from 0.4.3, trimmed to the first three hits:

{
  "task": "sandbox an autonomous agent that runs untrusted shell commands with network access",
  "keywords_used": ["sandbox", "autonomous", "agent", "runs", "untrusted", "shell", "commands", "network", "access"],
  "expanded_terms": [
    { "phrase": "sandbox", "adds": ["sandboxing", "containment", "isolation"] },
    { "phrase": "network access", "adds": ["egress"] }
  ],
  "total_matches": 213,
  "flat_top": [
    {
      "pattern_id": "D3::idx2::sandboxing",
      "display_id": "D3.2",
      "title": "Sandboxing",
      "score": 152.31, "matched_in": "title"
    },
    {
      "pattern_id": "I7::idx6::nefarious-use-of-autonomous-ai-agents",
      "display_id": "I7.6",
      "title": "Nefarious Use of Autonomous AI Agents",
      "score": 81.372, "matched_in": "title"
    },
    {
      "pattern_id": "D3::idx9::tool-use-authorization-and-egress-contro",
      "display_id": "D3.9",
      "title": "Tool-Use Authorization and Egress Control",
      "score": 76.71, "matched_in": "title"
    }
    // ...truncated
  ],
  "next_step_hint": "For each pattern_id above, call get_requirement(id, include_pattern=true) ..."
}

The assistant then calls get_requirement("D3::idx2::sandboxing") for the full pattern (five named design patterns covering multi-layer isolation, pre-validation gate, environment-scoped credentials, staging fidelity, and deny-logged; five anti-patterns; pseudocode; and evidence-production hints) and grounds its recommendation in that material rather than from training data alone.

Why Rank 2 appears here: I7.6 scores high because the word autonomous appears in its title. Search in 0.4.3 expands common phrases into the framework's vocabulary (expanded_terms) and matches keywords across weighted fields rather than using vector embeddings, so always check each returned title against your actual task.

Install

1 From PyPI (recommended)

pipx install saferagenticai-mcp
# or, with the modern uv toolchain:
uv tool install saferagenticai-mcp
# or plain pip:
pip install --user saferagenticai-mcp

The wheel bundles criteria-v1.json, all implementation pattern YAMLs (239 in 0.4.3; 241 in the current source tree), and 4 exemplars, so it works without any repo checkout.

For audit trails, pin the version so reviewers can reproduce results: pipx install saferagenticai-mcp==0.4.3. Older releases (0.2.0) lack the verbosity param on find_patterns_for_task / search_patterns.

2 With uvx (no manual install)

If you have uv (opens in new tab) installed, your MCP client can launch the server on demand:

uvx saferagenticai-mcp==0.4.3

uv handles isolation and caches the install. Configure shows the matching claude mcp add command.

3 Manual venv (editable checkout)

If you have a local checkout and want pattern edits picked up live:

python3 -m venv research/mcp/.venv
research/mcp/.venv/bin/pip install -e research/mcp/server

Produces research/mcp/.venv/bin/saferagenticai-mcp.

Configure (Claude Code)

Use the claude mcp add command rather than editing configuration files by hand. The PATH and uvx setup commands were tested with Claude Code 2.1.318 on 2026-11-06 against saferagenticai-mcp 0.4.2. The pinned commands below install 0.4.3.

1 Add the server

For a pipx, uv tool or pip install, which puts saferagenticai-mcp on your PATH:

claude mcp add --scope user saferagenticai -- saferagenticai-mcp

Expected output:

Added stdio MCP server saferagenticai with command: saferagenticai-mcp  to user config
File modified: /Users/you/.claude.json

The -- separates Claude Code's own options from the command that starts the server. The other install routes use the same form:

# uvx, pinned to the release
claude mcp add --scope user saferagenticai -- uvx saferagenticai-mcp==0.4.3

# manual venv checkout: use the absolute path to the binary
claude mcp add --scope user saferagenticai -- /absolute/path/to/research/mcp/.venv/bin/saferagenticai-mcp

# hosted endpoint, nothing installed locally
claude mcp add --transport http --scope user saferagenticai https://mcp.saferagenticai.org/mcp

Use a local install for offline work or to pin the catalogue used for an audit.

2 Check the connection

claude mcp list

Expected output:

Checking MCP server health…

saferagenticai: saferagenticai-mcp  - ✔ Connected

Other servers you have configured are listed too. ✘ Failed to connect means Claude Code could not start or reach the server: see Troubleshooting. Inside a Claude Code session, /mcp shows the same status with the server's tool count (per the Claude Code documentation; not part of the tested run), which should be 10.

Scopes and where Claude Code stores them

ScopeLoads inStored in
local (default)The project where you ran the command~/.claude.json, under that project's path
projectThe project, for everyone who clones it.mcp.json in the project root
userAll your projects~/.claude.json

A project-scoped server from .mcp.json shows as ⏸ Pending approval (run `claude` to approve) in claude mcp list until you start claude in that project and approve it.

JSON configuration

To share the server with a team, commit a .mcp.json at the project root. This is the file claude mcp add --scope project writes:

{
  "mcpServers": {
    "saferagenticai": {
      "type": "stdio",
      "command": "uvx",
      "args": ["saferagenticai-mcp==0.4.3"],
      "env": {}
    }
  }
}

For the hosted endpoint:

{
  "mcpServers": {
    "saferagenticai": {
      "type": "http",
      "url": "https://mcp.saferagenticai.org/mcp"
    }
  }
}

User and local scopes live in ~/.claude.json, which also holds the rest of Claude Code's state, so add them with the CLI rather than by editing that file.

Cursor

Cursor reads ~/.cursor/mcp.json for servers available in every project and .cursor/mcp.json for one project (per Cursor's documentation, checked 2026-11-05; not tested with a Cursor build):

{
  "mcpServers": {
    "saferagenticai": {
      "command": "uvx",
      "args": ["saferagenticai-mcp==0.4.3"]
    }
  }
}

Other MCP clients that support stdio servers take the same mcpServers body in their own configuration file; check the client's documentation for its location.

Verify it works

1 Client check

Run claude mcp list as shown under Configure. A ✔ Connected status means Claude Code started the server and completed the MCP handshake.

2 Package and data check

The 0.4.3 executable has no version or health-check flag, and pipx installs it into its own virtual environment, so python3 -c "import saferagenticai_mcp" fails after a successful pipx install. Query the package through pipx instead:

pipx runpip saferagenticai-mcp show saferagenticai-mcp

The output includes Name: saferagenticai-mcp and Version: 0.4.3. To check that the bundled data loads, run the check with the interpreter inside the pipx environment (macOS and Linux):

"$(pipx environment --value PIPX_LOCAL_VENVS)/saferagenticai-mcp/bin/python" -c "
from saferagenticai_mcp.framework_loader import load_framework
idx = load_framework()
print(f'{len(idx.subgoals)} subgoals, '
      f'{sum(1 for s in idx.subgoals.values() if s.has_pattern)} with patterns')
"

With uv, run the same check in the tool's own environment:

uvx --from saferagenticai-mcp==0.4.3 python -c "
from saferagenticai_mcp.framework_loader import load_framework
idx = load_framework()
print(f'{len(idx.subgoals)} subgoals, '
      f'{sum(1 for s in idx.subgoals.values() if s.has_pattern)} with patterns')
"

Both print 239 subgoals, 239 with patterns for PyPI 0.4.3 (or 241 subgoals, 241 with patterns on an editable checkout of the current source tree). Anything less means the data files didn't ship correctly: reinstall with pipx install saferagenticai-mcp==0.4.3 --force.

Troubleshooting

Server doesn't appear in claude mcp list or /mcp

Run claude mcp list from the project directory. A server added with the default local scope loads only in the project where you added it; add it again with --scope user to make it available everywhere. A server in a project's .mcp.json stays at ⏸ Pending approval until you start claude in that project and approve it. Claude Code stores user and local servers in ~/.claude.json and project servers in .mcp.json, not in ~/.claude/mcp.json.

command not found: saferagenticai-mcp

The binary isn't on the PATH the client launches with. Three fixes, in order of preference:

  • Install via pipx (puts the binary in ~/.local/bin, on most PATHs) instead of a manual venv.
  • Use the absolute path in command: /Users/you/.../research/mcp/.venv/bin/saferagenticai-mcp.
  • Switch to uvx saferagenticai-mcp==0.4.3 (uv resolves the binary itself).
Server connects but tool calls return errors

Run the data check above directly. If it errors, the bundled data is missing or the package version is too old. Upgrade with pipx upgrade saferagenticai-mcp, or pin explicitly: pipx install saferagenticai-mcp==0.4.3 --force.

I edited a pattern YAML and the server returns the old answer

Hot-reload is suite-aware: it stat-walks research/mcp/suites/ on every tool call. It only fires for editable installs (mode 1 in framework_loader.py (opens in new tab)). PyPI and wheel installs ship a frozen copy of the data, so pattern edits in your local repo won't be visible. Reinstall in editable mode to get hot-reload: pip install -e research/mcp/server.

Search misses the control I expected

Search uses field-weighted keyword matching with corpus-built synonym expansion and IDF term weighting, without semantic embeddings, so a query phrased far from the framework's own terms can still miss the relevant control. See Search quality. Rephrase with the framework's terms (authorization rather than permissions, sandboxing rather than container), look up a known requirement directly with get_requirement, or browse a suite with list_requirements.

Tools (10 total)

Tool Input Returns
list_suites — 16 suites with titles and subgoal counts
get_requirement id, include_pattern One subgoal plus its Pattern layer; falls back to fuzzy candidates if no exact match
list_requirements suite / type / content_type / confidence filters Filtered subgoal list with each pattern's content type and drafting-model confidence
search_patterns query, limit, verbosity Field-weighted ranked matches with matched_in and, in full mode, snippets and the drafting-model confidence
get_cross_references id, include_inferred Outgoing adjacencies
get_reverse_references id Incoming adjacencies (who cites this pattern)
resolve_id query Canonicalise a partial id, slug fragment, or display_id; always returns candidates
find_patterns_for_task task, limit, verbosity Top patterns grouped by suite for a task description; defaults to compact mode for cheap triage
list_operational_heuristics suite_id, query Cross-cutting operational heuristics (Layer 2), optionally filtered by suite or keyword
get_operational_heuristic id Full detail for one operational heuristic, including its suite mappings

Review status

Every implementation pattern is a draft written by a language model, and the pattern library has no human-review process. Treat each pattern as a starting point for your own engineering design and review rather than normative authority. Base any claim about meeting a requirement on the canonical framework itself.

Each pattern YAML also includes a confidence field (high, medium, or low): 106 high, 113 medium, and 22 low in the current source tree (104 high, 113 medium, and 22 low in 0.4.3). That rating is the drafting model's self-rating of its own draft rather than an independent verification result; a high rating does not mean a human has checked the pattern.

Search quality

Search uses fast, deterministic field-weighted keyword matching. It expands everyday engineering phrases into the framework's own vocabulary and accepts requirement IDs in any common notation (d3.9, D3-9, G3.9, or permanent IDs such as SAAI-REQ-0035). To track ranking quality, the project runs a 21-task development set (research/mcp/eval/ranking_eval.yaml) written by the project team with its own expected answers. That 21-task set is unblinded and serves as a small smoke test rather than a formal benchmark; because the synonym table and pattern summaries were tuned directly against those 21 tasks, its score reflects in-sample tuning. An untuned 24-task held-out set, written before the synonym table was built, measures how well the expansion generalises to unseen phrasings. Current source-tree results (2026-11-25; in 0.4.3 the tuning set had 42.9% top-1, 81.0% top-3, and MRR@10 of 0.621, while the held-out set had 66.7% top-1 and 79.2% top-3):

100.0%top-3 hit, tuning set (21/21; 0.4.1: 71.4%)
79.2%top-3 hit, held-out set (19/24; 0.4.1: 45.8%)
0.75MRR, held-out set (limit 10)

The misses include ordinary practitioner phrasing, and some are essential controls. Seven of the 21 tuning tasks ask for a control that directly contains or limits what an agent can do (sandboxing, authorization, access restriction, control and data separation, audit logging). Following the 2026-11-25 summary-vocabulary pass and evidence indexing, all seven essential tuning tasks rank in the top 3 on the current source tree (0/7 missed; in 0.4.3, D3.2 ranked third, D3.1 sixth, and D6.9 remained outside the top 10). On the untuned 24-task held-out set, two of ten essential tasks still fall outside the top 3 when phrased with indirect network or caller-identity wording.

Do not rely on a single search to find every control a design needs. Check the returned titles against your task, rephrase with the framework's vocabulary, and browse the relevant suites with list_requirements.

Field weights (transparent so you can reason about ranking):

FieldWeightNotes
title10×Highest signal; canonical language
summary4×Pattern-author one-paragraph framing
sfr3×Normative requirement text
description2×Canonical subgoal description
evidence1.5×Evidence requirement text
body1×Catch-all over the full pattern YAML

The result's matched_in field tells you which weighted field produced the hit, so you can spot e.g. a body-only match (often spurious) vs. a title hit (usually solid).

Inferred cross-references: get_cross_references(include_inferred=true) returns same-suite siblings only. There is no embedding-similarity component. Treat inferred entries as "neighbours worth scanning", not as endorsed dependencies.

Data sources

  • Canonical framework: extracted from the Safer Agentic AI Recommended Practices and shipped as criteria-v1.json.
  • Pattern layer: one YAML file per subgoal under suites/.
  • Exemplars: four anchor patterns used as few-shot references when drafting the others (D3.2 Sandboxing, D7.2 Culture of Safety, D9.2 Compliance, I7.3 Global AI Capability Disparities).

At startup the server loads both layers and builds an in-memory index keyed by pattern_id and permanent catalog object_id (e.g. SAAI-REQ-0035). Exact display_id lookups distinguish numbered requirements (D2.1) from underlined variants (D2_1), while ambiguous forms (D2-1, D2 1) return both candidates.

Two-layer authorship

The framework is served in two layers with different authorship and update cadences:

  • Canonical layer: the normative SFRs and evidence requirements, authored by Nell Watson and Ali Hessami. Stable, auditable, versioned via criteria-v1.json.
  • Implementation Patterns layer: LLM-drafted guidance that translates normative requirements into code patterns, governance templates, and process scaffolds. Versioned independently.

Pattern files record their provenance: drafted_by (the drafting model, recorded on 239 of 241), anchor_exemplar (213 of 241) and the drafting model's own confidence rating (all 241). None records a human reviewer.

Versioning & drift

  • Canonical framework: follows criteria-v1.json's version field.
  • Pattern layer: v1-draft.
  • Server: semantic versioning. 0.3.0 introduces verbosity on the search tools; pin if you want reproducibility.
  • Drift audit: research/mcp/audit_pattern_drift.py compares each pattern's anchored SFR/evidence letters against the current canonical and flags new, deleted, or renamed entries. Run after any framework edit; non-zero exit means at least one pattern needs re-anchoring.

Scope & limits

  • Transport: stdio (default) plus a hosted, unauthenticated, read-only Streamable-HTTP endpoint at https://mcp.saferagenticai.org/mcp. No authenticated transport; the hosted endpoint is public and read-only by design.
  • Search: field-weighted keyword scoring with synonym expansion. Queries can still miss controls when their wording differs from the framework; see Search quality.
  • Read-only: no write tools. Pattern edits go through the YAML files directly so editor + git diff stay auditable.

Questions or issues? Reach us through the contact form on the homepage.

Last updated 2026-11-27 PyPI package v0.4.3 Pattern layer v1-draft