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. - An agent key (
dg_test_…).initsaved one to.deedglass/quickstart.key.
1. Add the native gateway
Section titled “1. Add the native gateway”The server’s own tools (the Postgres connector and any other connector you set up) are one MCP endpoint, /mcp/native. This is the line deedglass mcp snippet --transport http --client claude-code prints:
claude mcp add --transport http --header 'Authorization: Bearer dg_test_REPLACE_ME' deedglass http://127.0.0.1:8080/mcp/nativeReplace dg_test_REPLACE_ME with your key. From the Quickstart directory you can let the shell fill it in:
claude mcp add --transport http --header "Authorization: Bearer $(cat .deedglass/quickstart.key)" deedglass http://127.0.0.1:8080/mcp/nativeAdd --scope project to write the server into this repo’s .mcp.json instead of your user config.
2. 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.
- 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.