{"id":16108,"library":"lsp-mcp-server","title":"LSP MCP Server Bridge for Claude Code","description":"The `lsp-mcp-server` package acts as a crucial intermediary, bridging the gap between AI models like Claude Code (using the Model Context Protocol, MCP) and existing Language Server Protocol (LSP) servers. This enables powerful semantic code intelligence features within AI-powered development environments, including go-to-definition, find references, code completion, diagnostics, and safe renames across 10 different programming languages such as TypeScript/JavaScript, Python, Rust, Go, and Java. It supports multi-root workspaces for monorepos, provides push-based diagnostics, and features automatic language server management. The current stable version is 1.1.15, indicating active development and maintenance. Its key differentiator is providing a robust, configurable, and secure integration layer for AI agents to leverage the rich capabilities of established LSP ecosystems without directly reimplementing language-specific intelligence.","status":"active","version":"1.1.15","language":"javascript","source_language":"en","source_url":"https://github.com/ProfessioneIT/lsp-mcp-server","tags":["javascript","mcp","lsp","language-server","claude","code-intelligence","typescript"],"install":[{"cmd":"npm install lsp-mcp-server","lang":"bash","label":"npm"},{"cmd":"yarn add lsp-mcp-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add lsp-mcp-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primarily a CLI tool, but `startServer` is an exported function for programmatic integration. Package requires Node.js >=18.0.0, so ESM syntax is expected. Ensure the package is built (e.g., `npm run build`) before importing from `dist` if not importing directly from source.","wrong":"const { startServer } = require('lsp-mcp-server');","symbol":"startServer","correct":"import { startServer } from 'lsp-mcp-server';"},{"note":"The main class for the server, useful for advanced programmatic control or extending its functionality. Most users will interact with the CLI or the `startServer` function.","symbol":"LspMcpServer","correct":"import { LspMcpServer } from 'lsp-mcp-server';"},{"note":"The entry point function used by the CLI. Calling this directly will execute the server's main logic, including parsing arguments and starting the server instance.","symbol":"main","correct":"import { main } from 'lsp-mcp-server';"}],"quickstart":{"code":"import { startServer } from 'lsp-mcp-server';\n\n// A minimal example showing how to programmatically start the server.\n// In a real scenario, this server would typically be launched via a CLI\n// command or an external system like Claude Code as configured in ~/.mcp.json.\n\nasync function runLspMcpServer() {\n  console.log('Starting lsp-mcp-server programmatically...');\n  try {\n    // In a production setup, command-line arguments would be parsed.\n    // For this example, we'll simulate a minimal configuration.\n    // The server listens on stdio by default when launched as a process.\n    // Programmatic start might require more explicit config or a mock stdio stream.\n    // The 'main' function typically handles argument parsing.\n    // For simplicity, we'll just demonstrate importing a function.\n\n    // To truly run it, you'd typically execute the built CLI:\n    // `node dist/index.js --stdio` or `lsp-mcp-server --stdio`\n\n    // Example of calling the main CLI entry point programmatically (if configured for direct call):\n    // await main(); // This would block and expect stdio for LSP/MCP communication\n\n    // For demonstration, let's just log and show a conceptual start.\n    console.log('lsp-mcp-server is designed to be run as a background process, listening on stdio.');\n    console.log('Refer to the README for installation and configuration with Claude Code.');\n    console.log('Example command line invocation: lsp-mcp-server --stdio');\n    \n    // In a realistic scenario, you might do something like this for testing:\n    // const serverInstance = new LspMcpServer(/* config */);\n    // await serverInstance.start();\n\n    // This quickstart focuses on showing the import, not a fully functional embedded server, \n    // as its primary use case is CLI-based.\n\n  } catch (error) {\n    console.error('Failed to start lsp-mcp-server:', error);\n    process.exit(1);\n  }\n}\n\n// To run this script, you would first need to install and build the package:\n// npm install && npm run build\n// then `node your-script.js`\n\nrunLspMcpServer();","lang":"typescript","description":"This quickstart demonstrates how to programmatically import and conceptually interact with `lsp-mcp-server` functions, although its primary usage is as a CLI tool. It highlights the `startServer` function and explains that the server is typically launched as a separate process configured by an MCP client like Claude Code."},"warnings":[{"fix":"Ensure your Node.js environment is updated to version 18.0.0 or later. Use `node -v` to check your current version and `nvm install 18 && nvm use 18` or similar tools to upgrade.","message":"The `lsp-mcp-server` requires Node.js version 18.0.0 or higher. Running with older Node.js versions may lead to unexpected errors, compatibility issues, or failures during installation and execution.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Refer to the 'Prerequisites' section in the `lsp-mcp-server` README for specific installation instructions for each language server you intend to use. Verify their presence by running their respective command (e.g., `tsserver --version`, `pylsp --help`).","message":"This package is a bridge and *requires* external language servers (e.g., `typescript-language-server`, `python-lsp-server`, `rust-analyzer`) to be installed and accessible in the system's PATH. Without these, code intelligence features for specific languages will not function.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update your `.mcp.json` configuration (e.g., `~/.mcp.json`) to use absolute paths for the `command` and the `lsp-mcp-server` script argument. For example: `\"command\": \"/usr/bin/node\", \"args\": [\"/absolute/path/to/lsp-mcp-server/dist/index.js\", \"--stdio\"]`.","message":"When configuring `lsp-mcp-server` in your MCP client (e.g., Claude Code's `.mcp.json`), the `command` and `args` paths must be absolute. Relative paths will likely cause the MCP client to fail to launch the server correctly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review the `languageServers` section of your `lsp-mcp-server` configuration. Ensure the `command` and `args` for each language are correct and match the installed language server. Check the `lsp-mcp-server` logs for specific errors when a language server fails to start.","message":"The server automatically manages language servers, including restarting them on crash. However, incorrect configuration (e.g., wrong server executable name, invalid arguments) can lead to language servers continuously crashing and restarting, consuming resources and preventing code intelligence.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If encountering issues with large files or files outside the expected workspace, consider adjusting the `fileSizeLimit` and `validateWorkspaceBoundaries` settings in your `lsp-mcp-server` configuration, or ensure files are properly within the project's defined workspace root. Exercise caution when modifying security settings.","message":"Security features like file size limits and workspace boundary validation are enabled by default. Large files or attempts to access files outside the designated workspace root might be rejected, leading to incomplete analysis or errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Install the `typescript-language-server` globally: `npm install -g typescript-language-server typescript`. For other languages, install their respective language servers as per the `lsp-mcp-server` documentation.","cause":"The required language server for TypeScript/JavaScript is not installed or not accessible in the system's PATH.","error":"Error: Cannot find module 'typescript-language-server'"},{"fix":"Ensure the directory where the server tries to create its socket (often `/tmp` or a configured `socketDir`) has appropriate write permissions for the user running `lsp-mcp-server`. Alternatively, configure a `socketDir` in a user-writable location in your `lsp-mcp-server` configuration.","cause":"The `lsp-mcp-server` attempted to create a socket file in a directory where it lacks write permissions, or an existing socket file has incorrect permissions.","error":"Error: EACCES: permission denied, open '/var/run/lsp-mcp-server.sock'"},{"fix":"Add the configuration for 'mylang' to your `lsp-mcp-server` configuration, specifying the command and arguments for its corresponding language server. Ensure the language server itself is installed and functional.","cause":"The MCP client (e.g., Claude Code) is requesting a language that is not configured or supported by your `lsp-mcp-server` instance.","error":"Error: Unsupported language 'mylang' in client configuration."},{"fix":"Update the `command` property in your `~/.mcp.json` or project-level `.mcp.json` to use an absolute path, e.g., `\"command\": \"/usr/bin/node\"` or `\"command\": \"/home/user/.nvm/versions/node/v18.17.1/bin/node\"`.","cause":"The `command` specified in the `.mcp.json` for launching the `lsp-mcp-server` is a relative path.","error":"Error: The 'command' property in your lsp server configuration must be an absolute path: /path/to/my/server.js"}],"ecosystem":"npm"}