Sentinel
A self-hosted governance layer for MCP servers that enforces policies, audits tool calls, and manages approvals for AI agents.
README
Sentinel
A self-hosted governance layer for MCP servers. Sentinel sits between your AI agents and the tools they call, evaluates every request against your policies, and writes an audit trail of what happened.
Runs entirely on your own machine. Postgres is the only hard dependency — no API keys, no cloud account, no phoning home.
agent ──▶ Sentinel proxy ──▶ policy engine ──▶ MCP server
│
└──▶ audit log
Why this exists
If you give an agent a set of MCP tools, you have handed it the ability to act. Most setups have no answer to three questions:
- Which tools is this agent allowed to call, under which conditions?
- What did it actually do?
- Who approved the thing that touched production?
Sentinel answers all three with a policy engine that evaluates conditions per call, an append-only audit log with before/after snapshots, and an approval workflow for anything you flag as sensitive.
What's in the box
| Policy engine | ALLOW/DENY rules with condition trees. DENY always wins — it cannot be overridden by a later ALLOW |
| Conditions | Two modes: SIMPLE (flat array) and ADVANCED (nested AND/OR expression trees) |
| MCP proxy | Multi-transport: HTTP, STDIO, WebSocket, SSE |
| Audit log | Every tool call, policy change, auth event, and admin action, with before/after snapshots |
| Multi-tenancy | Organizations → workspaces → members, scoped at the query layer |
| Approvals | Flag tools as sensitive; calls block pending human approval |
| Credentials | AES-256-GCM encryption at rest for upstream server credentials |
| Admin MCP server | 40 tools so an agent can administer Sentinel itself |
| A2A proxy | Agent-to-Agent protocol support |
| Web UI | Full admin and user console |
Quick start
Requires Node 20+, pnpm, and Postgres.
git clone https://github.com/gong8/sentinel-oss.git
cd sentinel-oss
cp .env.example .env # generate secrets, point DATABASE_URL at your Postgres
pnpm setup # install, generate client, push schema, seed
pnpm dev
Need a Postgres? docker compose up -d postgres starts one.
That gets you:
| Service | URL |
|---|---|
| Web console | http://localhost:5173 |
| Docs site | http://localhost:5174 |
| API | http://localhost:3000 |
| MCP proxy | http://localhost:3001 |
| Admin MCP | http://localhost:3003 |
The seed creates an Acme Corporation org with three users and prints their access tokens. Run
pnpm db:creds any time to print them again.
Point an agent at it
Add the proxy to your MCP client config:
{
"mcpServers": {
"sentinel": {
"url": "http://localhost:3001/mcp",
"headers": { "Authorization": "Bearer YOUR_ACCESS_TOKEN" }
}
}
}
Register upstream servers in the web console, write policies against their tools, and every call now routes through the policy engine.
Optional: agent features
Sentinel has a built-in admin agent (chat your way through configuration). It needs an LLM, and supports several providers — including fully local ones, so you never have to buy an API key:
- Ollama or any OpenAI-compatible endpoint (LM Studio, llama.cpp, vLLM) — local, free
- Anthropic, OpenAI, or Gemini — if you'd rather bring a key
Everything else in Sentinel works with no LLM configured at all.
Architecture
A pnpm + Turborepo monorepo.
| Package | Lines | What it does |
|---|---|---|
api |
~72k | tRPC API — services, routers, policy evaluation, audit |
web |
~73k | React admin + user console |
docs |
~11k | Documentation site |
shared |
~6k | Shared types, condition evaluation, admin tool defs |
mcp |
~4.7k | MCP proxy server (HTTP, STDIO, WebSocket, SSE) |
db |
~3.3k | Prisma schema — 67 models |
a2a |
~2.5k | Agent-to-Agent protocol proxy |
mcp-admin |
~1.7k | Admin MCP server (40 tools) |
Roughly 177k lines of source and 163k lines of tests across 218 test files.
The most reusable piece is packages/api/src/services/policyCondition.ts — a ~1,300-line condition
tree evaluator with no dependencies beyond Zod and a logger. It knows nothing about MCP, Prisma, or
Sentinel, and could be lifted into any project that needs policy expressions.
Deeper docs live in docs/ — start at docs/README.md.
Testing
pnpm test:unit # no database needed
pnpm test:integration # requires TEST_DATABASE_URL
pnpm test:security # tenant isolation, DENY precedence
pnpm test:e2e # Playwright
pnpm check # format, lint, types, tests
Project conventions
This codebase holds itself to a few non-negotiable rules, enforced by lint config and git hooks in
.claude/hooks/:
- No
astype assertions (exceptas const), noany, no@ts-ignore, noeslint-disable - Every database query scoped to
organizationId - All input validated with Zod
- Credentials encrypted before storage
- Sensitive actions audit logged, admin actions with before/after snapshots
- DENY policies cannot be bypassed, and that is tested explicitly
See CLAUDE.md for the full development guide.
Contributing
See CONTRIBUTING.md. Security issues: SECURITY.md.
License
GNU AGPL-3.0. If you run a modified Sentinel as a network service, you must make your modifications available to its users.
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.