Connect your coding agent
Connect a coding agent to Sazabi so it can investigate production while it writes code. Set up the CLI for terminal agents, or the MCP server for MCP clients.
Connect your coding agent to Sazabi and it can read your production logs while it works — trace an error to the code that caused it, or check whether a change actually fixed a problem. By the end of this guide your agent can query Sazabi and return real data from your project. Setup takes a few minutes.
What you get
Once connected, your agent can search your logs, look up issues, and run the same investigations you would run in a thread — from inside your editor or terminal. You ask in natural language ("what errors is checkout throwing in production?") and the agent queries Sazabi and answers with evidence.
Prerequisites
- A Sazabi account with at least one project that is receiving logs. If you have not sent logs yet, do the Quickstart first.
- A secret key. Create one at Settings > Secret keys. Secret keys grant full read and write (organization-wide by default, or scoped to one project), so store it in a secrets manager and never commit it.
Choose a path
There are two ways to connect.
Recommended for terminal agents: the CLI path. Install the sazabi CLI and its skill, and any terminal agent (Claude Code, Codex, OpenCode) can drive Sazabi through the same commands. Use the MCP path when your agent is a GUI client (Claude Desktop, ChatGPT) or you prefer wiring Sazabi in as an MCP server. It is the only path for GUI clients. Trade-offs: the CLI path is one identical procedure for every terminal agent; the MCP path is configured per client but works for clients that have no terminal. Do not use the CLI path for a GUI-only client that cannot run shell commands — use the MCP path there.
The CLI path
One procedure, identical for every terminal agent.
Install and authenticate the sazabi CLI
-
Install the CLI globally:
npm install -g @sazabi/cli@latest -
Sign in. This opens your browser for a device-code sign-in:
sazabi auth login -
Confirm you are authenticated and select your organization and project:
sazabi auth whoami sazabi organizations use <org-id> sazabi projects use <project-id>Run
sazabi organizations listandsazabi projects listif you need the IDs.
For non-interactive use (CI, headless agents), set the SAZABI_TOKEN environment variable to a secret key instead of running sazabi auth login.
Install the Sazabi skill
The skill teaches your agent how to use Sazabi effectively. Install it for your agent:
sazabi skill install claude-codeSupported agents are claude-code, codex, amp, and opencode. The default is a user-scoped install; add --project to install into the current repository instead.
Cursor does not support agent skills. Use Cursor Rules (.cursor/rules/*.mdc)
instead, or connect Cursor over the MCP path below.
Your terminal agent can now run sazabi commands — for example sazabi logs query, sazabi issues list, or sazabi memory search — to investigate your project.
The MCP path
For MCP clients, connect Sazabi as an MCP server. The server is at https://mcp.sazabi.com/mcp and authenticates with your secret key via the X-Sazabi-Secret-Key header.
Wherever a configuration below shows <YOUR_SECRET_KEY>, replace it with a secret key from Settings > Secret keys, and keep that file out of version control.
Claude Code
Add the server from your terminal:
claude mcp add --transport http sazabi https://mcp.sazabi.com/mcp \
--header "X-Sazabi-Secret-Key: <YOUR_SECRET_KEY>"Claude Desktop
In Claude Desktop, open Settings > Developer > Edit Config to open claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Windows: %APPDATA%\Claude\claude_desktop_config.json), then add:
{
"mcpServers": {
"sazabi": {
"type": "http",
"url": "https://mcp.sazabi.com/mcp",
"headers": {
"X-Sazabi-Secret-Key": "<YOUR_SECRET_KEY>"
}
}
}
}Cursor
Cursor reads MCP servers from ~/.cursor/mcp.json (global) or .cursor/mcp.json in a project. The same file serves both the Cursor editor and the Cursor CLI (cursor-agent). Add:
{
"mcpServers": {
"sazabi": {
"type": "http",
"url": "https://mcp.sazabi.com/mcp",
"headers": {
"X-Sazabi-Secret-Key": "<YOUR_SECRET_KEY>"
}
}
}
}You can also add it from Cursor's settings UI: Cursor Settings > MCP > Add new MCP server, using HTTP transport with the URL and X-Sazabi-Secret-Key header above.
Codex CLI
Add the server from your terminal — codex mcp add walks you through the configuration:
codex mcp add sazabiChoose the Streamable HTTP transport with URL https://mcp.sazabi.com/mcp, authenticating with a bearer token set to your secret key (the server accepts Authorization: Bearer <secret key> as well as the X-Sazabi-Secret-Key header). You can also edit ~/.codex/config.toml directly.
Codex Desktop
In Codex Desktop's MCP settings, add an HTTP server with URL https://mcp.sazabi.com/mcp and the X-Sazabi-Secret-Key header set to your secret key.
OpenCode
Add the server from your terminal — opencode mcp add walks you through adding a remote server — or add it to your OpenCode configuration (opencode.json) directly:
{
"mcp": {
"sazabi": {
"type": "remote",
"url": "https://mcp.sazabi.com/mcp",
"headers": {
"X-Sazabi-Secret-Key": "<YOUR_SECRET_KEY>"
}
}
}
}ChatGPT
In ChatGPT's connector settings, add a custom MCP server with URL https://mcp.sazabi.com/mcp and the X-Sazabi-Secret-Key header set to your secret key.
Try it: investigate production from your coding agent
With either path connected, ask your agent a question that requires your logs:
Use Sazabi to find the most recent ERROR logs in my project and summarize what is failing.The agent queries Sazabi and answers with the specific records it found.
Verify
Confirm the connection returns real data from your project.
- First, send a distinctive test event if you have not already — see Quickstart curl step, using body
sazabi quickstart test event 8842. - Ask your agent:
Use Sazabi to find the log with body "sazabi quickstart test event 8842". - The agent returns one matching record with service
quickstartand severityINFO.
If the agent cannot reach Sazabi, re-check the secret key and, for the CLI path, that sazabi auth whoami shows the right organization and project.