Documentation Index
Fetch the complete documentation index at: https://docs.agentmark.co/llms.txt
Use this file to discover all available pages before exploring further.
MCP Trace Server
The@agentmark-ai/mcp-server package exposes your AgentMark traces to AI-powered editors through the Model Context Protocol (MCP). This enables AI assistants to query and debug your agent executions directly.
This is different from the AI Editor Integration which helps AI editors create AgentMark files. The MCP Trace Server provides trace debugging capabilities - allowing AI assistants to inspect execution logs, find errors, and analyze performance.
Overview
The MCP Trace Server provides two tools:| Tool | Description |
|---|---|
list_traces | List recent traces with metadata (status, latency, cost, tokens) |
get_trace | Get detailed trace data with span filtering and pagination |
Installation
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
AGENTMARK_URL | http://localhost:9418 | URL of the AgentMark API server |
AGENTMARK_API_KEY | - | API key for authentication (required for cloud) |
AGENTMARK_TIMEOUT_MS | 30000 | Request timeout in milliseconds |
Editor Setup
- Claude Code
- Cursor
- Claude Desktop
Add to your project’s
.mcp.json:Cloud Configuration
For AgentMark Cloud integration, add your API key:Tools Reference
list_traces
List recent traces with metadata. Returns trace IDs, names, status, latency, cost, and token counts. Parameters:| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Maximum traces to return (max: 200) |
sessionId | string | - | Filter traces by session ID |
datasetRunId | string | - | Filter traces by dataset run ID |
cursor | string | - | Pagination cursor from previous response |
0= OK1= Warning2= Error
get_trace
Get trace summary with filtered and paginated spans. Use this to drill into specific trace details. Parameters:| Parameter | Type | Default | Description |
|---|---|---|---|
traceId | string | - | Required. The trace ID to retrieve |
filters | array | - | Filter criteria for spans (see Filter Schema) |
limit | number | 50 | Results per page (max: 200) |
cursor | string | - | Pagination cursor from previous response |
| Field | Type | Description |
|---|---|---|
field | string | Field to filter on |
operator | string | Comparison operator |
value | string | number | Value to compare against |
| Field | Operators | Description |
|---|---|---|
status | eq | Span status (“0”=ok, “1”=warning, “2”=error) |
duration | gt, gte, lt, lte | Span duration in milliseconds |
name | contains | Span name substring match |
data.type | eq | Span type (“GENERATION”, “SPAN”, “EVENT”) |
data.model | contains | Model name substring match |
Error Handling
All tools return structured errors with error codes:| Code | Description |
|---|---|
CONNECTION_FAILED | Cannot reach the AgentMark server |
INVALID_QUERY | Malformed filter or unsupported field/operator |
NOT_FOUND | Trace or resource does not exist |
TIMEOUT | Request exceeded time limit |
Requirements
For local development, the MCP server connects to the AgentMark CLI local API server:- Run
agentmark devto start the local development server - Execute prompts to generate traces
- Use your AI editor to query and debug traces
Programmatic Usage
You can also use the server programmatically:Related Documentation
AI Editor Integration
Help AI editors create AgentMark files
Traces and Logs
Learn about AgentMark tracing
CLI Reference
Start the dev server with agentmark dev
Have Questions?
We’re here to help! Choose the best way to reach us:
- Email us at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about our business solutions