Pyrefly Autotype

MCP server for automatic Python type inference and checking using Pyrefly
  • python

1

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "lolpack-mcp-pyrefly-autotype": {
      "command": "uv",
      "args": [
        "run",
        "python",
        "-m",
        "mcp_pyrefly_autotype.server"
      ]
    }
  }
}

You run a Python-focused MCP server that leverages Pyrefly to automatically annotate Python code with types, enabling AI assistants to analyze, annotate, and validate type information in projects. This server provides file- and project-level typing capabilities, integrates with Pyrefly for autotyping and type checking, and exposes simple workflows you can drive from MCP-enabled clients.

How to use

You use an MCP client to connect to the Pyrefly autotype server. Common workflows include analyzing a Python file for missing annotations, adding types to that file, and then validating the results with a type check. You can run these steps in sequence or in iterative cycles to progressively improve type coverage. The server responds with structured data describing analysis results, added types, and any type errors, so your AI tools can decide what to do next.

Typical workflows you can perform include: analyze a file for missing annotations, apply Pyrefly autotype to add types, and run a type check. You can repeat the add and check steps up to refine results. You can also request a project-wide context to guide annotation decisions. Use these steps in combination with your MCP client prompts to drive automated typing tasks.

How to install

Prerequisites you need before installing and running the MCP server:

• Python 3.8 or higher.

• uv (fast Python package manager) to install and run the MCP server.

# Clone or download the MCP Pyrefly Autotype project
git clone https://github.com/your-username/mcp-pyrefly-autotype.git
cd mcp-pyrefly-autotype

# Install dependencies with uv
uv sync

# For development (includes dev dependencies)
uv sync --dev

# Alternative: traditional pip install
# pip install -e .
# pip install -e ".[dev]"

Configuration and running the server

You can run the server directly for testing or integrate it with MCP clients. Use one of the standard run commands shown below to start the server.

# Run directly (for testing)
uv run python -m mcp_pyrefly_autotype.server

# Or use the installed script after uv sync
uv run mcp-pyrefly-autotype

# Alternative: activate a virtual environment first
uv shell
python -m mcp_pyrefly_autotype.server

Available tools

analyze_python_file

Analyze a Python file for missing type annotations. Returns locations and suggestions for where types are needed.

add_types_to_file

Add type annotations to a Python file using Pyrefly autotype. Optionally create a backup before modifying the file.

type_check_file

Run type checking on a Python file using Pyrefly to surface type errors and warnings.

get_project_context

Provide project-wide type information to guide annotation decisions and inference.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
Pyrefly Autotype MCP Server - lolpack/mcp-pyrefly-autotype | VeilStrat