About mcp-pyright
mcp-pyright exposes Pyright language-server functions to Python developers and MCP-compatible clients. It covers common code-navigation, completion, formatting, and type-checking tasks.
Key features
- 01Python type checking
- 02Hover type information
- 03Code completion
- 04Definition and reference lookup
- 05Document symbols and formatting
Use cases
- 01Check Python code for type errors
- 02Inspect a symbol's type while editing
- 03Find definitions and references in code
- 04Format Python code through an MCP client
MCP support
The MCP server exposes Pyright language-server functionality as tools for MCP-compatible clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
7Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | any | No | Python code as string (mutually exclusive with file_path). |
| file_path | any | No | Path to Python file (mutually exclusive with code). |
| python_path | any | No | Optional path to Python interpreter. |
| type_checker_mode | string | No | Type checking mode - "basic", "strict", or "overload" (default: "basic"). |
Details
From the project READMEmcp-pyright
MCP server that exposes Pyright language server functionality
mcp-name: io.github.daedalus/mcp-pyright
Install
pip install mcp-pyright
Usage
The MCP server can be used with any MCP-compatible client. It exposes the following tools:
Type Checking
from mcp_pyright import mcp
# Run type checking
result = check_types(code="x: int = 'hello'")
Get Hover Information
# Get type information at position
result = get_hover(code="x: int = 1", position=0)
Get Completions
# Get code completions
result = get_completions(code="prin", position=4)
Get Definition
# Find definition location
result = get_definition(code="def foo(): pass\nfoo()", position=15)
Find References
# Find all references
result = find_references(code="x = 1\nx", position=5)
Get Document Symbols
# Get all symbols in document
result = get_document_symbols(code="class Foo: pass\ndef bar(): pass")
Format Code
# Format Python code
result = format_code(code="x=1\ny=2")
Development
git clone https://github.com/daedalus/mcp-pyright.git
cd mcp-pyright
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.