How langchain-ai/langsmith-mcp-server works
LangSmith MCP Server exposes LangSmith observability and management capabilities to MCP clients. A client request enters the MCP server, whose registered tools obtain request credentials and call domain handlers; handlers query LangSmith and return results, with optional character-budget pagination for thread history and trace runs. The README also documents prompt, dataset, experiment, and billing capabilities. The graph follows shown registration and call references; unsampled implementation details and some indirect runtime wiring are omitted.
Main entry points: register_tools.py Tool registration · server.py MCP server · traces.py Traces and threads · datasets.py Datasets and examples
Components 13
MCP Entry
- MCP server
langsmith_mcp_server/server.py - API-key middleware
langsmith_mcp_server/middleware.py - Tool registration
langsmith_mcp_server/services/register_tools.py
LangSmith Capabilities
- Traces and threads
langsmith_mcp_server/services/tools/traces.py - Datasets and examples
langsmith_mcp_server/services/tools/datasets.py - Experiments
langsmith_mcp_server/services/tools/experiments.py - Prompt management
langsmith_mcp_server/services/tools/prompts.py - Billing usage
langsmith_mcp_server/services/tools/usage.py
Shared Services
- Client and formatting helpers
langsmith_mcp_server/common/helpers.py - Character pagination
langsmith_mcp_server/common/pagination.py - Optional monitoring
langsmith_mcp_server/monitoring.py
External Systems
- LangSmith platform
Other components
- MCP client
Connections 19
- MCP client → MCP server: sends MCP requests
README.md - MCP server → API-key middleware: configures middleware
langsmith_mcp_server/server.py - MCP server → Tool registration: registers tools
langsmith_mcp_server/server.py - Tool registration → Traces and threads: dispatches trace tools
langsmith_mcp_server/services/register_tools.py - Tool registration → Datasets and examples: dispatches dataset tools
langsmith_mcp_server/services/register_tools.py - Tool registration → Experiments: dispatches experiment tools
langsmith_mcp_server/services/register_tools.py - Tool registration → Prompt management: dispatches prompt tools
langsmith_mcp_server/services/register_tools.py - Tool registration → Billing usage: dispatches usage tools
langsmith_mcp_server/services/register_tools.py - Tool registration → Client and formatting helpers: gets client
langsmith_mcp_server/services/register_tools.py - Tool registration → Optional monitoring: traces tool calls
langsmith_mcp_server/services/register_tools.py - Traces and threads → LangSmith platform: queries runs
langsmith_mcp_server/services/tools/traces.py - Datasets and examples → LangSmith platform: queries datasets
langsmith_mcp_server/services/tools/datasets.py - Experiments → LangSmith platform: lists projects
langsmith_mcp_server/services/tools/experiments.py - Billing usage → LangSmith platform: requests billing API
langsmith_mcp_server/services/tools/usage.py - Traces and threads → Character pagination: paginates results
langsmith_mcp_server/services/tools/traces.py - Datasets and examples → Client and formatting helpers: parses versions
langsmith_mcp_server/services/tools/datasets.py - Experiments → Client and formatting helpers: finds nested fields
langsmith_mcp_server/services/tools/experiments.py - API-key middleware → Optional monitoring: sets session context
langsmith_mcp_server/middleware.py - Prompt management → LangSmith platform: manages prompts
README.md