Behavry Proxy MCP server
Commit Nov 11, 2026Enforces OPA/Rego policies, DLP scanning, and prompt-injection detection on MCP tool calls to secure AI agents.
Also known as Behavry-ai/behavry-proxy
- Stars
- 1
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 11, 2026
- License
- Apache-2.0
What is Behavry Proxy MCP?
Behavry Proxy enforces OPA/Rego policies, DLP scanning, and prompt-injection detection on MCP tool calls to secure AI agents.
Summary generated from the project's README
About Behavry Proxy MCP server
Securing AI agents that use MCP tools is the primary function of this governance proxy. It acts as an intermediary between clients like Claude Desktop, Cursor, or custom agents and your target MCP servers such as GitHub, Slack, or local filesystems. By intercepting every tool call, the proxy ensures that requests comply with security standards before they reach their destination.
Developers can implement fine-grained control using OPA and Rego policies to define per-server or per-action rules. The system includes a built-in DLP scanner that monitors for 26 different patterns, including AWS keys, GitHub tokens, and credit card numbers, while also detecting 21 different prompt injection patterns across seven attack classes. It is designed with a fail-closed security model, meaning all requests are denied if the OPA sidecar is unreachable.
Setup involves installing via pip and using docker compose to manage the proxy and OPA sidecar. Users can monitor real-time activity through a terminal-based TUI dashboard and review all decisions via JSON audit logs.
What you can do with it
- 1Preventing sensitive data leaksStop an AI agent from accidentally sending API keys or personal information through tool arguments.
Written from the project's README. Every use case is checked against a quote from it.
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablebehavry-ai/behavry-proxy is public and reachablegithub.com/behavry-ai/behavry-proxy ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-11github.com/behavry-ai/behavry-proxy ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the modelInstruction aimed at the model found in the description or READMEFinding
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubBehavry Proxy
Open-source inline MCP governance proxy — policy enforcement, DLP scanning, and injection detection for AI agents.
Behavry Proxy sits between your MCP clients (Claude, Cursor, custom agents) and MCP servers, intercepting every tool call. Each request is evaluated against OPA/Rego policies, scanned for sensitive data leaks, and checked for prompt injection — before the agent can act.
Agent (Claude, Cursor, etc.)
↓
Behavry Proxy ← OPA sidecar (Rego policies)
↓
Target MCP Server (GitHub, filesystem, database, Slack, etc.)
Why
AI agents that connect to tools via MCP can:
- Leak secrets — API keys, credentials, and PII in tool call arguments
- Be injected — attacker-controlled tool responses that hijack agent behavior
- Exceed authority — executing destructive operations without authorization
Behavry Proxy enforces governance at the protocol layer. Every tools/call passes through policy evaluation, DLP scanning, and injection detection. Agents that don't pass don't act.
Features
| Feature | Description |
|---|---|
| OPA/Rego Policies | Real policy engine, real policies. Default deny. Per-server, per-agent, per-action rules. |
| DLP Scanner | 26 patterns — AWS keys, GitHub/Slack/OpenAI tokens, credit cards, SSNs, JWTs, private keys, connection strings. Luhn + SSN validators to reduce false positives. |
| Injection Detection | 21 patterns across 7 attack classes — imperative commands, authority claims, permission expansion, role reassignment, encoded payloads, structured escalation, urgency framing. |
| Fail-Closed | OPA unreachable? All requests denied. Configurable to fail-open for development. |
| Rate Limiting | Per-agent sliding window with burst detection and spike anomaly detection. |
| Terminal Dashboard | Rich-based live TUI showing tool calls, decisions, DLP findings in real time. |
| Audit Log | JSON lines to file + stdout. Every decision recorded with full context. |
| Reference Policies | Ready-to-use Rego policies for filesystem, GitHub, database, Slack, web APIs. |
Quick Start
The proxy makes every decision by asking an OPA sidecar. Without a reachable OPA it denies every tool call — that is the fail-closed default, not a bug. Both paths below start one for you.
pip (recommended)
pip install behavry-proxy
behavry-proxy init # writes config/servers.yaml, policies/ and docker-compose.yml
docker compose up # starts the proxy and the OPA sidecar
init never overwrites files you have edited — pass --force if you want it to.
Proxy is at http://localhost:8080. OPA at http://localhost:8181.
To run the proxy directly against an OPA you already have:
behavry-proxy --opa-url http://localhost:8181
The reference policies ship inside the package, so the proxy has a valid
policy set to push even before you run init. Edit config/servers.yaml to
point at your own MCP servers.
Docker Compose from a clone
git clone https://github.com/Behavry-ai/behavry-proxy.git
cd behavry-proxy
cp config/servers.yaml.example config/servers.yaml
# Edit config/servers.yaml with your MCP server URLs
docker compose up
Verify
# Health check
curl http://localhost:8080/health
# Audit event counters
curl http://localhost:8080/stats
# List configured servers
curl http://localhost:8080/servers
Your First Governed Tool Call
curl -X POST http://localhost:8080/mcp/github \
-H "Content-Type: application/json" \
-H "X-Agent-Id: my-agent" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_repos",
"arguments": {"org": "behavry"}
}
}'
Connect Your MCP Client
Point your MCP client at the proxy URL instead of directly at the MCP server.
Claude Desktop
{
"mcpServers": {
"github-governed": {
"url": "http://localhost:8080/mcp/github",
"headers": { "X-Agent-Id": "claude-desktop" }
}
}
}
Claude Code
{
"mcpServers": {
"github-governed": {
"type": "url",
"url": "http://localhost:8080/mcp/github",
"headers": { "X-Agent-Id": "claude-code" }
}
}
}
See Configuration for Cursor, custom agents, and all options.
Writing Policies
Run behavry-proxy init to get an editable copy of the reference policies in
policies/. They're pushed to OPA on proxy startup.
Policies are Rego v1 and require OPA 1.0 or newer. They never define
decision themselves — decision.rego owns that and aggregates a deny set,
so any number of files can contribute a rule without colliding. Everything not
denied is allowed.
Block sensitive paths:
package behavry.authz
import rego.v1
deny contains {
"reason": "Sensitive path blocked",
"policy": "path_block",
} if {
input.request.mcp_server == "filesystem"
contains(input.request.resource, ".env")
}
Deny writes outside a sandbox:
package behavry.authz
import rego.v1
deny contains {
"reason": "Writes are limited to /tmp/sandbox",
"policy": "sandbox_only",
} if {
input.request.action in {"write", "create", "update"}
not startswith(input.request.resource, "/tmp/sandbox/")
}
Drop either file into policies/ and restart. See
Policies for the full input schema and testing with
opa eval.
Block on DLP findings:
package behavry.authz
decision := {
"result": "deny",
"reason": "Sensitive data in request",
"policy": "dlp_block"
} {
input.dlp.has_findings == true
}
See Policies Guide for the full input document reference and more examples.
Terminal Dashboard
Live view of proxy activity:
python -m behavry_proxy.tui.dashboard
# or with a specific audit file:
python -m behavry_proxy.tui.dashboard /path/to/audit.jsonl
DLP Patterns (26)
| Pattern | Severity | Validated |
|---|---|---|
| AWS Access Key | Critical | — |
| AWS Secret Key | Critical | — |
| GitHub Token | Critical | — |
| Slack Token | Critical | — |
| OpenAI API Key | Critical | — |
| Anthropic API Key | Critical | — |
| Google API Key | Critical | — |
| GCP Service Account | Critical | — |
| Stripe API Key | Critical | — |
| SendGrid API Key | Critical | — |
| JWT / Bearer Token | Critical | — |
| Private Key (RSA/EC/OpenSSH) | Critical | — |
| PGP Private Key | Critical | — |
| Connection String | High | — |
| Azure Storage Key | High | — |
| Azure SAS Token | High | — |
| GitLab Token | High | — |
| Twilio API Key | High | — |
| Slack Webhook | High | — |
| Discord Webhook | High | — |
| Docker Auth | High | — |
| Credit Card | High | Luhn ✓ |
| SSN | High | Format ✓ |
| Generic API Key | Medium | — |
| Credential Assignment | Medium | — |
| Low | Disabled |
Injection Patterns (21)
| Class | Severity | Count | Examples |
|---|---|---|---|
| Imperative Command | Critical | 3 | "ignore previous instructions" |
| Authority Claim | Critical | 4 | "I am your administrator", "SYSTEM:" |
| Permission Expansion | Critical | 3 | "you are now authorized to" |
| Role Reassignment | High | 4 | "act as", "DAN", "pretend to be" |
| Encoded Payload | High | 3 | Base64 >100 chars, Unicode escapes |
| Structured Escalation | High | 3 | <SYSTEM_ADMIN_OVERRIDE>, "role":"system" |
| Urgency Framing | Medium | 1 | "URGENT:", "IMMEDIATE ACTION REQUIRED" |
API
| Method | Path | Description |
|---|---|---|
| POST | /mcp/{server_id} |
MCP proxy endpoint |
| GET | /servers |
List configured servers |
| GET | /health |
Liveness + OPA status |
| GET | /stats |
Audit event counters |
Documentation
- Architecture — pipeline, components, design decisions
- Configuration — env vars, servers.yaml, MCP client setup
- Policies Guide — writing and testing Rego policies
- Commercial Upgrade — what Behavry Enterprise adds
Development
# Install dependencies
poetry install
# Run tests
poetry run pytest tests/ -v
# Run proxy locally
poetry run python -m behavry_proxy.main
# Lint
poetry run ruff check behavry_proxy/
License
Apache 2.0 — see LICENSE.
Built by Behavry. When you outgrow the proxy, we're here.
Behavry Proxy MCP questions
What happens if the OPA sidecar is unreachable?
The proxy follows a fail-closed default, meaning all requests are denied if OPA cannot be reached.
Can I use my own MCP servers with this proxy?
Yes, you can point the proxy to your own MCP servers by editing the config/servers.yaml file.