Skip to main content

Medusa Logo

Open-source endpoint DLP for Model Context Protocol (MCP)

Python 3.11+ License: Apache 2.0 Latest Release

AI assistants — Claude Desktop, Cursor, Codex, Claude Code — now use tools through MCP servers, and most security teams have no idea what data flows through them. Medusa is a CLI agent that sits between every AI assistant and every MCP server, scans the traffic on-device for secrets, PII, and 9 more categories of sensitive data, and blocks or redacts what shouldn't leave.

It runs 100% locally. No account, no cloud, no telemetry — unless you choose to connect one.


Install

The agent installs in standalone mode — local policy, local event store, zero network calls.

# One-liner (macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/joshmaster2165/medusa-agent/main/packaging/install.sh | sh

# Homebrew
brew tap joshmaster2165/medusa
brew install medusa-agent

# pip / pipx
pipx install medusa-mcp
medusa-agent install

Native signed installers (.pkg / .deb / .msi) are on the releases page.

Verify it:

medusa-agent doctor

That's it. The agent has auto-discovered every MCP client on the machine, wrapped each server with a gateway proxy, and is enforcing DLP policy from ~/.medusa/gateway-policy.yaml.


How it works

   AI assistant                  Medusa gateway proxy                MCP server
  (Cursor, Claude   ──JSON-RPC──▶   ┌────────────────────┐  ──────▶  (filesystem,
   Desktop, Codex)                  │  Policy engine     │            Supabase,
                                    │  ALLOW / BLOCK /   │            Stripe, …)
                                    │  COACH  / REDACT   │
                                    │        │           │
                                    │  DLP scanner       │
                                    │  on-device model   │
                                    │  + regex patterns  │
                                    │        │           │
                                    │  WriteAccumulator  │
                                    │  cross-request     │
                                    │  evasion detection │
                                    └────────────────────┘

Every JSON-RPC message — request and response, stdio and Streamable HTTP — is intercepted and evaluated. Nothing is sent anywhere; inference runs on the CPU.


What it catches

  • 9 DLP categories via an on-device ONNX model: secrets, PII, financial, health/PHI, source code, legal, insurance, HR, business-confidential — plus prompt-injection detection on tool results.
  • Deterministic regex detectors for SSN, credit card, AWS keys, GitHub tokens, RSA private keys, email, phone, and more — fire at confidence 1.0 alongside the model.
  • Cross-request evasion — WriteAccumulator reassembles content split across multiple write_file / append_file / edit_file calls and rescans the whole thing, so an agent can't smuggle a secret out one chunk at a time.
  • Tamper resistance — the agent detects and auto-repairs attempts to strip its own gateway wrapper from MCP config files, and refuses tool calls that target its protected paths.

Verdicts: ALLOW (forward unchanged) · BLOCK (stop at the gateway) · REDACT (forward with sensitive spans masked) · COACH (block + tell the LLM agent why, so it stops retrying).


Standalone vs connected

Standalone (default) Connected
Account None API key from a control plane
Network Zero calls Policy sync + telemetry
Policy Local gateway-policy.yaml Pushed from the control plane
Events Local SQLite only Uploaded to a dashboard

A control plane is an optional service that distributes policy to a fleet of agents and aggregates their telemetry — useful once you're running Medusa on more than one machine. It can be Medusa's hosted dashboard or a self-hosted one; the agent speaks the same open Control Plane API either way.

# Attach this agent to a control plane
medusa-agent connect --control-plane <url> --api-key <key>

# Detach — back to fully local
medusa-agent disconnect

The agent is open source and free, forever. The fleet dashboard is the commercial product.


CLI

Command Description
medusa-agent install Install the agent (standalone by default)
medusa-agent doctor Run diagnostic checks
medusa-agent connect Attach to a control plane
medusa-agent disconnect Detach — back to standalone
medusa-agent download-model Fetch the DLP model (pip installs)
medusa-agent status Daemon health, proxy count, policy version
medusa-agent monitor Security posture and findings
medusa-agent test Dry-run a tool call against the policy
medusa-agent logs Tail the agent log (-f to follow)
medusa-agent start / stop / restart Daemon control
medusa-agent store list / stats / clear Local event store
medusa-agent uninstall Remove the agent

Gateway policy

A standalone agent reads ~/.medusa/gateway-policy.yaml:

block_secrets: true
block_pii: true
block_financial: true
block_health: true
block_injections: true
scan_responses: true
coaching_enabled: true
sandbox_mode: false        # true = observe-only (log, don't enforce)
max_calls_per_minute: 60
blocked_tools: []
dlp_category_thresholds:
  pii: 0.65
  secret: 0.5
  financial: 0.5

Edit it and the daemon hot-reloads within seconds. A connected agent receives this same object, HMAC-signed, from its control plane.


Supported MCP clients

Claude Desktop · Cursor · Claude Code · OpenAI Codex · Windsurf · VS Code (Copilot) · Gemini CLI · Zed · Cline · Roo Code · Continue.dev · Amazon Q — plus a system-wide scan that picks up MCP servers from unknown clients.

Both stdio and Streamable HTTP MCP servers are proxied.


Platform support

Platform Service Installer
macOS launchd LaunchAgent .pkg
Linux systemd user service .deb
Windows Windows Service .msi

Development

git clone https://github.com/joshmaster2165/medusa-agent.git
cd medusa-agent
poetry install
poetry run pytest tests/ -q          # test suite
poetry run ruff check src/ tests/    # lint
poetry run ruff format src/ tests/   # format
src/medusa/
  gateway/      # proxy, policy engine, DLP scanner, write accumulator
  agent/        # daemon, installer, control_plane client, doctor
  cli/          # the medusa-agent CLI
  connectors/   # MCP client auto-discovery
  models/       # tokenizer + label map (ONNX model fetched separately)

See CONTRIBUTING.md to get started, and docs/control-plane-api.md for the agent↔control-plane wire contract.


Security

To report a vulnerability, see SECURITY.md. Please do not open a public issue for security problems.

License

Apache 2.0. The agent is free and open source. A commercial fleet dashboard is available separately.

Metadata

Release files for medusa-mcp 2.2.2

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

Source distribution (sdist)

Source distribution for medusa-mcp 2.2.2
File Size Uploaded Provenance Actions
medusa_mcp-2.2.2.tar.gz 404.9 kB Without provenance Details for medusa_mcp-2.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for medusa-mcp 2.2.2
File Interpreter ABI Platform Actions
medusa_mcp-2.2.2-py3-none-any.whl Python 3 none any Details for medusa_mcp-2.2.2-py3-none-any.whl

Total release size: 836.7 kB

Release files / medusa_mcp-2.2.2.tar.gz

Download URL medusa_mcp-2.2.2.tar.gz
Size 404.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9cd3732e94cc5fae1032232c0896bd4b3794ebb411668632925d88f19674fb2d
BLAKE2b-256 checksum
How to use checksums
66fcc7de22961a7e0c332a9a7c0fdd2d5132c459acc63f1da05efbbc832ee80e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / medusa_mcp-2.2.2-py3-none-any.whl

Download URL medusa_mcp-2.2.2-py3-none-any.whl
Size 431.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a88559360a16633a2f3dcae2759a354752e7754385e7ca6b21b0b7b05f38d5f
BLAKE2b-256 checksum
How to use checksums
a60760ebb91b7470735ac0f382da1a550403ba9a79d8afd5f257f8902e490f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for medusa-mcp 2.2.2

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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