The LangSmith MCP Server enables language models to access and manage LangSmith observability platform data through a Model Context Protocol interface.
Conversation History: Retrieve paginated message history from conversation threads using character-based pagination
Prompt Management: List prompts with visibility filtering (public/private), get specific prompts by name, and get guidance on creating/pushing prompts
Traces & Runs: Fetch runs (LLM, chain, tool, retriever, etc.) from one or more projects with powerful Filter Query Language (FQL) support, filtering by run type, error status, root status, and trace ID; list projects with optional name filtering
Datasets & Examples: List datasets filtered by ID, type, name, or metadata; read individual datasets/examples; fetch examples with filtering, pagination, versioning, and splits; get guidance on creating datasets and updating examples
Experiments & Evaluations: List experiment projects for a given dataset with key metrics (latency p50/p99, cost, feedback stats) and get guidance on running experiments
Billing & Usage: Fetch organization billing usage (e.g., trace counts) for a specified date range with optional workspace filtering
Flexible Output & Deployment: Fetch runs in
pretty,json, orrawformats; deploy via hosted HTTP endpoint, Docker container, or local PyPI installationCharacter-Based Pagination: Stateless character-budget pagination (
page_number,max_chars_per_page,preview_chars) keeps responses within LLM context limits
Provides seamless integration with the LangSmith observability platform, enabling language models to fetch conversation history, manage prompts, retrieve traces and runs, work with datasets and examples, and access experiment and evaluation data from LangSmith projects.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LangSmith MCP Serverfetch the history of my conversation from thread 'thread-123' in project 'my-chatbot'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ฆ๐ ๏ธ LangSmith MCP Server

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.
๐ Example Use Cases
The server enables powerful capabilities including:
๐ฌ Conversation History: "Fetch the history of my conversation from thread 'thread-123' in project 'my-chatbot'" (paginated by character budget)
๐ Prompt Management: "Get all public prompts in my workspace" / "Pull the template for the 'legal-case-summarizer' prompt"
๐ Traces & Runs: "Fetch the latest 10 root runs from project 'alpha'" / "Get all runs for trace <uuid> (page 2 of 5)"
๐ Datasets: "List datasets of type chat" / "Read examples from dataset 'customer-support-qa'"
๐งช Experiments: "List experiments for dataset 'my-eval-set' with latency and cost metrics"
๐ Billing: "Get billing usage for September 2025"
๐ Quickstart
A hosted version of the LangSmith MCP Server is available over HTTP-streamable transport, so you can connect without running the server yourself:
URL:
https://langsmith-mcp-server.onrender.com/mcpHosting: Render, built from this public repo using the project's Dockerfile.
Use 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.
๐ ๏ธ Available Tools
The LangSmith MCP Server provides the following tools for integration with LangSmith.
๐ฌ Conversation & Threads
Tool Name | Description |
| Retrieve message history for a conversation thread. Uses char-based pagination: pass |
๐ Prompt Management
Tool Name | Description |
| Fetch prompts from LangSmith with optional filtering by visibility (public/private) and limit. |
| Get a specific prompt by its exact name, returning the prompt details and template. |
| Documentation-only: how to create and push prompts to LangSmith. |
๐ Traces & Runs
Tool Name | Description |
| Fetch LangSmith runs (traces, tools, chains, etc.) from one or more projects. Supports filters (run_type, error, is_root), FQL ( |
| List LangSmith projects with optional filtering by name, dataset, and detail level (simplified vs full). |
๐ Datasets & Examples
Tool Name | Description |
| Fetch datasets with filtering by ID, type, name, name substring, or metadata. |
| Fetch examples from a dataset by dataset ID/name or example IDs, with filter, metadata, splits, and optional |
| Read a single dataset by ID or name. |
| Read a single example by ID, with optional |
| Documentation-only: how to create datasets in LangSmith. |
| Documentation-only: how to update dataset examples in LangSmith. |
๐งช Experiments & Evaluations
Tool Name | Description |
| List experiment projects (reference projects) for a dataset. Requires |
| Documentation-only: how to run experiments and evaluations in LangSmith. |
๐ Usage & Billing
Tool Name | Description |
| Fetch organization billing usage (e.g. trace counts) for a date range. Optional workspace filter; returns metrics with workspace names inline. |
๐ Pagination (char-based)
Several tools use stateless, character-budget pagination so responses stay within a size limit and work well with LLM clients:
Where itโs used:
get_thread_historyandfetch_runs(whentrace_idis set).Parameters: You send
page_number(1-based) on every request. Optional:max_chars_per_page(default 25000, cap 30000) andpreview_chars(truncate long strings with "โฆ (+N chars)").Response: Each response includes
page_number,total_pages, and the page payload (resultfor messages,runsfor runs). To get more, call again withpage_number = 2, then3, up tototal_pages.Why itโs useful: Pages are built by JSON character count, not item count, so each page fits within a fixed size. No cursor or server-side stateโjust integer page numbers.
๐ ๏ธ Installation Options
๐ General Prerequisites
Install uv (a fast Python package installer and resolver):
curl -LsSf https://astral.sh/uv/install.sh | shClone this repository and navigate to the project directory:
git clone https://github.com/langchain-ai/langsmith-mcp-server.git cd langsmith-mcp-server
๐ MCP Client Integration
Once you have the LangSmith MCP Server, you can integrate it with various MCP-compatible clients. You have two installation options:
๐ฆ From PyPI
Install the package:
uv run pip install --upgrade langsmith-mcp-serverAdd 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" } } } }
โ๏ธ From Source
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 withwhich uv./path/to/langsmith-mcp-server: The absolute path to the project root (the directory containingpyproject.tomlandlangsmith_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).

๐ง Headers (tool invocation)
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 |
| โ Yes | Your LangSmith API key for tool calls (list prompts, fetch runs, etc.) |
| โ No | Workspace ID for API keys scoped to multiple workspaces |
| โ 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 |
| Session or thread id; stored in trace metadata as |
| Fallback if |
| 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
Environment variables are not used for tool invocation when using HTTP (headers are). They are used for:
Stdio transport โ fallback for credentials when no headers exist (see above).
Load tests โ e.g.
tests/load_test_sessions.pyreadsLANGSMITH_API_KEYfrom the environment (or a.envfile at the project root).Optional server monitoring โ tracing tool calls to a second LangSmith instance (see below).
Variable | Used for | Description |
| Stdio fallback, load tests | LangSmith API key (when not provided via headers) |
| Stdio fallback | Workspace ID (optional) |
| Stdio fallback | Custom endpoint URL (optional) |
Optional: Tool-call monitoring to a second LangSmith instance
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 |
| Yes (to enable) | API key for the LangSmith instance used for monitoring |
| No | Endpoint URL (default: cloud) |
| No | Workspace ID for the monitoring instance |
| No | Project name for monitoring traces (default: |
| Yes (to send traces) | Set to |
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.
๐ณ Docker Deployment (HTTP-Streamable)
The LangSmith MCP Server can be deployed as an HTTP server using Docker, enabling remote access via the HTTP-streamable protocol.
Building the Docker Image
docker build -t langsmith-mcp-server .Running with Docker
docker run -p 8000:8000 langsmith-mcp-serverThe API key is provided via the LANGSMITH-API-KEY header when connecting, so no environment variables are required for HTTP-streamable protocol.
Connecting with 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 key
Optional 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.Cursor Integration
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.
Health Check
The server provides a health check endpoint:
curl http://localhost:8000/healthThis endpoint does not require authentication and returns "LangSmith MCP server is running" when the server is healthy.
๐งช Development and Contributing
Prerequisites
Python 3.10+ (3.11+ recommended)
uv โ install with
curl -LsSf https://astral.sh/uv/install.sh | shLangSmith API key โ from smith.langchain.com
Node.js (optional) โ only if you want to use MCP Inspector to test the server (stdio or streamable-http)
Setup
git 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)Development workflow
Edit code in
langsmith_mcp_server/ortests/.Format and lint (required before committing):
make format make lintRun tests:
make test # Or a single file: make test TEST_FILE=tests/tools/test_dataset_tools.pyType-check (optional):
uv run mypy langsmith_mcp_server/
Testing with MCP Inspector
You can test the server with MCP Inspector using either stdio or streamable-http.
Start MCP Inspector:
npx @modelcontextprotocol/inspector@latestOpen http://localhost:6274 in your browser.
Connect in the Inspector:
Stdio: Choose stdio transport and configure the server command (e.g.
uv run langsmith-mcp-server) and setLANGSMITH_API_KEYin the environment.Streamable HTTP: Start the server first (
uv run uvicorn langsmith_mcp_server.server:app --host 0.0.0.0 --port 8000or Docker), then choose streamable-http, URLhttp://localhost:8000/mcp, and add headerLANGSMITH-API-KEY= your API key.
Load testing
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 3Options
Option | Default | Description |
|
| MCP endpoint URL |
| from |
|
| 10 | Number of concurrent sessions |
| 3 |
|
| off | Print step-by-step logs and first error traceback |
| โ | 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)Contributing checklist
Before opening a PR:
make formatandmake lintpassmake testpassesNew tools or behavior are documented (e.g. in CLAUDE.md if you change architecture or tools)
Error handling in tools returns
{"error": "..."}rather than raising
For more detail (adding tools, code standards, troubleshooting), see CLAUDE.md.
๐ License
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.