MCP Language Server
by MCP-Mirror
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.
Last updated: N/A
What is MCP Language Server?
This server acts as a bridge between a Model Context Protocol (MCP) client (like Claude Desktop) and a Language Server Protocol (LSP) server (like pyright, tsserver, gopls, rust-analyzer). It allows LLMs to leverage the capabilities of language servers for tasks such as code completion, definition lookup, and refactoring.
How to use MCP Language Server?
- Install Go.
- Fetch the server using
go install github.com/isaacphi/mcp-language-server@latest
. - Install a language server for your desired language (e.g., pyright for Python).
- Configure your MCP client (e.g., Claude Desktop) to use the MCP Language Server, specifying the path to your project and the language server executable.
- Use the provided tools through the MCP client to interact with your code.
Key features of MCP Language Server
Retrieves the complete source code definition of symbols.
Locates all usages and references of a symbol.
Provides diagnostic information for a specific file.
Retrieves code lens hints for additional context and actions.
Allows making multiple text edits to a file programmatically.
Supports applying refactor requests, adding imports, and formatting code.
Use cases of MCP Language Server
Enhancing LLM-based code assistants with precise code understanding.
Automating code refactoring and maintenance tasks.
Improving the accuracy of code completion and suggestion features.
Integrating language-specific code analysis into LLM workflows.
FAQ from MCP Language Server
What language servers are supported?
What language servers are supported?
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?
How do I find the path to my language server?
Use the which
command in your terminal (e.g., which pyright
).
What is the purpose of the --
in the configuration?
What is the purpose of the --
in the configuration?
Any arguments after --
are sent as arguments to your language server.
Why do I need to set environment variables?
Why do I need to set environment variables?
Some language servers may require specific environment variables to function correctly (e.g., gopls
may require GOPATH
and GOCACHE
).
How do I get detailed logs?
How do I get detailed logs?
Include env: { "DEBUG": 1 }
in your MCP server configuration.