Connect Claude Code
Claude Code’s tool calls go through the Gate: a policy decides each one, and each is sealed as a deed.
Before you start
- A running Deedglass server: the Quickstart gives you one on
127.0.0.1:8080(or the port you passed to--listen). - An agent key.
initsaved one to.deedglass/quickstart.key.
1. Add Deedglass, once, for every project
Section titled “1. Add Deedglass, once, for every project”This is the line the README and deedglass init print:
claude mcp add --scope user deedglass -- npx -y deedglass mcp serveNo key goes into Claude Code’s config. deedglass mcp serve finds the key init wrote: in .deedglass/ of the project Claude Code runs in, or a parent folder, and otherwise through ~/.deedglass/current.json, which init points at its stack whatever its port. So the same entry works in your own project, not only in the Quickstart folder. Use --scope project instead to write the server into this repo’s .mcp.json for your team.
To connect your own Postgres, deedglass connect prints a second line for it, with DEEDGLASS_API_KEY_FILE pointing at its agent’s key file.
Prefer HTTP, with no local process? deedglass mcp snippet --transport http --client claude-code prints this form; replace dg_test_REPLACE_ME with your key:
claude mcp add --transport http --header 'Authorization: Bearer dg_test_REPLACE_ME' deedglass http://127.0.0.1:8080/mcp/native2. Or wrap an MCP server you already use
Section titled “2. Or wrap an MCP server you already use”deedglass mcp wrap sits in front of any stdio MCP server. Claude Code starts the wrapper; the wrapper starts the server and sends every tools/call to the Gate first. This is the generated line for the demo’s filesystem server:
claude mcp add --env DEEDGLASS_API_KEY=dg_test_REPLACE_ME --env DEEDGLASS_SERVER=http://127.0.0.1:8080 --env PATH=/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin --transport stdio scratch -- /Users/you/txv/product/bin/deedglass mcp wrap --connector scratch -- /usr/local/bin/npx -y @modelcontextprotocol/server-filesystem@2026.8.31 /tmp/deedglass-demoMake one for your own server with deedglass mcp snippet --client claude-code --connector <name> -- <command> [args…].
3. Try it
Section titled “3. Try it”Ask Claude Code to drop a table in the demo database. The tool result says the call was blocked, names the rule, and gives the deed id. Then list what happened:
$ deedglass actions list --limit 5…What it doesn’t do
Section titled “What it doesn’t do”- It doesn’t change what Claude Code decides to do. It decides what Claude Code’s tool calls may do.
- Tools Claude Code runs on its own (its shell, file edits) don’t pass through MCP, so the Gate never sees them. Use Claude Code’s permission settings for those, and watch the session to see what its shell commands committed to Postgres.
- The key in the config is an agent key. It can’t change policies or approve anything.
- Your first policy
- Govern an MCP server: stdio wrap and the HTTP gateway in detail.
- Watch a Claude Code session’s database writes: what Postgres committed while it worked, shell commands included, and the undo SQL.