How to connect Snapback to your agent: the skill, step by step
Snapback is a standard Model Context Protocol (MCP) server, so any MCP-capable agent connects and calls its tools — OpenClaw, GitHub Copilot, Hermes, Claude and Claude Code, Cursor, OpenAI Agents, or a custom client. Here's the whole flow, from zero to a diagnosed run.
Tool discovery → https://snapback.sh/.well-known/mcp.json · Machine guide → https://snapback.sh/llms.txt · MCP endpoint → https://api.snapback.sh/mcp (Streamable HTTP, JSON-RPC 2.0)
Install — three ways, pick what fits
Snapback ships on three channels. The MCP server is the core; the plugin and skill make it automatic.
- MCP server (any client) — connect
https://api.snapback.sh/mcpand call the tools directly. No install; works in Claude Code, Cursor, VS Code/Copilot, Windsurf, OpenClaw, Hermes. Also listed in the Official MCP Registry asio.github.ra1labsworkx-wq/snapback. - PyPI plugin (self-heal) —
pip install snapback-selfheal(zero dependencies) → wrap your calls withSnapbackInterceptor(auto_apply=True)and it auto-diagnoses + safe-heals on every error. - ClawHub skill (OpenClaw) —
clawhub install snapback-selfhealfrom your OpenClaw workspace (so it lands in your agent's skills dir), or import it in the Gateway.
The MCP server, the PyPI plugin, and the ClawHub skill all track the same release number (currently v1.7) — one Snapback version everywhere. Note: clawhub install installs relative to the current folder, so run it from your OpenClaw workspace, not a scratch dir.
One-click MCP config for the common clients (remote server, so it's just the URL):
# Claude Code
claude mcp add --transport http snapback https://api.snapback.sh/mcp
# Cursor / VS Code / Windsurf — an mcpServers entry:
# { "snapback": { "url": "https://api.snapback.sh/mcp", "transport": "streamable-http" } }Step 1 — Register the MCP server
Point your agent framework at the endpoint. In OpenClaw, for example:
openclaw mcp add snapback --transport streamable-http \
--url https://api.snapback.sh/mcp \
--header "Authorization: Bearer $SNAPBACK_TOKEN"
openclaw mcp reload
openclaw mcp probe snapback # confirm the tools are exposedOther frameworks use their own MCP-add command with the same URL. The token is optional — many tools are free without one.
Step 2 — Use the free tools (no token)
detect_loop(steps)— mid-run, is the agent repeating a tool call?budget_guard(...)— mid-run context / token / cost / step checks with suggested actions.diagnose_infra_error({error})— a cryptic infra error → its family + verified fix; library-first (no LLM), LLM fallback on a miss.search_docs(query)— learn the trace format, taxonomy, or pricing.session_start / session_step / session_end— a live guardian that watches a run and warns in real time.
The only top-level JSON-RPC methods are initialize, tools/list, tools/call. Calling a tool as a top-level method returns -32601 method not found. The result is in result.content[0].text as a JSON string — parse it.
{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"diagnose_infra_error",
"arguments":{"error":"unable to get local issuer certificate"}}}Step 3 — Diagnose a failed run
When a run fails, send the trace to diagnose_trace. The format is tolerant — send what you have; steps matter most:
diagnose_trace({trace: { final_status: "failed", steps: [
{index:1, action:"web_search", inputs:{query:"X"}, status:"success"},
{index:2, action:"web_search", inputs:{query:"X"}, status:"success"},
{index:3, action:"step_limit", error:"limit", status:"failed"} ]}})
// → { id, failure_class: "loop_repeated_tool_call",
// root_cause, fix_suggestion, confidence }Content in inputs/outputs is redacted server-side — you don't pre-redact. The verdict returns a real id you can pass to get_verdict or rate with submit_feedback.
Step 4 — Pay only when you diagnose
- Free starter allowance: self-register once —
POST /v1/agents/registerwith{"name":"my-agent","framework":"openclaw","accepted_terms":true}→ a token with 2,000 free diagnoses. - Pay-per-call (x402): POST your trace to
/mcp/x402with no token → HTTP 402 → sign a payment → get the verdict. ~$0.0032 USDC on Solana or EVM. No account, no limits.
Step 5 — Close the self-healing loop
- Before running: call
preflightoragent_memoryto see your recurring failure patterns. - During: stream steps to a live session, or call
detect_loop/budget_guard— act on the warnings. - On failure:
diagnose_trace, read thefix_suggestion+confidence, apply it, retry. - After:
submit_feedbackso the shared library improves for every agent.
Known patterns return in <1s (no LLM). A NOVEL failure needs an LLM call and can take up to ~25s — set your client timeout to >=30s and don't block your run loop on it. The mid-run guards and diagnose_infra_error are always <1s.
Machine-readable guide: https://snapback.sh/llms.txt · Tool discovery: https://snapback.sh/.well-known/mcp.json · MCP endpoint: https://api.snapback.sh/mcp. Free tools need no token; pay-per-call diagnosis via x402 on Solana or EVM (~$0.0032 USDC).