MCPShield
Registers PostgreSQL as an upstream MCP server and applies security policy, rate limiting, and audit logging to database tool calls.
Provides a security gateway for Stripe MCP tools, enforcing policies, requiring approvals for high-value operations such as stripe.refund, and logging audit events.
๐ก๏ธ MCPShield
Production Security Gateway, Policy Engine, Vulnerability Scanner, and Observability Platform for Model Context Protocol (MCP) Infrastructure.
๐ Table of Contents
Related MCP server: McpVanguard
1. Overview
Autonomous AI agents (in Claude Desktop, Cursor, LangChain, etc.) use MCP to interact with sensitive corporate services (Stripe, GitHub, SQL databases, filesystems, and AWS). Without an intermediary security boundary, agents are vulnerable to prompt injection, destructive actions (like dropping database tables), data exfiltration, and accidental transactions.
MCPShield sits as a reverse proxy between your AI agents and MCP servers:
AI Agent (Claude Desktop / Cursor / LangChain)
โ
โผ POST http://127.0.0.1:8000/mcp/{workspace}/{server}
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCPShield Gateway โ
โ โโโ [1] Scoped Identity & Auth Verification โ
โ โโโ [2] SSRF Guard (Blocks 127.0.0.1, 169.254.169.254) โ
โ โโโ [3] Rate Limiter & Token Budget Enforcer โ
โ โโโ [4] Deterministic Policy Engine (YAML/JSON Rules) โ
โ โโโ [5] Zero-Latency DLP & Secret Redaction (API keys, PII)โ
โ โโโ [6] Prompt Injection & Tool Redirection Guard โ
โ โโโ [7] Human-in-the-Loop Interceptor (if risk > threshold)โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ Authorized & Inspected Request
Upstream MCP Server (Stripe, Filesystem, Database, Custom)
โ
โผ Tamper-Evident SHA-256 Chained Audit Record
Verified Protocol Response to AI Agent2. โก 3-Minute Quickstart
Prerequisites
Python 3.11+ installed
Node.js 18+ installed
Step 1: Install Dependencies
# Install Python dependencies
pip install -r requirements.txt
# (Optional) Install Web Frontend dependencies for development
cd apps/web && npm install && cd ../..Step 2: Launch MCPShield
Choose whichever method you prefer:
Option A โ Windows One-Click Launcher (PowerShell):
.\run.ps1Option B โ Windows Batch File:
run.batOption C โ Standard Terminal Command (macOS / Linux / Windows):
python -m uvicorn apps.api.main:app --host 0.0.0.0 --port 8000Step 3: Open the Platform
Open your browser and navigate to:
๐ Live Cloud Web Console: https://mcpshield.onrender.com/ (Hosted 24/7 on Render)
๐ Local Web Console: http://127.0.0.1:8000 (or http://localhost:3050 for Vite)
๐ Swagger API Docs: https://mcpshield.onrender.com/docs (or http://127.0.0.1:8000/docs)
๐ Default Login Credentials
The system automatically seeds an enterprise demo tenant on first run:
Email:
admin@acme.aiPassword:
admin12345!
3. ๐ Step-by-Step Hands-on Tutorial
Step 1: Access the Dashboard
Go to http://127.0.0.1:8000.
Log in using
admin@acme.ai/admin12345!.You will see:
Security Score & Telemetry: Total protected calls, blocked invocations, and latency overhead (<20ms).
Servers & Tools Catalog: Registered MCP servers (Stripe, Filesystem, Postgres DB).
Policy Editor: Active deterministic rules.
Pending Approvals Queue: Requests flagged for human review.
Immutable Audit Trail: SHA-256 cryptographically chained event log.
Step 2: Start the Mock MCP Server
MCPShield includes a built-in mock server simulating real Stripe, Database, and Filesystem tools:
Open a new terminal window and run:
python apps/mock_server/server.pyThe mock server will start on http://127.0.0.1:8001.
Step 3: Run Your First Security Scan
Scan the mock MCP server to identify vulnerabilities:
# Run a passive scan against the endpoint
node cli/bin/mcpshield.js scan http://127.0.0.1:8001/Example Output:
[PASS] Authentication required: Bearer / Agent token enforced
[WARN] Excessive tool permissions detected: 'filesystem.write_file'
[INFO] Sensitive financial tool discovered: 'stripe.refund'
Overall Risk Score: 32/100 (LOW RISK)To export results for GitHub Advanced Security or CI/CD pipelines:
# Output SARIF 2.1.0 format
node cli/bin/mcpshield.js scan http://127.0.0.1:8001/ --sarif
# Fail CI pipeline if high or critical risks are discovered
node cli/bin/mcpshield.js scan http://127.0.0.1:8001/ --fail-on highStep 4: Connect Claude Desktop or Cursor
To secure an AI agent, configure its client to route MCP traffic through MCPShield's Gateway URL:
Claude Desktop Configuration
Edit your claude_desktop_config.json (located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/ on macOS):
{
"mcpServers": {
"mcpshield-gateway": {
"url": "http://127.0.0.1:8000/mcp/prod/stripe",
"transport": "http_post",
"headers": {
"x-mcp-agent-id": "FinanceAgent",
"Authorization": "Bearer ak_live_finance_agent_key_123",
"MCP-Protocol-Version": "2026-07-28"
}
}
}
}Cursor IDE Configuration
In Cursor Settings โ MCP Servers, add:
Name:
mcpshieldType:
commandorhttpURL:
http://127.0.0.1:8000/mcp/prod/database
Step 5: Test a Human-in-the-Loop Approval
MCPShield prevents agents from executing dangerous operations autonomously:
Send a high-value transaction through the gateway:
python -c " import requests payload = { 'jsonrpc': '2.0', 'id': 'test-1', 'method': 'tools/call', 'params': { 'name': 'stripe.refund', 'arguments': {'customer_id': 'cus_123', 'amount': 1200} } } res = requests.post('http://127.0.0.1:8000/mcp/prod/stripe', json=payload, headers={'x-mcp-agent-id': 'FinanceAgent'}) print(res.json()) "What happens:
Because
amount > $500, the deterministic policy intercepts the call.The gateway returns an
APPROVAL_REQUIREDstatus with a ticket ID.
Approve the Action:
Open the Web Console at http://127.0.0.1:8000.
Go to Pending Approvals.
Click Approve.
The operation executes and is recorded in the Immutable Audit Trail.
4. ๐ป CLI Reference
The CLI can be run instantly via npx (zero install) or locally:
# Instant zero-install
npx @rashmi2206/mcpshield scan <url>
# Global install
npm install -g @rashmi2206/mcpshield
mcpshield scan <url>Command | Purpose |
| Passively inspect any remote MCP server endpoint for vulnerabilities. |
| Generate a SARIF 2.1.0 security report for GitHub Advanced Security. |
| Exit with error code 1 in CI/CD if high-severity issues exist. |
| Check health, total calls, blocked requests, and latency. |
| Stream the 10 most recent SHA-256 hashed audit events. |
| List all registered MCP server endpoints and risk scores. |
| View discovered tools, schemas, and risk tiers. |
| Inspect autonomous agent credentials and assigned teams. |
5. โ๏ธ Configuration & Environment
Configuration is controlled via environment variables or a .env file in the workspace root:
Variable | Default Value | Description |
|
| Storage connection (SQLite or Cloud PostgreSQL). |
|
| Key used for signing session JWT tokens. |
|
| Environment mode ( |
|
| Backend port. |
| (Optional) | Optional Clerk Auth integration. |
6. ๐งช Running Tests
Run the full suite of automated unit, integration, and security tests:
pytest -vTest Suite Coverage:
tests/unit/test_policy_engine.py: Policy precedence and argument comparison filters.tests/unit/test_scanner.py: Vulnerability detection and SARIF generation.tests/unit/test_dlp.py: API key, credential, and PII redaction engine.tests/security/test_security.py: SSRF loopback blocking and prompt injection isolation.tests/integration/test_gateway.py: Full end-to-end gateway proxy validation.
7. โ Troubleshooting & FAQ
Q: I see Port 8000 already in use error.
Another instance of the backend is already running. In PowerShell:
Get-Process python | Stop-ProcessThen start the server again using .\run.ps1.
Q: How do I reset the database to a clean state?
Simply delete the local SQLite database file:
Remove-Item mcpshield.dbWhen you restart the server, it will automatically recreate the database and re-seed the default tenant (admin@acme.ai).
Q: What MCP specification revision is supported?
MCPShield is built to adhere to the MCP Specification (2026-07-28), supporting stateless JSON-RPC over HTTP POST with header-based protocol verification (MCP-Protocol-Version, Mcp-Method, Mcp-Name).
This server cannot be deployed
Maintenance
Related MCP Connectors
- gatewayOAuthai.sealgate
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Guarded MCP server for agent-readable business truth, provenance, readiness, and discovery.
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA centralized gateway platform for aggregating and managing multiple Model Context Protocol (MCP) servers through a single Electron-based interface. It provides enterprise-grade security features including policy-based access control, human-in-the-loop approval workflows, and comprehensive audit logging.-
- AlicenseNot gradedqualityAmaintenanceA security proxy and active firewall for the Model Context Protocol that protects host systems from malicious intent, prompt injection, and data exfiltration. It acts as an interception layer between AI agents and tools, providing real-time verification and multi-layered defense mechanisms.12MIT
- AlicenseNot gradedqualityDmaintenanceProvides a secure gRPC transport layer for the Model Context Protocol (MCP) with mutual TLS, token-based authentication, and fine-grained authorization. Includes comprehensive telemetry and a real-time visualization dashboard for monitoring AI model interactions and security events.1Apache 2.0
- FlicenseNot gradedqualityBmaintenanceA zero-trust gateway for securely brokering interactions between AI models and internal tools via the Model Context Protocol, with DLP, prompt injection defense, and LLM-as-a-Judge.-