clay login (or the CLAY_API_KEY environment variable). It is not meant to be run by hand.
Behavior
This command is a long-running MCP server, not a request/response command. It speaks the Model Context Protocol (JSON-RPC) on stdout and runs until the host disconnects (stdin closes). It does not emit the usual JSON success envelope. Failures that occur before the server starts still use the standard error envelope on stderr with a non-zero exit code. Configure a host to spawn it — no API key is written into the host config; the server uses the credential fromclay login or CLAY_API_KEY:
Switching workspaces
The connection is pinned to whichever workspace the stored credential was scoped to when the server started (seeclay login for how to switch it). Re-running clay login only updates the credential on disk — this MCP server already loaded the old one and keeps using it, so the host must restart or respawn it before the new workspace takes effect.
Errors
These occur before the server starts; once running, the server communicates over MCP instead.| Code | Exit | Notes |
|---|---|---|
auth_required | 3 | No credential available. Run clay login, or set CLAY_API_KEY. |
auth_invalid | 3 | Clay rejected the stored credential. Run clay login again. |
network_error | 5 | Could not reach Clay to establish the MCP connection. |

