LSP for Codex is a local Codex plugin. It gives Codex an MCP bridge for Language Server Protocol workflows:
- auto-detect likely language servers from workspace markers and file extensions
- explain install and requirement status
- install supported npm-distributed servers into a local cache after approval
- collect
publishDiagnosticsfrom language servers for edited files - query
textDocument/documentSymbolfor refactors
The plugin does not patch Codex CLI internals. It exposes the requested LSP capabilities as local MCP tools that Codex can call during an edit loop.
npm install
npm testThe plugin manifest lives at .codex-plugin/plugin.json, and the MCP server is declared in .mcp.json.
-
Clone this repository somewhere stable on your machine:
git clone https://github.com/EpicHigh/lsp-for-codex.git cd lsp-for-codex npm install -
Add the repository root as a local Codex plugin. The selected folder must be the folder that contains
.codex-plugin/plugin.json. -
Restart or reload Codex so it reads the plugin manifest and starts the MCP server declared in
.mcp.json. -
Confirm the plugin is available by asking Codex to use one of the LSP tools, or by running the CLI directly:
node src/cli.js servers node src/cli.js status /path/to/workspace
The plugin runs locally with node ./src/mcp-server.js. Language server downloads are not automatic; Codex must pass allowDownloads: true after user approval before lsp_install or --install-missing installs supported npm-distributed servers into the local cache.
The same implementation is available from the command line:
node src/cli.js detect /path/to/workspace
node src/cli.js status /path/to/workspace
node src/cli.js install /path/to/workspace --server typescript --yes
node src/cli.js install /path/to/workspace --language typescript --language javascript --language go --yes
node src/cli.js diagnostics /path/to/workspace --file src/index.ts --server typescript
node src/cli.js symbols /path/to/workspace --file src/index.ts --server typescriptLanguage selectors resolve to the primary code-intelligence server for each language and are deduplicated. For example, --language typescript --language javascript --language go targets typescript and gopls; gopls is reported as a manual requirement unless it is already on PATH.
Auto-installed servers are placed under:
~/.cache/lsp-for-codex/npm
Override with:
CODEX_LSP_CACHE=/custom/cache node src/cli.js install /repo --language typescript --yesThe registry includes the broad server matrix requested in the issue. The first implementation supports automatic npm installs for servers distributed through npm, including TypeScript, Bash, YAML, Pyright, Astro, Svelte, Vue, Prisma, PHP Intelephense, and ESLint via vscode-langservers-extracted. Native toolchain servers such as gopls, rust-analyzer, deno lsp, clangd, sourcekit-lsp, and jdtls are detected and used when their commands are already available.
Downloads are explicit: the MCP tool requires allowDownloads: true, and the skill instructs Codex to ask first.