Connect a CLI over MCP
Every session so far in this path has been a CLI agent NEXUS launched for you, inside its own terminal, configured from AI Providers in the rail. This page covers the other direction: an already-running CLI agent — inside NEXUS or entirely outside it — connecting back to NEXUS as an MCP client, to call the canvas and mesh tools covered in the Guides. Most day-to-day use of NEXUS never needs this page; it matters once you're building against NEXUS's protocol surface.
NEXUS's local MCP server is declared to a CLI the same way any stdio MCP server is: a standard entry naming a command to run and, optionally, an environment for it. The exact configuration keys depend on which CLI you are configuring — Claude Code, Codex, Gemini CLI, and the Chainabit CLI each read their own list of MCP servers from their own configuration file — but the shape is the same for all of them:
{
"mcpServers": {
"nexus": {
"command": "<path to the NEXUS MCP launcher>",
"args": [],
"env": {}
}
}
}Consult your CLI's own documentation for where that entry lives and what it calls the top-level key (mcpServers above is illustrative of the shape, not a NEXUS-specific requirement).
The credential is not an environment variable
Leave env empty and do not copy a capability token into provider configuration. NEXUS manages local authorization for the supported connection flow. If the client can no longer connect, reconnect through NEXUS or reopen the app; do not try to recover a token from local storage.
Verify the connection
Once the entry is in place and Nexus is running, start the CLI and call server/discover, followed by tools/list. Discovery checks the executable and protocol; the tool list also checks that the running app can serve your client.
Next
First tool call — send a real request and read the exact response back.