The MCP Language Server enables LLMs to navigate codebases using semantic tools like definitions, references, rename capabilities, and diagnostics through the Language Server Protocol.
To get started with the MCP Language Server:
go install github.com/isaacphi/mcp-language-server@latest
Install gopls:
go install golang.org/x/tools/gopls@latest
Configure your MCP client (example for Claude Desktop):
{
"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: You'll need to update environment variables based on your machine. The PATH
should include the path to both go
and gopls
. You can find these with echo $(which go):$(which gopls)
.
Install rust-analyzer:
rustup component add rust-analyzer
Configure your MCP client:
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"rust-analyzer"
]
}
}
}
Install pyright:
npm install -g pyright
Configure your MCP client:
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"pyright-langserver",
"--",
"--stdio"
]
}
}
}
Install typescript-language-server:
npm install -g typescript typescript-language-server
Configure your MCP client:
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/Users/you/dev/yourproject/",
"--lsp",
"typescript-language-server",
"--",
"--stdio"
]
}
}
}
Install clangd by downloading prebuilt binaries from the official LLVM releases page or install via your system's package manager.
Configure your MCP client:
{
"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"
]
}
}
}
Note: Replace /path/to/your/clangd_binary
with the actual path to your clangd executable. The --compile-commands-dir
should point to the directory containing your compile_commands.json
file.
The MCP Language Server provides several useful tools:
To enable verbose logging, set the LOG_LEVEL
environment variable to DEBUG
in your MCP client configuration:
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": ["--workspace", "/path/to/workspace", "--lsp", "language-server-executable"],
"env": {
"LOG_LEVEL": "DEBUG"
}
}
}
}
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.