Registry / llm-agents / lsp-mcp-server

lsp-mcp-server

JSON →
library1.1.15jsnpmunverified

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.

npm install lsp-mcp-server
INSTALL
IMPORT
SIG · LSP-MCP-SERVER
L
lsp-mcp-server
llm-agentsjavascriptv1.1.15
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

startServer
import { startServer } from 'lsp-mcp-server';
const { startServer } = require('lsp-mcp-server');
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.
LspMcpServer
import { LspMcpServer } from 'lsp-mcp-server';
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.
main
import { main } from 'lsp-mcp-server';
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.

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.

import { startServer } from 'lsp-mcp-server'; // A minimal example showing how to programmatically start the server. // In a real scenario, this server would typically be launched via a CLI // command or an external system like Claude Code as configured in ~/.mcp.json. async function runLspMcpServer() { console.log('Starting lsp-mcp-server programmatically...'); try { // In a production setup, command-line arguments would be parsed. // For this example, we'll simulate a minimal configuration. // The server listens on stdio by default when launched as a process. // Programmatic start might require more explicit config or a mock stdio stream. // The 'main' function typically handles argument parsing. // For simplicity, we'll just demonstrate importing a function. // To truly run it, you'd typically execute the built CLI: // `node dist/index.js --stdio` or `lsp-mcp-server --stdio` // Example of calling the main CLI entry point programmatically (if configured for direct call): // await main(); // This would block and expect stdio for LSP/MCP communication // For demonstration, let's just log and show a conceptual start. console.log('lsp-mcp-server is designed to be run as a background process, listening on stdio.'); console.log('Refer to the README for installation and configuration with Claude Code.'); console.log('Example command line invocation: lsp-mcp-server --stdio'); // In a realistic scenario, you might do something like this for testing: // const serverInstance = new LspMcpServer(/* config */); // await serverInstance.start(); // This quickstart focuses on showing the import, not a fully functional embedded server, // as its primary use case is CLI-based. } catch (error) { console.error('Failed to start lsp-mcp-server:', error); process.exit(1); } } // To run this script, you would first need to install and build the package: // npm install && npm run build // then `node your-script.js` runLspMcpServer();
lsp-mcp-server --version
Debug
Known issues
gotchaThe `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.
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.
affects: <1.0.0
gotchaThis 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.
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`).
affects: >=1.0.0
gotchaWhen 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.
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"]`.
affects: >=1.0.0
gotchaThe 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.
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.
affects: >=1.0.0
gotchaSecurity 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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'typescript-language-server'
The required language server for TypeScript/JavaScript is not installed or not accessible in the system's PATH.
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.
Error: EACCES: permission denied, open '/var/run/lsp-mcp-server.sock'
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.
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.
Error: Unsupported language 'mylang' in client configuration.
The MCP client (e.g., Claude Code) is requesting a language that is not configured or supported by your `lsp-mcp-server` instance.
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.
Error: The 'command' property in your lsp server configuration must be an absolute path: /path/to/my/server.js
The `command` specified in the `.mcp.json` for launching the `lsp-mcp-server` is a relative path.
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"`.
Upgrade
Version history
1.1.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
Bingbot
1
OpenAI (training)
1
Resources