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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。