Connects Claude directly to LangSmith's observability platform through a full set of read and write operations. You get tools for pulling conversation histories from threads, fetching traces and runs with FQL filtering, managing prompts and datasets, listing experiments with metrics, and checking billing usage. Everything uses character-based pagination to keep responses within token budgets. Useful when you're debugging production LLM apps, analyzing eval results across experiments, or building agents that need to reference past conversations and prompt templates. Ships with a hosted version over HTTP, or run it locally via uv with your LangSmith API key. Built by the LangChain team for both cloud and self-hosted LangSmith instances.

A production-ready Model Context Protocol (MCP) server that provides seamless integration with the LangSmith observability platform. This server enables language models to fetch conversation history, prompts, runs and traces, datasets, experiments, and billing usage from LangSmith.
The server enables powerful capabilities including:
A hosted version of the LangSmith MCP Server is available over HTTP-streamable transport, so you can connect without running the server yourself:
https://langsmith-mcp-server.onrender.com/mcpUse it like any HTTP-streamable MCP server: point your client at the URL and send your LangSmith API key in the LANGSMITH-API-KEY header. No local install or Docker required.
Example (Cursor mcp.json):
{
"mcpServers": {
"LangSmith MCP (Hosted)": {
"url": "https://langsmith-mcp-server.onrender.com/mcp",
"headers": {
"LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here"
}
}
}
}
Optional headers: LANGSMITH-WORKSPACE-ID, LANGSMITH-ENDPOINT (same as in the Docker Deployment section below).
Note: This deployed instance is intended for LangSmith Cloud. If you use a self-hosted LangSmith instance, run the server yourself and point it at your endpoint—see the Docker Deployment section below.
The LangSmith MCP Server provides the following tools for integration with LangSmith.
| Tool Name | Description |
|---|---|
get_thread_history | Retrieve message history for a conversation thread. Uses char-based pagination: pass page_number (1-based), and use returned total_pages to request more pages. Optional max_chars_per_page and preview_chars control page size and long-string truncation. |
| Tool Name | Description |
|---|---|
list_prompts | Fetch prompts from LangSmith with optional filtering by visibility (public/private) and limit. |
get_prompt_by_name | Get a specific prompt by its exact name, returning the prompt details and template. |
push_prompt | Documentation-only: how to create and push prompts to LangSmith. |
| Tool Name | Description |
|---|---|
fetch_runs | Fetch LangSmith runs (traces, tools, chains, etc.) from one or more projects. Supports filters (run_type, error, is_root), FQL (filter, trace_filter, tree_filter), and ordering. When trace_id is set, returns char-based paginated pages; otherwise returns one batch up to limit. Always pass limit and page_number. |
list_projects | List LangSmith projects with optional filtering by name, dataset, and detail level (simplified vs full). |
| Tool Name | Description |
|---|---|
list_datasets | Fetch datasets with filtering by ID, type, name, name substring, or metadata. |
list_examples | Fetch examples from a dataset by dataset ID/name or example IDs, with filter, metadata, splits, and optional as_of version. |
read_dataset | Read a single dataset by ID or name. |
read_example | Read a single example by ID, with optional as_of version. |
create_dataset | Documentation-only: how to create datasets in LangSmith. |
update_examples | Documentation-only: how to update dataset examples in LangSmith. |
| Tool Name | Description |
|---|---|
list_experiments | List experiment projects (reference projects) for a dataset. Requires reference_dataset_id or reference_dataset_name. Returns key metrics (latency, cost, feedback stats). |
run_experiment | Documentation-only: how to run experiments and evaluations in LangSmith. |
| Tool Name | Description |
|---|---|
get_billing_usage | Fetch organization billing usage (e.g. trace counts) for a date range. Optional workspace filter; returns metrics with workspace names inline. |
Several tools use stateless, character-budget pagination so responses stay within a size limit and work well with LLM clients:
get_thread_history and fetch_runs (when trace_id is set).page_number (1-based) on every request. Optional: max_chars_per_page (default 25000, cap 30000) and preview_chars (truncate long strings with "… (+N chars)").page_number, total_pages, and the page payload (result for messages, runs for runs). To get more, call again with page_number = 2, then 3, up to total_pages.Install uv (a fast Python package installer and resolver):
curl -LsSf https://astral.sh/uv/install.sh | sh
Clone this repository and navigate to the project directory:
git clone https://github.com/langchain-ai/langsmith-mcp-server.git
cd langsmith-mcp-server
Once you have the LangSmith MCP Server, you can integrate it with various MCP-compatible clients. You have two installation options:
Install the package:
uv run pip install --upgrade langsmith-mcp-server
Add to your client MCP config:
{
"mcpServers": {
"LangSmith API MCP Server": {
"command": "/path/to/uvx",
"args": [
"langsmith-mcp-server"
],
"env": {
"LANGSMITH_API_KEY": "your_langsmith_api_key",
"LANGSMITH_WORKSPACE_ID": "your_workspace_id",
"LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
}
}
}
}
Add the following configuration to your MCP client settings (run from the project root so the package is found):
{
"mcpServers": {
"LangSmith API MCP Server": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/langsmith-mcp-server",
"run",
"langsmith_mcp_server/server.py"
],
"env": {
"LANGSMITH_API_KEY": "your_langsmith_api_key",
"LANGSMITH_WORKSPACE_ID": "your_workspace_id",
"LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
}
}
}
}
Replace the following placeholders:
/path/to/uv: The absolute path to your uv installation (e.g., /Users/username/.local/bin/uv). You can find it with which uv./path/to/langsmith-mcp-server: The absolute path to the project root (the directory containing pyproject.toml and langsmith_mcp_server/).your_langsmith_api_key: Your LangSmith API key (required).your_workspace_id: Your LangSmith workspace ID (optional, for API keys scoped to multiple workspaces).https://api.smith.langchain.com: The LangSmith API endpoint (optional, defaults to the standard endpoint).Example configuration (PyPI/uvx):
{
"mcpServers": {
"LangSmith API MCP Server": {
"command": "/path/to/uvx",
"args": ["langsmith-mcp-server"],
"env": {
"LANGSMITH_API_KEY": "lsv2_pt_your_key_here",
"LANGSMITH_WORKSPACE_ID": "your_workspace_id",
"LANGSMITH_ENDPOINT": "https://api.smith.langchain.com"
}
}
}
}
Copy this configuration into Cursor → MCP Settings (replace /path/to/uvx with the output of which uvx).

When connecting over HTTP (e.g. streamable HTTP or a hosted MCP endpoint), the server uses headers for authentication and configuration. Your MCP client must send these with each request; no environment variables are required for tool invocation.
| Header | Required | Description |
|---|---|---|
LANGSMITH-API-KEY | ✅ Yes | Your LangSmith API key for tool calls (list prompts, fetch runs, etc.) |
LANGSMITH-WORKSPACE-ID | ❌ No | Workspace ID for API keys scoped to multiple workspaces |
LANGSMITH-ENDPOINT | ❌ No | Custom API endpoint URL (for self-hosted or EU region) |
Optional headers used only when server monitoring is enabled (for grouping traces by session):
| Header | Description |
|---|---|
mcp-session-id | Session or thread id; stored in trace metadata as session_id |
x-session-id | Fallback if mcp-session-id is not set |
x-request-id | Fallback for request-scoped grouping |
Stdio transport: When running the server over stdio (e.g. uvx langsmith-mcp-server), there are no headers. The server falls back to the environment variables LANGSMITH_API_KEY, LANGSMITH_WORKSPACE_ID, and LANGSMITH_ENDPOINT in the process environment so that tool invocation still works.
Environment variables are not used for tool invocation when using HTTP (headers are). They are used for:
tests/load_test_sessions.py reads LANGSMITH_API_KEY from the environment (or a .env file at the project root).| Variable | Used for | Description |
|---|---|---|
LANGSMITH_API_KEY | Stdio fallback, load tests | LangSmith API key (when not provided via headers) |
LANGSMITH_WORKSPACE_ID | Stdio fallback | Workspace ID (optional) |
LANGSMITH_ENDPOINT | Stdio fallback | Custom endpoint URL (optional) |
You can log every MCP tool call (with inputs and outputs) to a separate LangSmith project for monitoring and analytics. Set these in your environment (e.g. in a .env file at the project root; the server loads .env via python-dotenv):
| Variable | Required | Description |
|---|---|---|
LANGSMITH_MONITORING_API_KEY | Yes (to enable) | API key for the LangSmith instance used for monitoring |
LANGSMITH_MONITORING_ENDPOINT | No | Endpoint URL (default: cloud) |
LANGSMITH_MONITORING_WORKSPACE_ID | No | Workspace ID for the monitoring instance |
LANGSMITH_MONITORING_PROJECT | No | Project name for monitoring traces (default: mcp-server-monitoring) |
LANGSMITH_TRACING | Yes (to send traces) | Set to true so traces are sent to LangSmith (custom instrumentation) |
Each tool run is traced with run_type="tool" and a session_id in metadata (from the mcp-session-id, x-session-id, or x-request-id header when using HTTP, or generated per request).
If you use the hosted LangSmith MCP Server, anonymous usage data is sent to a separate LangSmith project so we can iterate and improve the product.
The LangSmith MCP Server can be deployed as an HTTP server using Docker, enabling remote access via the HTTP-streamable protocol.
docker build -t langsmith-mcp-server .
docker run -p 8000:8000 langsmith-mcp-server
The API key is provided via the LANGSMITH-API-KEY header when connecting, so no environment variables are required for HTTP-streamable protocol.
Once the Docker container is running, you can connect to it using the HTTP-streamable transport. The server accepts authentication via headers:
Required header:
LANGSMITH-API-KEY: Your LangSmith API keyOptional headers:
LANGSMITH-WORKSPACE-ID: Workspace ID for API keys scoped to multiple workspacesLANGSMITH-ENDPOINT: Custom endpoint URL (for self-hosted or EU region)Example client configuration:
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
headers = {
"LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here",
# Optional:
# "LANGSMITH-WORKSPACE-ID": "your_workspace_id",
# "LANGSMITH-ENDPOINT": "https://api.smith.langchain.com",
}
async with streamablehttp_client("http://localhost:8000/mcp", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
# Use the session to call tools, list prompts, etc.
To add the LangSmith MCP Server to Cursor using HTTP-streamable protocol, add the following to your mcp.json configuration file:
{
"mcpServers": {
"HTTP-Streamable LangSmith MCP Server": {
"url": "http://localhost:8000/mcp",
"headers": {
"LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here"
}
}
}
}
Optional headers:
{
"mcpServers": {
"HTTP-Streamable LangSmith MCP Server": {
"url": "http://localhost:8000/mcp",
"headers": {
"LANGSMITH-API-KEY": "lsv2_pt_your_api_key_here",
"LANGSMITH-WORKSPACE-ID": "your_workspace_id",
"LANGSMITH-ENDPOINT": "https://api.smith.langchain.com"
}
}
}
}
Make sure the server is running before connecting Cursor to it.
The server provides a health check endpoint:
curl http://localhost:8000/health
This endpoint does not require authentication and returns "LangSmith MCP server is running" when the server is healthy.
curl -LsSf https://astral.sh/uv/install.sh | shgit clone https://github.com/langchain-ai/langsmith-mcp-server.git
cd langsmith-mcp-server
uv sync # Install dependencies
uv sync --group test # Include test dependencies (pytest, ruff, mypy)
uvx langsmith-mcp-server # Verify CLI runs (stdio)
langsmith_mcp_server/ or tests/.make format
make lint
make test
# Or a single file:
make test TEST_FILE=tests/tools/test_dataset_tools.py
uv run mypy langsmith_mcp_server/You can test the server with MCP Inspector using either stdio or streamable-http.
Start MCP Inspector:
npx @modelcontextprotocol/inspector@latest
Open http://localhost:6274 in your browser.
Connect in the Inspector:
uv run langsmith-mcp-server) and set LANGSMITH_API_KEY in the environment.uv run uvicorn langsmith_mcp_server.server:app --host 0.0.0.0 --port 8000 or Docker), then choose streamable-http, URL http://localhost:8000/mcp, and add header LANGSMITH-API-KEY = your API key.A session-based load test opens many MCP sessions and calls the list_prompts tool in each, using langchain-mcp-adapters. Run from the CLI (no UI). The server must be running first.
uv sync --group load
# Terminal 1: start the server
uv run uvicorn langsmith_mcp_server.server:app --host 0.0.0.0 --port 8000
# Terminal 2: run the load test
uv run python tests/load_test_sessions.py --sessions 20 --calls-per-session 3
Options
| Option | Default | Description |
|---|---|---|
--url | http://localhost:8000/mcp | MCP endpoint URL |
--api-key | from .env | LANGSMITH_API_KEY (or set in project root .env) |
--sessions | 10 | Number of concurrent sessions |
--calls-per-session | 3 | list_prompts calls per session |
--debug | off | Print step-by-step logs and first error traceback |
--report PATH | — | Write a report after the run (see below) |
Report
Use --report PATH to write a JSON report after the test (e.g. --report load_test_report creates load_test_report.json with config, summary, per-session results, and first error).
uv run python tests/load_test_sessions.py --sessions 5 --report load_test_report
# Creates: load_test_report.json (in current directory)
Before opening a PR:
make format and make lint passmake test passes{"error": "..."} rather than raisingFor more detail (adding tools, code standards, troubleshooting), see CLAUDE.md.
This project is distributed under the MIT License. For detailed terms and conditions, please refer to the LICENSE file.
Made with ❤️ by the LangChain Team
io.github.ericm1018/skillfm-llm-cost-optimizer-openai-anthropic-usage
io.github.mikerawsonnz/llm-orchestration-agent
io.github.mikerawsonnz/authenticated-llm-agent
labforgedev/copilot-memory-mcp
csoai-org/agent-prompt-injection-firewall-mcp
io.github.mikerawsonnz/authenticated-multi-llm-agent