LangSmith MCP Server (TypeScript)
A TypeScript implementation of the Model Context Protocol (MCP) server for LangSmith. This is a full port of the official Python LangSmith MCP Server with 100% functional parity.
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"
Quick Start
LANGSMITH_API_KEY=your-key npx langsmith-mcp-server
Available Tools
The LangSmith MCP Server provides the following tools for integration with LangSmith.
Conversation & Threads
Prompt Management
Traces & Runs
Datasets & Examples
Experiments & Evaluations
Usage & Billing
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. - 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
From npm
npx langsmith-mcp-server
MCP Client Integration
Cursor / Claude Code
Add to your MCP settings:
{
"mcpServers": {
"langsmith": {
"command": "npx",
"args": ["langsmith-mcp-server"],
"env": {
"LANGSMITH_API_KEY": "your-key"
}
}
}
}
Environment Variables
Notes:
- Only
LANGSMITH_API_KEYis required for basic functionality LANGSMITH_WORKSPACE_IDis useful when your API key has access to multiple workspacesLANGSMITH_ENDPOINTallows you to use custom endpoints for self-hosted LangSmith installations or the EU region
Development and Contributing
Setup
# Clone the repository
git clone https://github.com/langchain-ai/langsmith-mcp-server-js.git
cd langsmith-mcp-server-js
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
LANGSMITH_API_KEY=your-key npm run dev
# Run production build
LANGSMITH_API_KEY=your-key npm start
Testing
# Run unit tests
npm test
MCP Inspector
For interactive development and debugging, use the MCP Inspector:
LANGSMITH_API_KEY=your-key npx @modelcontextprotocol/inspector npx .
This opens a browser UI where you can browse all tools, inspect their schemas, and invoke them interactively.
Verify the server responds
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}' | LANGSMITH_API_KEY=test npx . 2>/dev/null
Architecture
This is a direct port of the Python LangSmith MCP Server with the same module structure:
src/
index.ts # Entry point (stdio transport)
server.ts # McpServer setup
common/
helpers.ts # Client creation, data conversion utilities
pagination.ts # Char-based stateless pagination
formatters.ts # Message extraction and formatting
services/
register-tools.ts # MCP tool registration with Zod schemas
tools/
prompts.ts # Prompt management tools
traces.ts # Trace/run/project tools
datasets.ts # Dataset and example tools
experiments.ts # Experiment listing tools
usage.ts # Billing/usage REST API tools
Contributing
This TypeScript implementation is a community port of the official Python LangSmith MCP Server by LangChain.
Contributions are welcome! Please open an issue or pull request on GitHub.
License
This project is distributed under the MIT License. For detailed terms and conditions, please refer to the LICENSE file.