Transparent MCP wrapper with security middleware for real-time policy enforcement and visual monitoring.
The simplest way to use Defenter is to install the VS Code/Cursor extension:
- VS Code Marketplace: Install Defenter
- Open VSX (Cursor & others): Install Defenter
The extension automatically installs and protects all your MCP servers - no manual configuration needed!
Defenter Proxy Server is built as a transparent 1:1 MCP wrapper that intercepts all communication between AI clients and MCP servers. The architecture includes:
- Transparent Proxy Layer: 1:1 wrapper that directly intercepts and wraps MCP servers
- Security Middleware: Intercepts all MCP operations
- Redaction Engine: Client-side secrets detection before cloud submission
- Policy Enforcement: Cloud-powered policy decisions with local user confirmation
- MCP Monitoring: Visual monitoring logs for all MCP operations
server.py: Proxy server creationmiddleware.py: Security middleware implementation (pre/post operation interception)
- Client-side redaction engine (Gitleaks + PII regex patterns)
- Redacts secrets/PII from intercepted data BEFORE sending to Defenter cloud
- Fully offline, deterministic, idempotent
- Key files:
redactor.py,gitleaks_rules.py,pii_rules.py
security_policy.py: HTTP client for Defenter cloud policy API
logger.py: Structured loggingaudit_trail.py: Visual monitoring trail
- Cross-platform confirmation dialogs (macOS, Windows, Linux)
- Used for user confirmation when policy requires it or blocks operations
cli.py: CLI argument parsingconfig.py: Configuration managementids.py: Event/session ID generationjson.py: JSON/JSONC parsing utilitiesmcp_configs.py: MCP server config extraction
sequenceDiagram
participant AI as AI Client
participant Proxy as Defenter Proxy
participant Redact as Redaction Engine
participant Cloud as Defenter Cloud
participant Dialog as User Dialog
participant MCP as Wrapped MCP Server
AI->>Proxy: Tool Request
Proxy->>Redact: Redact Secrets
Redact-->>Proxy: Redacted Payload
Proxy->>Cloud: Policy Check (Redacted)
Cloud-->>Proxy: Decision
alt Allow
Proxy->>MCP: Forward Request
else Block
Proxy->>Dialog: Show Block Dialog
Dialog-->>Proxy: User Choice
alt User Allows
Proxy->>MCP: Forward Request
else User Blocks
Proxy->>AI: Security Violation
end
else Required Confirmation
Proxy->>Dialog: Request Confirmation
Dialog-->>Proxy: User Choice
alt User Confirms
Proxy->>MCP: Forward Request
else User Denies
Proxy->>AI: Security Violation
end
else Need More Info
Proxy->>AI: Missing Information Error
end
opt Request Forwarded
MCP-->>Proxy: Response
Proxy->>Redact: Redact Response
Redact-->>Proxy: Redacted Response
Proxy->>Cloud: Policy Check (Redacted)
Cloud-->>Proxy: Decision
alt Allow
Proxy->>AI: Forward Response
else Block
Proxy->>Dialog: Show Block Dialog
Dialog-->>Proxy: User Choice
alt User Allows
Proxy->>AI: Forward Response
else User Blocks
Proxy->>AI: Security Violation
end
else Required Confirmation
Proxy->>Dialog: Request Confirmation
Dialog-->>Proxy: User Choice
alt User Confirms
Proxy->>AI: Forward Response
else User Denies
Proxy->>AI: Security Violation
end
else Need More Info
Proxy->>AI: Missing Information Error
end
end
Flow Steps:
- Initialize: Proxy wraps target MCP server config
- Request Interception: Security middleware intercepts operation
- Local Redaction: Redact PII/secrets from request data
- Policy Check: Send redacted payload to Defenter cloud for analysis
- User Confirmation: If needed, show dialog for user decision
- Forward Request: If allowed, forward to wrapped MCP server
- Response Interception: Repeat redaction + policy check for response
- Forward Response: If allowed, return to AI client
defenter-proxy --name <wrapper-name> --wrapped-config <mcp-config-json>Configuration:
- Config file location:
~/.defenter/config.json
Requirements:
- Python ~3.11
- Dependencies in
pyproject.toml
- Secrets and PII are redacted client-side before any data is sent to Defenter cloud for policy analysis
- Visual monitoring of AI<->MCP communication
- Cloud policy engine analyzes redacted payloads only
- User has final control via confirmation dialogs