Semantic Python tools for Codex, backed by pyright-langserver, pyright, and Python.
This plugin exposes a local MCP server that gives Codex token-efficient Python code intelligence without relying on text search alone. It starts pyright-langserver --stdio per project root for semantic LSP queries and shells out to Pyright and Python for validation.
- Pyright LSP hover, definitions, references, document symbols, workspace symbols, diagnostics, and code actions.
pyright --outputjsontype diagnostics.python -m py_compilesyntax checks.- Lightweight
--selftestfixture for smoke testing the MCP server.
- Python 3.11 or newer.
pyrightonPATH.pyright-langserveronPATH.
Install Pyright with npm if needed:
npm install -g pyrightPlace this directory at:
%USERPROFILE%\.codex\plugins\python-native
The plugin metadata is in .codex-plugin/plugin.json, and the MCP server command is in .mcp.json.
Run from the plugin root:
python scripts\python_native_mcp.py --selftestExpected result: JSON output with "ok": true.
- LSP positions use 1-based
lineand 1-basedcharacterinputs. - Call
python_lsp_diagnosticsbeforepython_lsp_code_actionswhen asking for quick fixes on a problematic range. python_compile_checkvalidates syntax only; usepython_pyright_checkfor type diagnostics.
MIT.