Skip to main content

MCP server for AI agent safety — cost guards, injection scanning, decision tracing, agent identity (KYA), and signed receipts

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_safety_mcp-0.2.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_safety_mcp-0.2.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_safety_mcp-0.2.1.tar.gz.

File metadata

  • Download URL: agent_safety_mcp-0.2.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for agent_safety_mcp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f6c51967fffcf93a0bb66b12f57718a5145f195f69ebe18b91a535baf8541aca
MD5 ec81a47a83512f36d8c817279198f7c6
BLAKE2b-256 07e49695c16f3b94b4675a507e184d6a265d4246dde304e02c06f9546f4359a0

See more details on using hashes here.

File details

Details for the file agent_safety_mcp-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_safety_mcp-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55d29bda3a4c1adc0f60dcba9a6278b97f54e01268b18f3af46130fd424ea31c
MD5 a1a6768fd85dc05e55d47372b412d310
BLAKE2b-256 4055e8bd10246415dd92c99953dd0c2c517ac9fa3d4a4f1cc6f22e01ca36cc00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page