MCP Language Server logo

MCP Language Server

by isaacphi

The MCP Language Server is a Model Context Protocol (MCP) server that runs a language server and provides tools for communicating with it. It aims to bring the power of language servers to LLMs, enabling better code understanding and manipulation.

View on GitHub

Last updated: N/A

What is MCP Language Server?

The MCP Language Server acts as a bridge between Language Server Protocol (LSP) servers and Model Context Protocol (MCP) clients. It exposes LSP functionality through MCP, allowing LLMs to leverage language servers for tasks like code completion, definition lookup, and refactoring.

How to use MCP Language Server?

To use the server, you need to install Go, fetch the server, and install a language server for your desired language. Then, configure your MCP-enabled client (like Claude Desktop) with the server's command and arguments, specifying the workspace and LSP server paths. The README provides detailed setup instructions and configuration examples.

Key features of MCP Language Server

  • Retrieves source code definitions

  • Finds all references of a symbol

  • Provides diagnostic information (warnings, errors)

  • Retrieves code lens hints

  • Executes code lens actions

  • Applies text edits programmatically

Use cases of MCP Language Server

  • Enabling LLMs to understand code structure and relationships

  • Providing accurate symbol references to LLMs

  • Automating code refactoring tasks through LLMs

  • Integrating code analysis tools into LLM-based workflows

FAQ from MCP Language Server

What language servers are compatible?

The server has been tested with pyright (Python), tsserver (TypeScript), gopls (Go), and rust-analyzer (Rust), but it should be compatible with many more.

How do I find the path to my language server?

Use the which command (e.g., which pyright-langserver) to find the absolute path to your language server executable.

What is the purpose of the -- in the configuration?

Any arguments after -- are sent as arguments directly to the language server.

How do I enable debugging?

Include env: { "DEBUG": 1 } in your server configuration to get detailed LSP and application logs.

What features are planned for the future?

Planned features include hover info, code actions, better context handling, LSP server configuration options, a more scalable API for tools, and higher-level tools combining diagnostics, code lens, hover, and code actions.