Get the FREE Ultimate OpenClaw Setup Guide →

mcp-lspdriver-ts

A TypeScript SDK bridges IDE's LSP capabilities with MCP, designed for who building AI coding agents.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio opticlm-mcp-lspdriver-ts npx -y mcp-lsp-driver

How to use

The mcp-lsp-driver-ts server is a TypeScript-based MCP server that bridges Language Server Protocol (LSP) capabilities with the Model Context Protocol (MCP). It enables IDE integrations to expose LSP features (such as definitions, references, document symbols, and diagnostics) while persisting and resolving data through MCP’s disk-oriented, model-context-centric approach. This driver focuses on providing a smooth integration path for TypeScript-based editors and tooling, wiring LSP capabilities to MCP’s graph, metadata, and frontmatter tooling so you can build AI-assisted coding experiences that respect on-disk truth and semantic anchors.

To use the server, install or run the MCP LSP driver package in your environment, then connect your editor or tooling through an appropriate transport (for example stdio or a custom IPC channel) and supply the IDE capabilities you implement, such as file access, edit handling, and LSP capability providers (definition, references, outline, diagnostics, etc.). The SDK handles fuzzy-to-exact resolution, turning semantic anchors (like symbolName and lineHint) into precise coordinates before invoking the MCP-backed providers. You can rely on the driver to expose a suite of capabilities including GraphProvider for document relationships, FrontmatterProvider for YAML-like metadata, and GlobalFind across the workspace, all while using disk-based reads to reflect the true project state on disk.

In practice, you typically implement or supply:

  • FileAccessProvider to read disk files and folder trees.
  • EditProvider to apply or preview edits.
  • LSP capability providers (DefinitionProvider, DiagnosticsProvider, OutlineProvider, etc.).
  • IdeCapabilities that combines all providers and feeds them into installMcpLspDriver, then connect via a transport (e.g., StdioServerTransport).

How to install

Prerequisites:

  • Node.js (recommended: current LTS, e.g., Node 18+)
  • npm or pnpm

Install the MCP LSP Driver:

# Using npm
npm install mcp-lsp-driver

# Or using pnpm
pnpm add mcp-lsp-driver

If you want to run it directly via npx without a local install:

npx -y mcp-lsp-driver

Basic usage (example):

  1. Create an MCP server instance and wire up transports
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
import { installMcpLspDriver, type IdeCapabilities } from 'mcp-lsp-driver'
// ... implement FileAccessProvider, EditProvider, and IDE capabilities as in the README examples
const server = new McpServer({ name: 'my-ide-mcp-server', version: '1.0.0' })

// Example capabilities object placeholder (fill with real implementations)
const capabilities: IdeCapabilities = {
  fileAccess: {
    readFile: async (uri) => '',
    getFileTree: async (uri) => [],
    readDirectory: async (uri) => []
  }
  // define other providers as needed
}

installMcpLspDriver({ server, capabilities })

const transport = new StdioServerTransport()
await server.connect(transport)
  1. Connect your editor or IDE to this server via the chosen transport. The driver will expose the configured capabilities and translate LSP requests into MCP-driven actions, using on-disk state to resolve references and definitions.

Additional notes

Tips and common issues:\n- Ensure Node.js version compatibility with the mcp-lsp-driver package. Check the package.json for engine requirements.\n- Disk-based reads mean unsaved editor buffers will not reflect in MCP reads unless you explicitly write changes to disk. Plan your workflow accordingly.\n- When implementing EditProvider, decide whether to enable preview-and-apply or direct apply, or both, as the SDK prioritizes previewed edits when both are provided.\n- If you use pnpm, consider hoisting constraints and ensure transitive dependencies are resolved in your environment.\n- For frontmatter and graph-related features, ensure your filesystem layout supports the document patterns (e.g., YAML frontmatter at document start) expected by the FrontmatterProvider.\n- When troubleshooting, enable verbose logging in your MCP server to observe how semantic anchors are resolved into ExactPosition coordinates before invoking capability providers.

Related MCP Servers

Sponsor this space

Reach thousands of developers