{"id":13425,"library":"langsmith-mcp-server","title":"LangSmith Model Context Protocol (MCP) Server","description":"The `langsmith-mcp-server` package provides a TypeScript implementation of the Model Context Protocol (MCP) server, designed to integrate with LangSmith, a platform for developing, evaluating, and monitoring large language model (LLM) applications. This server acts as a gateway, exposing LangSmith's rich data (including conversation history, prompts, traces, runs, datasets, and experiments) through a standardized protocol. It offers functional parity with its official Python counterpart and is currently at version 0.1.7, indicating active development with potential for non-stable API changes before a 1.0 release. The package is primarily intended to be run as a standalone service, leveraging environment variables for configuration, though it also provides programmatic interfaces for embedding or advanced customization. Its key differentiators include native TypeScript support, a comprehensive set of tools for accessing LangSmith data, and standardized char-based pagination for large data fetches.","status":"active","version":"0.1.7","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install langsmith-mcp-server","lang":"bash","label":"npm"},{"cmd":"yarn add langsmith-mcp-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add langsmith-mcp-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primarily an ESM library. Use named imports. The `startServer` function initializes and runs the MCP server.","wrong":"const { startServer } = require('langsmith-mcp-server')","symbol":"startServer","correct":"import { startServer } from 'langsmith-mcp-server'"},{"note":"The main class for programmatic server instantiation. Named import is required.","wrong":"import LangSmithMcpServer from 'langsmith-mcp-server'","symbol":"LangSmithMcpServer","correct":"import { LangSmithMcpServer } from 'langsmith-mcp-server'"},{"note":"Import the `ServerOptions` interface using `import type` for type-only imports in TypeScript.","wrong":"import { ServerOptions } from 'langsmith-mcp-server'","symbol":"ServerOptions","correct":"import type { ServerOptions } from 'langsmith-mcp-server'"}],"quickstart":{"code":"import { startServer } from 'langsmith-mcp-server';\n\n// Ensure LANGSMITH_API_KEY and other environment variables are set\n// or passed via options if starting programmatically.\n// Example: process.env.LANGSMITH_API_KEY = 'your_key_here';\n\nasync function runMcpServer() {\n  try {\n    console.log('Starting LangSmith MCP Server...');\n    const server = await startServer({\n      port: process.env.PORT ? parseInt(process.env.PORT) : 8000,\n      langsmithApiKey: process.env.LANGSMITH_API_KEY ?? '' // Recommended: use env var\n    });\n    console.log(`LangSmith MCP Server running on port ${server.address()?.port}`);\n\n    // Keep the server running until explicitly stopped\n    // For a real application, you might want graceful shutdown handling\n  } catch (error) {\n    console.error('Failed to start LangSmith MCP Server:', error);\n    process.exit(1);\n  }\n}\n\nrunMcpServer();","lang":"typescript","description":"Demonstrates how to programmatically start the LangSmith MCP Server, setting configuration options like port and the LangSmith API key from environment variables."},"warnings":[{"fix":"Always review release notes when updating and consider pinning to exact patch versions in production environments.","message":"As the package is pre-1.0 (currently 0.1.7), its API and behavior are subject to change without strict adherence to semantic versioning. Breaking changes may occur in minor or patch releases.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Refer to the documentation for each tool regarding `page_number`, `max_chars_per_page`, `preview_chars`, and `total_pages` to correctly paginate through results.","message":"Data fetching tools like `get_thread_history` and `fetch_runs` utilize character-based pagination instead of item-based pagination. Users must account for `max_chars_per_page` and `total_pages` when iterating through results, which differs from typical array-based pagination.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade your Node.js environment to version 18 or newer using a version manager like `nvm` or by installing a recent LTS release.","message":"The server requires Node.js version 18 or higher. Running with older Node.js versions will result in startup failures or unexpected behavior.","severity":"gotcha","affected_versions":"<18.0.0"},{"fix":"Ensure `LANGSMITH_API_KEY` is set in your environment before starting the server, e.g., `LANGSMITH_API_KEY=your_key npx langsmith-mcp-server` or `process.env.LANGSMITH_API_KEY = '...'` for programmatic use.","message":"The `LANGSMITH_API_KEY` environment variable is essential for authentication with LangSmith. Failure to set it will prevent the server from accessing LangSmith resources and can lead to authentication errors or failures to fetch data.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Set the `LANGSMITH_API_KEY` environment variable before running the server, e.g., `export LANGSMITH_API_KEY='your-secret-key'` or pass it in the `ServerOptions` when starting programmatically.","cause":"The server failed to find the required LangSmith API key for authentication.","error":"Error: LANGSMITH_API_KEY is not set. Please set the LANGSMITH_API_KEY environment variable."},{"fix":"Upgrade your Node.js environment to version 18 or higher. Node.js 18+ includes the native `fetch` API which this server relies upon.","cause":"This error typically indicates that the Node.js version being used is too old and does not natively support the `fetch` API.","error":"TypeError: 'fetch' is not a function"},{"fix":"Stop the conflicting process, or specify a different port for the LangSmith MCP Server using the `PORT` environment variable (e.g., `PORT=8001 npx langsmith-mcp-server`) or in programmatic `ServerOptions`.","cause":"The default port (8000) or a specified port is already being used by another process on your system.","error":"Error: listen EADDRINUSE: address already in use :::8000"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"langsmith-mcp","cli_version":null}