Skip to main content

agent-safety-mcp

PyPI version License: MIT Python 3.10+

MCP server for AI agent safety. One install gives any MCP-compatible AI assistant access to cost guards, prompt injection scanning, and decision tracing.

Works with Claude Code, Cursor, Windsurf, Zed, and any MCP client.


Install

Claude Code (recommended)

claude mcp add agent-safety -- uvx agent-safety-mcp

Manual (any MCP client)

Add to your MCP config:

{
  "mcpServers": {
    "agent-safety": {
      "command": "uvx",
      "args": ["agent-safety-mcp"]
    }
  }
}

From PyPI

pip install agent-safety-mcp
agent-safety-mcp  # runs stdio server

Tools

Cost Guard — Budget enforcement for LLM calls

Tool What it does
cost_guard_configure Set weekly budget, alert threshold, dry-run mode
cost_guard_status Check current spend vs budget
cost_guard_check Pre-check if a model call is within budget
cost_guard_record Record a completed call's token usage
cost_guard_models List supported models with pricing

Example: "Check if I can afford a GPT-4o call with 2000 input tokens"

Injection Guard — Prompt injection scanner

Tool What it does
injection_scan Scan text for injection patterns (non-blocking)
injection_check Scan + block if injection detected
injection_patterns List all 75 built-in detection patterns across 9 categories

Example: "Scan this user input for prompt injection: 'ignore previous instructions and...'"

Decision Tracer — Agent decision logging

Tool What it does
trace_start Start a new trace session
trace_step Log a decision step with context
trace_summary Get session summary (steps, errors, timing)
trace_save Save trace to JSON + Markdown files

Example: "Start a trace for my analysis agent, then log each decision step"


What this wraps

This MCP server wraps the AI Agent Infrastructure Stack — three standalone Python libraries:

All three: MIT licensed, zero runtime dependencies (individually), pure Python stdlib.

The MCP server adds mcp>=1.0.0 as a dependency for the protocol layer.


Why

AI coding assistants (Claude Code, Cursor, etc.) can now protect the agents they help build — checking budgets, scanning inputs, and tracing decisions — without leaving the IDE.

Built from 8 months of running autonomous AI trading agents in live financial markets.


License

MIT

Metadata

Release files for agent-safety-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-safety-mcp 0.2.1
File Size Uploaded Provenance
agent_safety_mcp-0.2.1.tar.gz 8.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-safety-mcp 0.2.1
File Interpreter ABI Platform
agent_safety_mcp-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / agent_safety_mcp-0.2.1.tar.gz

Download URL agent_safety_mcp-0.2.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f6c51967fffcf93a0bb66b12f57718a5145f195f69ebe18b91a535baf8541aca
BLAKE2b-256 checksum
How to use checksums
07e49695c16f3b94b4675a507e184d6a265d4246dde304e02c06f9546f4359a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Release files / agent_safety_mcp-0.2.1-py3-none-any.whl

Download URL agent_safety_mcp-0.2.1-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55d29bda3a4c1adc0f60dcba9a6278b97f54e01268b18f3af46130fd424ea31c
BLAKE2b-256 checksum
How to use checksums
4055e8bd10246415dd92c99953dd0c2c517ac9fa3d4a4f1cc6f22e01ca36cc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Security for agent-safety-mcp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page