Enhance Code Navigation and Analysis
Language Server MCP Server exposes LSP tools like definition, references, and rename to LLMs for any supported language.
0.1.1Add to Favorites
Why it matters
Empower developers to navigate and understand complex codebases with advanced semantic analysis. This MCP server integrates with language servers to provide intelligent code assistance, improving development efficiency and code quality.
Outcomes
What it gets done
Provide definition lookup for symbols
Find all references to a symbol
Perform symbol renaming across the project
Generate code diagnostics and suggestions
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Retrieves the complete source code of the definition for any symbol (function, type, constant, etc.)
Finds all uses and references of a symbol throughout the code base
Provides diagnostic information for a specific file, including warnings and errors
Displays documentation, type hints, or other information on hover for a specified position
Renames a symbol throughout the project
Allows making multiple text edits to a file based on line numbers
Overview
Language Server MCP Server
Language Server MCP Server wraps a real Language Server Protocol server, such as gopls or pyright, exposing definition, references, rename, and diagnostics tools to LLMs. Use it when an LLM needs IDE-grade semantic code navigation in a real codebase instead of grep-based guessing.
What it does
Language Server MCP Server is an MCP server that runs and exposes a Language Server Protocol (LSP) server to LLMs, giving MCP-enabled clients semantic code-navigation tools, get definition, find references, rename, and diagnostics, instead of grepping through source files. It's explicitly the reverse of a "language server for MCP": it's an MCP wrapper around an existing LSP server for your language.
When to use - and when NOT to
Use it when you want an LLM to navigate a real codebase the way an IDE does: jumping to a symbol's definition, finding every usage of a function, checking hover documentation and type hints, renaming a symbol across a project, or reading a file's diagnostics. It requires Go to build the server itself, plus a language server for whatever language you're working in, gopls for Go, rust-analyzer for Rust, pyright for Python, and others, each installed and configured separately, with the workspace path and LSP command passed as flags. It's a semantic navigation layer, not a full IDE replacement, and it depends entirely on the quality of the underlying language server for the language in question.
Capabilities
- definition: retrieves the complete source code definition of any symbol, such as a function, type, or constant, from the codebase
- references: locates all usages and references of a symbol throughout the codebase
- diagnostics: provides diagnostic information for a specific file, including warnings and errors
- hover: displays documentation, type hints, or other hover information for a given location
- rename_symbol: renames a symbol across a project
- edit_file: makes multiple text edits to a file based on line numbers, described as a more reliable and context-economical alternative to search-and-replace editing
How to install
Install Go, then install the server:
go install github.com/isaacphi/mcp-language-server@latest
Install a language server for your language, for example gopls for Go, rust-analyzer for Rust, or pyright for Python, then configure your MCP client to run mcp-language-server with --workspace and --lsp flags pointing at your project and chosen language server, for example:
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": ["--workspace", "/Users/you/dev/yourproject/", "--lsp", "gopls"]
}
}
}
Some setups, like Go via Claude Desktop, additionally need PATH, GOPATH, GOCACHE, and GOMODCACHE environment variables set so the wrapped language server can be found and run correctly.
Who it's for
Developers using an LLM to work in a real, non-trivial codebase who want IDE-grade semantic navigation, definitions, references, renames, diagnostics, instead of relying on grep or the model's own guesses about where a symbol lives.
Source README
MCP Language Server
This is an MCP server that runs and exposes a language server to LLMs. Not a language server for MCP, whatever that would be.
Demo
mcp-language-server helps MCP enabled clients navigate codebases more easily by giving them access semantic tools like get definition, references, rename, and diagnostics.
Setup
- Install Go: Follow instructions at https://golang.org/doc/install
- Install or update this server:
go install github.com/isaacphi/mcp-language-server@latest - Install a language server: follow one of the guides below
- Configure your MCP client: follow one of the guides below
Go (gopls)
Install gopls: go install golang.org/x/tools/gopls@latest
Configure your MCP client: This will be different but similar for each client. For Claude Desktop, add the following to ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": ["--workspace", "/Users/you/dev/yourproject/", "--lsp", "gopls"],
"env": {
"PATH": "/opt/homebrew/bin:/Users/you/go/bin",
"GOPATH": "/users/you/go",
"GOCACHE": "/users/you/Library/Caches/go-build",
"GOMODCACHE": "/Users/you/go/pkg/mod"
}
}
}
}
Note: Not all clients will need these environment variables. For Claude Desktop you will need to update the environment variables above based on your machine and username:
PATHneeds to contain the path togoand togopls. Get this withecho $(which go):$(which gopls)GOPATH,GOCACHE, andGOMODCACHEmay be different on your machine. These are the defaults.
Rust (rust-analyzer)
Install rust-analyzer: rustup component add rust-analyzer
Configure your MCP client: This will be different but similar for each client. For Claude Desktop, add the following to ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"rust-analyzer"
]
}
}
}
Python (pyright)
Install pyright: npm install -g pyright
Configure your MCP client: This will be different but similar for each client. For Claude Desktop, add the following to ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"pyright-langserver",
"--",
"--stdio"
]
}
}
}
Typescript (typescript-language-server)
Install typescript-language-server: npm install -g typescript typescript-language-server
Configure your MCP client: This will be different but similar for each client. For Claude Desktop, add the following to ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"typescript-language-server",
"--",
"--stdio"
]
}
}
}
C/C++ (clangd)
Install clangd: Download prebuilt binaries from the official LLVM releases page or install via your system's package manager (e.g., apt install clangd, brew install clangd).
Configure your MCP client: This will be different but similar for each client. For Claude Desktop, add the following to ~/Library/Application\\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"/path/to/your/clangd_binary",
"--",
"--compile-commands-dir=/path/to/yourproject/build_or_compile_commands_dir"
]
}
}
}
<p><strong>Note</strong>:</p>
<ul>
<li>Replace <code>/path/to/your/clangd_binary</code> with the actual path to your clangd executable.</li>
<li><code>--compile-commands-dir</code> should point to the directory containing your <code>compile_commands.json</code> file (e.g., <code>./build</code>, <code>./cmake-build-debug</code>).</li>
<li>Ensure <code>compile_commands.json</code> is generated for your project for clangd to work effectively.</li>
</ul>
Other
I have only tested this repo with the servers above but it should be compatible with many more. Note:
- The language server must communicate over stdio.
- Any aruments after
--are sent as arguments to the language server. - Any env variables are passed on to the language server.
Tools
definition: Retrieves the complete source code definition of any symbol (function, type, constant, etc.) from your codebase.references: Locates all usages and references of a symbol throughout the codebase.diagnostics: Provides diagnostic information for a specific file, including warnings and errors.hover: Display documentation, type hints, or other hover information for a given location.rename_symbol: Rename a symbol across a project.edit_file: Allows making multiple text edits to a file based on line numbers. Provides a more reliable and context-economical way to edit files compared to search and replace based edit tools.
About
This codebase makes use of edited code from gopls to handle LSP communication. See ATTRIBUTION for details. Everything here is covered by a permissive BSD style license.
mcp-go is used for MCP communication. Thank you for your service.
This is beta software. Please let me know by creating an issue if you run into any problems or have suggestions of any kind.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.