Getting Started
1. Generate an API Key
Navigate to your application’s Settings > API Keys and create a new API key. Keep it safe - you’ll need it to configure your MCP client.2. Configure Your MCP Client
Add Monocle to your MCP client configuration. The setup varies by client:- OpenCode
- Claude Code
- Cursor
- Other Clients
Add to your OpenCode config file (
opencode.json):3. Start Asking Questions
Once connected, you can ask your AI assistant questions about your application:- “What exceptions occurred in the last hour?”
- “Show me the slowest API endpoints”
- “Find traces with errors from the checkout service”
- “What’s the P95 latency for the /api/users endpoint?”
Available Tools
Your AI assistant has access to the following tools:Traces
| Tool | Description |
|---|---|
list_traces | List distributed traces with filters (time range, status, service, search) |
get_trace | Get all spans for a specific trace by ID |
Logs
| Tool | Description |
|---|---|
list_logs | List application logs with filtering (severity, service, time range, trace ID) |
search_logs | Full-text search across log messages |
Exceptions
| Tool | Description |
|---|---|
list_exceptions | List exception groups with occurrence counts and affected users |
get_exception | Get detailed info about an exception group (stacktrace, timeline, affected routes) |
analyze_exception | AI-powered root cause analysis via Holmes |
Metrics
| Tool | Description |
|---|---|
list_instances | List service instances (pods/replicas) reporting metrics |
get_system_metrics | Get CPU, memory, heap, and event loop metrics |
Endpoints
| Tool | Description |
|---|---|
get_endpoint_stats | Get latency percentiles (P50, P95, P99), error rates, and throughput for an endpoint |
Navigation
| Tool | Description |
|---|---|
whoami | Get current authentication context (org, app, environment) |
list_environments | List available environments for your application |
list_apps | List applications in your organization |
Example Queries
Here are some examples of what you can ask your AI assistant: Debugging Errors- What exceptions happened in the last 24 hours? Show me the most frequent ones.
- Get the full stacktrace for the TypeError that’s affecting checkout.
- Analyze the NullPointerException and suggest a fix.
- What’s the P95 latency for POST /api/orders today?
- Find the slowest traces from the last hour.
- Show me CPU and memory usage for all instances.
- Search for logs containing ‘payment failed’.
- Show me error logs from the auth service in the last 30 minutes.
- Get all logs for trace ID abc123.
Environments
By default, requests use theproduction environment. To query a different environment, set the x-environment header in your MCP client configuration.
Authentication
MCP authentication uses your Monocle API key. Each API key is scoped to a specific application and can access all environments within that application. You can authenticate using either:Authorization: Bearer YOUR_API_KEYheaderx-api-key: YOUR_API_KEYheader