Skip to main content
Glama
Paisins

lsp-mcp-standalone

by Paisins
README.md
# Universal LSP MCP (Standalone)

A VS Code extension that exposes LSP features (definition / hover / references / declaration /
document symbols) over MCP, using an **isolated** language server process spawned by the extension
itself.

Key properties:
- **Zero global-settings pollution**: the extension spawns its own `gopls` process; it does NOT
  touch any `go.*` VS Code setting, so other projects' native gopls / code navigation keep working.
- **Multi-repo aware**: it reads VS Code `workspaceFolders` and passes them to gopls, so cross-repo
  symbols defined in other modules resolve.
- **Direct LSP requests**: it calls gopls via `textDocument/definition` etc. directly, bypassing the
  `vscode.executeDefinitionProvider` documentSelector limitation that makes other MCP bridges fail
  on cross-folder files.

## Build & install

```bash
pnpm install
pnpm build
pnpm package      # produces lsp-mcp-standalone.vsix
```

Install the vsix in your VS Code / VSCode-Server, then add to your project's `mcp.json`:

```json
{
  "mcpServers": {
    "lsp-mcp-standalone": {
      "url": "http://127.0.0.1:9528/mcp"
    }
  }
}
```

## Tools

- `definition(uri, line, character)`
- `declaration(uri, line, character)`
- `hover(uri, line, character)`
- `references(uri, line, character)`
- `document_symbols(uri)`

All positions are 1-based (matching editor display).