Guide
A CRM for Codex agents: connect the Deskhand MCP server in two commands
Codex can call MCP servers over streamable HTTP with a bearer token read from an environment variable. Deskhand is a hosted CRM and email desk built to be driven that way: the agent writes contacts, deals, notes, tasks and email drafts directly, and you watch and correct it in a console.
- One key per agent. Pause or revoke the Codex agent without touching any other agent or your own login.
- Every write recorded. The audit log names the agent and the run and keeps before and after values, so a run can be undone from the console.
- Safe retries. Send an idempotency key and a repeated call returns the first result instead of writing twice.
Connect Codex
- Sign in, open Agents, name the agent (for example
codex-1) and pick scopes. Copy the key; it is shown once. - Export the key in the shell that launches Codex, then add the server:
export DESKHAND_KEY=dh_xxxxxxxx # the key you just copied codex mcp add deskhand --url https://deskhand.grain64.com/api/mcp \ --bearer-token-env-var DESKHAND_KEY
That writes this block to ~/.codex/config.toml, which you can also edit by hand:
[mcp_servers.deskhand] url = "https://deskhand.grain64.com/api/mcp" bearer_token_env_var = "DESKHAND_KEY"
Check it with codex mcp list: the server shows as enabled with a bearer token. The key itself stays in your environment, not in the file.
What was exercised
With Codex CLI 0.163.0, codex mcp add wrote the block above and codex mcp list showed the server enabled with a bearer token. The same endpoint and bearer header were then driven with the official MCP TypeScript SDK: the tool list came back, upsert_contact created a contact and draft_email created a draft that list_email_status could read.
What to tell the agent
Put one line in the agent's instructions: "Save leads with upsert_contact, look them up with search_contacts, and stop and report if a call returns agent_paused." A paused agent gets a 403 with the reason, so it can tell you instead of retrying. By default the agent acts on its own within its scopes and daily caps; if you want to review before anything goes out, turn approval on.
Try it
Free during early access: 3 agents, each with its own key, a pause switch and the full audit log. Start free
Related: A CRM for Claude Code agents, Undo what an agent changed in your CRM, Docs