Skip to content

Commit 72f253a

Browse files
committed
Add mcp docs
1 parent 8853c66 commit 72f253a

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

integration/mcp.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: LangWatch MCP Server
3+
sidebarTitle: LangWatch MCP
4+
---
5+
6+
The [LangWatch MCP Server](https://www.npmjs.com/package/@langwatch/mcp-server) is a tool designed to aid finding, searching, and looking up LLM traces from the LangWatch platform via the [Model Context Protocol](https://modelcontextprotocol.io/introduction).
7+
8+
This server facilitates LLM development by allowing the agent to search for traces, understand all the steps in between a problematic output and try to fix the issue.
9+
10+
<iframe
11+
width="720"
12+
height="460"
13+
src="https://www.youtube.com/embed/ZPaG9H-N0uY"
14+
title="YouTube video player"
15+
frameborder="0"
16+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
17+
allowFullScreen
18+
></iframe>
19+
20+
## Setup in your Codebase
21+
22+
Check out [the integration guides](/integration/overview) to start tracking your agents so both you and Cursor/Windsurf/Claude Code or your favorite coding assistant can debug it.
23+
24+
## Setup in Cursor 👩‍💻
25+
26+
1. Navigate to the Cursor Settings
27+
2. Navigate to the MCP item in the sidebar
28+
3. Set the "name" as "LangWatch"
29+
4. Set the "type" to `command`
30+
5. Set the "command" to `npx -y @langwatch/mcp-server --apiKey=sk-lw-...`
31+
- `--apiKey`: Your LangWatch API key. This is mandatory and must be provided.
32+
- `--endpoint`: *Optional* The endpoint for the LangWatch API. Defaults to `https://app.langwatch.ai` if not specified.
33+
34+
> [!TIP]
35+
> 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.
36+
37+
<img alt="LangWatch MCP Setup" src="https://github.com/langwatch/langwatch/raw/main/assets/mcp-server/cursor-setup.light.webp" width="900" />
38+
39+
## Tools
40+
41+
The MCP Server provides the following tools:
42+
43+
### `get_latest_traces`
44+
45+
- **Description:** Retrieves the latest LLM traces.
46+
- **Parameters:**
47+
- `pageOffset` (optional): The page offset for pagination.
48+
- `daysBackToSearch` (optional): The number of days back to search for traces. Defaults to 1.
49+
50+
### `get_trace_by_id`
51+
52+
- **Description:** Retrieves a specific LLM trace by its ID.
53+
- **Parameters:**
54+
- `id`: The ID of the trace to retrieve.
55+
56+
## Usage in Cursor
57+
58+
To use these tools within Cursor, follow these steps:
59+
60+
1. **Open the Cursor Chat view:**
61+
- `Cmd + I`
62+
63+
2. **Ensure the MCP server is running:**
64+
65+
3. **Interact with your Agent:**
66+
- 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.
67+
68+
> "I just ran into an issue while debugging, can you check the latest traces and fix it?"
69+
70+
<img alt="LangWatch MCP Example" src="https://github.com/langwatch/langwatch/raw/main/assets/mcp-server/cursor-example.light.webp" width="900" />
71+
72+
73+
## 🛟 Support
74+
75+
If you have questions or need help, join our community:
76+
77+
- [Discord Community](https://discord.gg/kT4PhDS2gH)
78+
- [Email Support](mailto:support@langwatch.ai)

mint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
"integration/rest-api",
8888
"integration/rags-context-tracking",
8989
"concepts",
90-
"integration/cookbooks"
90+
"integration/cookbooks",
91+
"integration/mcp"
9192
]
9293
},
9394
{

0 commit comments

Comments
 (0)