← MCP server and skill grades

mcp-language-server

isaacphi/mcp-language-server

D
Type
MCP server
Scanned
Nov 12, 2026
Version
e4395849a52e
Files read
278

This MCP server runs a local Language Server Protocol (LSP) executable such as gopls, Pyright, or rust-analyzer to give AI coding agents semantic navigation, diagnostics, symbol renaming, and line-based file editing on a project workspace. Its biggest risk is that none of its file tools enforce the configured --workspace boundary, so a prompt-injected agent can overwrite arbitrary existing files (such as shell startup scripts or .git/config) via edit_file or read sensitive files outside the project via hover.

What it can reach

Files
Reads, edits, renames, creates, and deletes files in the configured workspace directory, and because workspace boundaries are not enforced, can also read and overwrite existing files anywhere on the user's filesystem.
Shell commands
Spawns and communicates over stdio with the local language server executable specified by the --lsp flag and passes any arguments after --.
Secrets
Passes all environment variables from the MCP server process to the child language server process, and writes logs to LOG_FILE if set.

Findings

2 high
  1. HighUnrestricted file writes outside the workspace directory

    internal/tools/edit_file.go:22

    Even though the server requires a --workspace directory flag at startup, edit_file (and the underlying utilities.ApplyWorkspaceEdit helper used by edit_file, rename_symbol, and LSP workspace/applyEdit requests) never checks that target file paths stay inside that workspace or outside .git. If prompt injection in source code, an issue, or a webpage tricks the AI agent into calling edit_file on a path such as ~/.zshrc, ~/.bashrc, an agent config file, or .git/config (or on a symlink inside the workspace pointing elsewhere), the server overwrites that file on disk, which can lead to arbitrary code execution.

    Fix: Resolve target paths with filepath.Abs and filepath.EvalSymlinks in both the tool handlers and utilities.ApplyWorkspaceEdit, verify they stay strictly inside the configured workspace directory, and block modifications inside .git.

  2. HighArbitrary file reading outside the workspace via hover and diagnostics

    internal/tools/hover.go:13

    Neither hover nor diagnostics checks that filePath is within the configured --workspace directory before reading the file with client.OpenFile and os.ReadFile. In GetHoverInfo, when the language server returns empty hover content for a position (which occurs on plain-text and secret files with language servers such as Pyright, TypeScript, and clangd), the tool falls back to ExtractTextFromLocation and returns the raw line of text from disk, allowing a prompt-injected AI agent to read sensitive files like ~/.ssh/id_rsa, ~/.aws/credentials, or .env files line by line.

    Fix: Validate in client.OpenFile, GetHoverInfo, GetDiagnosticsForFile, and ExtractTextFromLocation that the symlink-resolved file path resides inside the configured workspace directory before reading from disk.