Before you start
- A monoscope project that receives data. The Node.js workshop sets one up.
- Claude Code or Cursor installed
- Permission to create API keys in the project (editor or admin)
By the end you'll have
- Created a per-person API key for your agent
- Connected Claude Code or Cursor to the hosted monoscope MCP server
- Checked the tool catalog from the client and with curl
- Asked about a failing endpoint and followed the tool calls behind the answer
A coding agent that reads only your code can tell you what might have gone wrong. With the monoscope MCP server, it reads the stored request and response that failed, the issue monoscope opened for it, and the logs and traces around it, then edits the code. The server is hosted at https://api.monoscope.tech/api/v1/mcp, so there is nothing to install or keep running.
1. Create an API Key for Your Agent
The MCP server uses the same API key as the REST API and the CLI. The key carries the project, so there is no project ID to pass.
Open Settings → API Keys, click New Key, enter a Key title such as claude-code-yourname, click Create key, and copy it. Or create one from the CLI:
monoscope api-keys create "claude-code-yourname" -o json
The CLI shows the plaintext key once. Give each person their own key, and do not put a raw key in a config file that other people share.
Details: API keys and auth and project scoping.
2. Connect Claude Code
Add the server with one command, then check that it connected:
export MONOSCOPE_API_KEY=<your-api-key>
claude mcp add --transport http monoscope https://api.monoscope.tech/api/v1/mcp \
--header "Authorization: Bearer $MONOSCOPE_API_KEY"
claude mcp list
In a Claude Code session, run /mcp to see monoscope with its tool catalog. To share the server with your team, put it in the repo’s .mcp.json with ${MONOSCOPE_API_KEY} in the header, so each person sets their own key.
Using Cursor instead? Go to step 3.
3. Connect Cursor
Cursor reads ~/.cursor/mcp.json for every project, or .cursor/mcp.json in one repo:
{
"mcpServers": {
"monoscope": {
"url": "https://api.monoscope.tech/api/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
monoscope then shows under Settings → MCP with its tools. Keep the key out of any file you commit. Other MCP clients use the same endpoint and the same Authorization header.
4. Check the Tools with curl
To confirm the key works without a client, list the first 10 tools:
curl -s -H "Authorization: Bearer $MONOSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-X POST https://api.monoscope.tech/api/v1/mcp \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
| jq '.result.tools[].name' | head -10
Every public REST operation is a tool with a verb-first name, such as list_issues, search_events or mute_monitor. Three workflow tools bundle several calls into one:
-
find_error_patternsranks the log patterns that are growing in the current hour. -
search_events_nlturns a plain-English description into a KQL query forsearch_eventsto run. -
analyze_issuereturns an issue with a written diagnosis: probable cause, key signals and next steps.
Details: Tool catalog.
5. Ask About a Failing Endpoint
Open the repo of the service in your agent and ask a question that needs production data. For example:
Which endpoints started failing in the last hour?
What did the failing POST /orders requests send, and what did we return?
Analyze the open issue for orders-service and tell me which file to change.
The agent picks the tools. The ones that answer these questions are find_error_patterns and list_issues to find what is failing, get_schema and list_facets to learn which fields exist, search_events to pull the failing requests with their bodies, and analyze_issue for the diagnosis.
6. Check the Evidence Before You Accept a Fix
Read the tool calls in the agent’s output, not only its summary. The arguments of each search_events call include its KQL query. Paste it into Explorer to see the same events. Each tool returns structuredContent with the parsed JSON, and isError: true when the call failed, so a failed query shows as a failure, not as an empty result.
Claude Code asks before each tool call unless you allow that tool. Tools can change monoscope data, such as monitors, dashboards and issue status, but they cannot reach your code or infrastructure through monoscope.
Details: Tool result envelope.
7. Close the Loop from the Agent
When the fix is in, ask the agent to watch for the error coming back:
Alert me if orders-service errors pass 50 in five minutes.
Acknowledge the issue for the GET /orders/:id error.
The agent uses create_monitor and ack_issue. The monitor and the issue status show in monoscope like any other, so your team sees what changed.
What You Built
Your coding agent now has the same production data you have: requests and responses, issues, logs, traces, metrics, monitors and dashboards, through one key scoped to one project. It can find a failing endpoint, read the payload that broke it, and leave a monitor behind after the fix.
Next Steps
- Investigate a production error from your terminal: the CLI and skills cover agents that run in a shell.
- From KQL query to dashboard and alert: learn the query language your agent writes.
- Set up the AI SRE and your first routine.
- Send your first trace from a Node.js API, if your project has no data yet.
