Setup in your Codebase
Check out the integration guides to start tracking your agents so both you and Cursor/Windsurf/Claude Code or your favorite coding assistant can debug it.Setup in Cursor 👩💻
- Navigate to the Cursor Settings
- Navigate to the MCP item in the sidebar
- Set the “name” as “LangWatch”
- Set the “type” to
command
- Set the “command” to
npx -y @langwatch/mcp-server --apiKey=sk-lw-...
--apiKey
: Your LangWatch API key. This is mandatory and must be provided.--endpoint
: Optional The endpoint for the LangWatch API. Defaults tohttps://app.langwatch.ai
if not specified.
To aid in securing your keys, the MCP will first look at the global system environment variables
LANGWATCH_API_KEY
and LANGWATCH_ENDPOINT
to check if they have values as well as looking at arguments passed into the server on start.
Tools
The MCP Server provides the following tools:get_latest_traces
- Description: Retrieves the latest LLM traces.
- Parameters:
pageOffset
(optional): The page offset for pagination.daysBackToSearch
(optional): The number of days back to search for traces. Defaults to 1.
get_trace_by_id
- Description: Retrieves a specific LLM trace by its ID.
- Parameters:
id
: The ID of the trace to retrieve.
Usage in Cursor
To use these tools within Cursor, follow these steps:-
Open the Cursor Chat view:
Cmd + I
- Ensure the MCP server is running:
-
Interact with your Agent:
- Ask a question like the following to test the tools are accessible: *Note: When the tool is detected, you’ll need to run
Run tool
in the chat view for it to be called.
- Ask a question like the following to test the tools are accessible: *Note: When the tool is detected, you’ll need to run
“I just ran into an issue while debugging, can you check the latest traces and fix it?”
