Install
Three ways to put closegate in front of your AI agent.
Pick the install path that matches how your team works. All three are free, Apache-2.0, and run on your own infrastructure. 986 passing tests, 19 MCP tools, 11 jurisdictions out of the box.
Path 1 · Python library
Just the policy gate
The chokepoint primitive as a pure Python function. No MCP server, no Docker, no FastAPI. Wrap it around any LLM tool call. Works with Claude Agent SDK, OpenAI Apps SDK, LangGraph, Mastra, or your own custom agent loop.
pip install closegate-policy from decimal import Decimal
from closegate_policy.gate import (
Action, ActorContext, MatchContext, PolicyConfig, evaluate,
Allow, RequireHumanApproval, Deny,
)
decision = evaluate(
action=Action.CONFIRM,
match=MatchContext(
match_id="m-1",
state="PROPOSED_MATCH",
proposed_by="llm:claude",
source="llm",
match_type="exact_match",
amount_usd=Decimal("15000"),
),
actor=ActorContext(id="engine:autoconfirm", kind="engine"),
accounts={"5000-COGS"},
rationale=None,
config=PolicyConfig(...),
)
match decision:
case Allow():
... # mutate state, write audit, ship
case RequireHumanApproval(clause):
... # surface approval envelope with clause.text
case Deny(clause):
... # raise PolicyViolation Path 2 · MCP server
Drop into Claude Desktop, Cursor, OpenAI Apps SDK
The Model Context Protocol server with 19 finance tools tier-routed by reversibility. Speaks stdio, HTTP, and SSE transports — works with every MCP-compliant client.
pip install closegate-engine
# or run without installing:
uvx closegate-engine mcp serve --transport stdio Claude Desktop config
{
"mcpServers": {
"closegate": {
"command": "uvx",
"args": ["closegate-engine", "mcp", "serve", "--transport", "stdio"],
"env": {
"CLOSEGATE_ACTOR_ID": "human:your-name",
"CLOSEGATE_DB_PATH": "/Users/you/.closegate/recon.db"
}
}
}
} Cursor
{
"mcpServers": {
"closegate": {
"command": "uvx",
"args": ["closegate-engine", "mcp", "serve"],
"env": { "CLOSEGATE_ACTOR_ID": "human:your-name" }
}
}
} Smithery (one line)
npx -y @smithery/cli install closegate-engine --client claude Path 3 · Docker
Self-host the full reference workflow
The consolidated demo image — engine + agent + Vue workspace in one container. Perfect for fly.io, Render, Railway, or your own Kubernetes cluster. Multi-arch (linux/amd64 + linux/arm64) on GHCR.
docker run --rm \
-p 8000:8000 -p 8001:8001 -p 5173:5173 \
-e CLOSEGATE_ACTOR_ID="human:you" \
ghcr.io/neul-labs/closegate-demo:0.1.0 Or via Docker Compose (three separate services)
git clone https://github.com/neul-labs/closegate
cd closegate
docker compose up
# → http://localhost:5173 — the workspace Verify the install
One-line check
After install, confirm the gate works with a sanity import:
python -c "from closegate_policy.gate import evaluate, Action; print('closegate-policy ok')"
For the MCP server, run closegate-engine mcp inspect to list all 19
tools and their tier annotations. The output is the canonical surface
your AI client will see.
Inbound
Need help wiring closegate into your stack?
Most teams need ~80 engineering hours total to go from clone to first close-cycle pilot. DM the maintainer if you want to compare notes on integration shape — happy to talk regardless of fit.