Skip to main content
The TruLayer MCP server exposes your observability data as tools that any MCP-compatible host can call — Claude Desktop, Cursor, Windsurf, VS Code Copilot, or your own AI agent. Instead of copy-pasting trace IDs from the dashboard, agents can query traces, fetch eval results, and search spans in context.

Prerequisites

  • Node.js 18+ or Python 3.11+
  • A TruLayer API key (tl_...) — get one from Dashboard → Settings → API keys
  • An MCP-compatible host (Claude Desktop, Cursor, Windsurf, VS Code with GitHub Copilot, or a custom agent)

Install

The TruLayer MCP server is published to npm. Install it globally or let your MCP host fetch it on demand:
Or run it directly without installing:

Configure your host

Claude Desktop

Add an entry to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Restart Claude Desktop. You will see a TruLayer tools indicator in the chat input bar.

Claude Code

Install TruLayer as a Claude Code skill so you can query your traces and evals directly from the Claude Code CLI:
Or add it manually to your project’s .claude/settings.json:
Once installed, use /mcp trulayer in Claude Code to query your workspace.

Cursor

Open Settings → MCP and add:

VS Code (GitHub Copilot)

Add to your workspace or user settings.json:
Set TRULAYER_API_KEY in your environment and run the server as a subprocess:

Available tools (skills)

Once connected, the following tools are available to your MCP host:

Example interaction

Once the server is running, you can ask your AI host natural-language questions about your traces:
“Show me the 10 most recent traces for the customer-support project and summarize which ones have failing evals.”
The host calls get_project to resolve the name, then list_traces, then list_evals for each trace ID — all without you writing a single API call.

Scoping with API key permissions

The MCP server authenticates as the API key you provide. Use a key scoped to read if you only need query access — no write permissions are required for any MCP tool. See API key scopes for how to create a read-only key.

Semantic search from an agent

The search_spans tool wraps the same endpoint as Semantic search. When your agent calls it with a natural-language query, TruLayer embeds the text server-side and returns the most similar spans. This requires a BYOK embedding key configured in Dashboard → Settings → Evaluators.

Adding TruLayer to a custom MCP host

If you are building your own MCP host or agent framework, connect to the server over stdio:

Troubleshooting

The server starts but returns no tools Check that TRULAYER_API_KEY is set and valid. Run npx @trulayer/mcp --version to confirm the package loaded. search_spans returns a 502 A BYOK embedding key is required for text-based search. Configure one in Dashboard → Settings → Evaluators. The host does not show TruLayer tools Some hosts require a restart after adding an MCP server. Check the host’s MCP logs for connection errors.

See also