Connect an MCP client
This page covers the public MCP connection path. It assumes you already have a key for your
self-hosted deployment and selected it with gnt target self-hosted as described in the
open-source quickstart.
Create a client artifact
Code
The command prints the MCP URL and bearer key once. Store the key as a secret. Do not commit it to a client configuration file.
Codex
Code
This writes the MCP entry to ~/.codex/config.toml. Restart Codex and run /mcp to confirm the
server is enabled. It does not intercept unrelated Codex work.
Claude Code
Code
This installs the remote MCP server. It does not intercept unrelated Claude Code work. In a
project whose production workflow should be governed, install the project-local hook explicitly
with gnt hooks install --fail-closed.
Cursor
Code
This writes the MCP entry to ~/.cursor/mcp.json. Restart Cursor and open Settings → Tools &
MCP to confirm gnt is enabled. Production enforcement still belongs at the workflow's action
boundary.
Gemini CLI
Code
The command prints the remote MCP configuration. The CLI does not install a Gemini tool interceptor, so enforcement belongs in the runtime or tool adapter.
OpenCode
Code
This merges the remote gnt server into ~/.config/opencode/opencode.json, stores the key in a
private ~/.gnt file, and installs a global tool.execute.before plugin. Read-only tools continue
normally. State-changing and custom tools must receive a proceed decision before OpenCode runs
them; service failures stop the action.
Any other MCP client
Use the URL and bearer header printed by gnt keys create --client generic. Configuration field
names vary by client. Connecting the server exposes the tools; deterministic enforcement still
belongs in that harness's pre-tool hook, tool adapter, or runtime boundary.
What "connected" means
| Client | MCP tools | Mechanical host interception |
|---|---|---|
| Claude Code | Installed | Explicit project-local hook |
| Cursor | Installed | Runtime adapter required |
| OpenCode | Installed | Runtime adapter required |
| Codex | Installed | Runtime adapter required |
| Gemini CLI | Installed | Runtime adapter required |
| Generic MCP client | Available | Runtime adapter required |
Do not give an unenforced client direct production credentials. Put refunds, sends, deletes, deploys, payments, and other consequential tools behind the adapter, then give the agent access to that governed tool instead.