home / mcp / mcp language server

MCP Language Server

mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "isaacphi-mcp-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"
      }
    }
  }
}

You run an MCP language server that exposes a language server over stdio to help MCP-enabled clients navigate codebases with semantic tooling like go-to-definition, references, renaming, and diagnostics. This guide shows how to install the server and connect it to your preferred MCP client using different language servers.

How to use

Install the MCP language server and a language-server frontend of your choice. Start the MCP language server locally and configure your MCP client to launch the language server with the appropriate workspace and language-server executable. You can enable features such as definition lookup, references, hover information, diagnostics, and symbol renaming within your editor or client. Each language server variant is started as a stdio-based MCP endpoint, and environment variables you provide will be forwarded to the language server.

How to install

Prerequisites: you need a Go toolchain installed to build or install the MCP language server. You also need a supported MCP client configuration to run an MCP language server via stdio.

Install the MCP language server locally using Go’s install command.

Install a compatible language server for your workflow and prepare your MCP client with the appropriate workspace configuration.

language_server_go configuration

{
  "mcpServers": {
    "language_server_go": {
      "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"
      }
    }
  }
}

language_server_rust configuration

{
  "mcpServers": {
    "language_server_rust": {
      "command": "mcp-language-server",
      "args": [
        "--workspace",
        "/Users/you/dev/yourproject/",
        "--lsp",
        "rust-analyzer"
      ]
    }
  }
}

language_server_py configuration

{
  "mcpServers": {
    "language_server_py": {
      "command": "mcp-language-server",
      "args": [
        "--workspace",
        "/Users/you/dev/yourproject/",
        "--lsp",
        "pyright-langserver",
        "--",
        "--stdio"
      ]
    }
  }
}

language_server_ts configuration

{
  "mcpServers": {
    "language_server_ts": {
      "command": "mcp-language-server",
      "args": [
        "--workspace",
        "/Users/you/dev/yourproject/",
        "--lsp",
        "typescript-language-server",
        "--",
        "--stdio"
      ]
    }
  }
}

language_server_clang configuration

{
  "mcpServers": {
    "language_server_clang": {
      "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"
      ]
    }
  }
}

Other notes

The language server communicates over stdio. Any arguments after -- are forwarded to the language server, and any environment variables are passed along as well.

Troubleshooting and tips

If you encounter verbose logging, set LOG_LEVEL=DEBUG to see detailed messages for all components, including handshakes with the language server and its internal logs.

Available 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.