Connecting your editor
Zentri’s coordinator serves its tools over MCP: claims, plans, notices, questions, and decisions. Agents reach them through zt mcp, a small stdio server that forwards each call to the coordinator. This guide shows what zt sets up for you, and how to point another MCP client at a session by hand.
Every user brings their own agent credentials. Zentri never collects, proxies, stores, or resells model access or consumer subscription tokens. zt mcp carries only the Zentri session token.
Before you start
Section titled “Before you start”ztlogged in. See an engineer’s day.- A live session from
zt start. Every Zentri tool call acts as one session, and onlyzt startcreates a session and its token. - An MCP client that can start a stdio server, or one that speaks Streamable HTTP.
How zt mcp works
Section titled “How zt mcp works”MCP client --stdio--> zt mcp --HTTPS, session token--> coordinator /mcpzt mcpreadsZENTRI_SERVERfor the coordinator’s URL, and the session token fromZENTRI_SESSION_TOKEN, or else from the file thatZENTRI_SESSION_TOKEN_FILEnames. The server URL must use https, or http on a loopback host.- It refuses a token file that other users can read.
- It lists the coordinator’s tools when it starts and forwards each call unchanged. Each side negotiates its own MCP protocol revision, so the client’s MCP version does not matter.
- It gives up if the coordinator does not answer within 5 seconds at start, and fails a single call after 60 seconds.
- Its logs go to stderr.
The binary is zentri. zt is a shorter name for the same program.
1. Use a built-in kit when you can
Section titled “1. Use a built-in kit when you can”When the agent is claude, codex, or opencode, zt start writes the MCP server and the edit hooks into the session for you. There is nothing to configure:
zt start --agent codex "fix the flaky login test"These kits also add the hooks that claim each file before an edit. No other client gets them. See Claude Code, Codex, and OpenCode.
2. Start another command-line agent
Section titled “2. Start another command-line agent”For any other agent command, zt start writes only .zentri/session.json and the git hooks into the worktree, and starts the agent with these variables set:
| Variable | Value |
|---|---|
ZENTRI_SERVER |
The coordinator’s URL. |
ZENTRI_SESSION_ID |
This session. |
ZENTRI_SESSION_TOKEN_FILE |
A file, readable only by you, that holds the session token. |
ZENTRI_WORKTREE |
The session’s worktree. |
zt start --agent my-agent "add CSV export to the reports page"zt passes the task as the agent command’s last argument.
3. Add the MCP server to the client
Section titled “3. Add the MCP server to the client”Add this server to the client’s MCP configuration. It is the generic stdio configuration from the Zentri repository:
{ "mcpServers": { "zentri": { "command": "zentri", "args": ["mcp"], "env": { "ZENTRI_SERVER": "${ZENTRI_SERVER}", "ZENTRI_SESSION_ID": "${ZENTRI_SESSION_ID}", "ZENTRI_SESSION_TOKEN_FILE": "${ZENTRI_SESSION_TOKEN_FILE}", "ZENTRI_WORKTREE": "${ZENTRI_WORKTREE}" } } }}- Use your client’s syntax for environment references, such as
${env:NAME}. - Drop
envif your client passes its own environment to the servers it starts. - If the client does not find
zentrion itsPATH, give the absolute path to the binary.
When zt start did not launch the client
Section titled “When zt start did not launch the client”An editor you open yourself does not have the session’s variables, so references like ${ZENTRI_SERVER} are empty. In that case, write the values in. None of them is a secret, because the token stays in its file:
| Variable | Where to find it |
|---|---|
ZENTRI_SERVER |
The URL in the first line of zt status. |
ZENTRI_SESSION_ID |
session_id in .zentri/session.json in the session’s worktree. |
ZENTRI_SESSION_TOKEN_FILE |
$XDG_STATE_HOME/zentri/sessions/<session_id>.token, or ~/.local/state/zentri/sessions/<session_id>.token when XDG_STATE_HOME is unset. |
ZENTRI_WORKTREE |
The worktree path that zt status prints. |
Open the session’s worktree in the editor, so its edits land on the session’s branch. Use a local-dev session for this. With the openshell launcher, the agent works on a clone inside the sandbox, and only zt done brings the branch home. This setup follows from how zt mcp reads its environment. It has not been tested with any editor.
4. Check the connection
Section titled “4. Check the connection”When the client starts the server, it should list the Zentri tools, all named zentri_.... Ask the agent to call zentri_context. It returns the session, its intent and plan, the files it holds, and the other active sessions. The MCP tools reference lists every tool.
Without hooks, nothing claims a file before the agent edits it. Tell the agent to:
- call
zentri_claim_filebefore each edit, and never write a file it was denied, - call
zentri_submit_planafter it reads the task and before its first edit, - read its notices with
zentri_check_inbox. Without hooks, notices arrive only at the end of Zentri tool results.
The git pre-commit hook still claims staged files, sends a snapshot, and warns about held files and overlaps on each commit. It never blocks.
Streamable HTTP instead of stdio
Section titled “Streamable HTTP instead of stdio”The coordinator also serves MCP at <ZENTRI_SERVER>/mcp with the session token as a bearer token. This needs the token in an environment variable of the shell that starts the client:
export ZENTRI_SESSION_TOKEN="$(cat "$ZENTRI_SESSION_TOKEN_FILE")"{ "mcpServers": { "zentri": { "type": "http", "url": "${ZENTRI_SERVER}/mcp", "headers": { "Authorization": "Bearer ${ZENTRI_SESSION_TOKEN}" } } }}What can go wrong
Section titled “What can go wrong”Message from zt mcp |
Cause and fix |
|---|---|
ZENTRI_SERVER is not set |
The client did not pass the variable. Write it in, as in step 3. |
no session token: set ZENTRI_SESSION_TOKEN or ZENTRI_SESSION_TOKEN_FILE (zt start sets the file) |
Neither token variable reached zt mcp. |
token file ... is empty, or a refusal because others can read the file |
The path is wrong, or the file’s mode changed. zt start writes it with mode 0600. |
the coordinator rejected the session token (HTTP 401); the session may have ended |
zt done ended the session and deleted its token. Start a new session and update the path. |
the coordinator refused this token for MCP (HTTP 403); MCP needs a session token |
The token is a user token. MCP takes only a session token. |
the coordinator at ... did not answer within 5s |
The coordinator is down or unreachable from this machine. |
Limitations
Section titled “Limitations”- Kits exist only for Claude Code, Codex, and OpenCode. No editor kit exists, and no editor has been tested.
- Only those three kits claim files before each edit. Any other client gets advisory claims, plus the pre-commit hook, which warns and never blocks.
- A session’s tools act for that one session. Pointing several clients at one session makes them share its claims and plan.
- The session token ends with the session. After
zt done, the client’s server stops working until you point it at a new session. - The PRD and decision skills install only for the three kits. For another agent, copy
adapters/skills/zentri-prdandadapters/skills/zentri-adrfrom the Zentri repository into its skills or instructions.