SentinelMCP
Enforces deterministic security policies as an inline firewall for MCP server tool calls, with AST-based validation, cryptographic audit logging, and CLI-based evaluation and verification.
README
SentinelMCP
Deterministic Policy Firewall & Runtime Governance Engine for Model Context Protocol (MCP)
Overview
SentinelMCP is a production-grade security gateway and runtime governance framework designed specifically for Model Context Protocol (MCP) servers and multi-agent AI swarms [1]. As AI agents increasingly gain autonomous access to enterprise filesystems, databases, and APIs via MCP, security risks such as prompt injections, unauthorized tool invocations, and data exfiltration have surged.
SentinelMCP acts as an inline policy firewall, intercepting JSON-RPC MCP tool calls, inspecting arguments against declarative AST-based rules, enforcing security limits, and recording an immutable, cryptographically verifiable audit trail.
Key Architecture & Features
- Policy-as-Code Engine: Declarative JSON/YAML policy definitions supporting glob pattern matching on tool names, regex inspections on argument values, and strict argument schema validation [2].
- Cryptographic Provenance Ledger: Append-only audit logging where each execution record is chained with SHA-256 hashes, ensuring tamper-proof traceability for compliance and auditing.
- High-Performance Proxy Gateway: Built on FastAPI and Pydantic v2, delivering sub-millisecond interception latency with async request handling.
- CLI & Testing Toolchain: Built-in CLI for evaluating tool calls against policies, running the gateway server, and verifying ledger integrity.
- Enterprise-Grade CI/CD: Fully tested with pytest, matrix tested across Python 3.11 and 3.12, and integrated with GitHub Actions workflows.
Installation
Clone the repository and install in editable mode with development dependencies:
git clone https://github.com/ateeqdesktop-dot/sentinel-mcp.git
cd sentinel-mcp
pip install -e .[dev]
Usage
1. Evaluating a Tool Call via CLI
You can test how SentinelMCP evaluates any MCP tool call against your security policies:
sentinel-mcp evaluate --tool fs_delete --args '{"path": "/home/user/document.txt"}' --policy policy.json
2. Running the Gateway Server
Start the SentinelMCP proxy server locally:
sentinel-mcp serve --host 127.0.0.1 --port 8000 --policy policy.json
3. Verifying Audit Ledger Integrity
Verify that the append-only audit trail has not been tampered with:
sentinel-mcp verify --ledger sentinel_audit.jsonl
Policy Configuration Example (policy.json)
{
"version": "1.0",
"default_action": "allow",
"rules": [
{
"id": "block-destructive-fs",
"tool_pattern": "fs_*",
"action": "deny",
"forbidden_arguments": [
"rm\\s+-rf",
"/etc/passwd",
"drop\\s+database"
]
},
{
"id": "limit-sql-queries",
"tool_pattern": "db_*",
"action": "allow",
"max_string_length": 500
}
]
}
Testing
Run the test suite with pytest and code coverage:
pytest --cov=sentinel tests/ -v
License
Distributed under the MIT License. See LICENSE for more information.
References
- Anthropic Model Context Protocol (MCP) Specification. Online Available.
- Open Policy Agent (OPA) Principles for Cloud-Native Security. Online Available.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.