Token导航 LogoToken导航

MCP Server · 开发工具

Pyright MCP Server

pyright-mcp是一个通过MCP协议向LLM客户端(如Claude)提供Pyright的Python静态类型检查能力的服务器,支持多工作区管理、代码补全和引用查找。

stdio官方级别未说明来源级核验工具 6
代码分析PythonClaude开发工具Claude Desktop

快速开始

作者 / 组织
islee
提供方
islee
运行时
Python

工具数量

6

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

0

仓库热度

收录来源

1 个

MCP World

选型结论

Pyright MCP Server 属于开发工具类 MCP Server,公开资料标注 6 个工具,通过stdio 本地进程接入,适配 Claude Desktop、Claude,有可以直接复制的安装命令;接入前先确认权限范围。

分类

开发工具

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

uv run python -m pyright_mcp

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Python,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 6 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

pyright-mcp

An MCP (Model Context Protocol) server that exposes Pyright's Python static type checking capabilities to LLM clients like Claude.

Status: Phase 3 Complete - Production-ready with multi-workspace support, completions, and references. See STATUS.md for details.

Features

ToolDescriptionPhaseStatus
check_typesRun type checking on file/directory1 (MVP)✓ Implemented
health_checkCheck server health and Pyright availability1 (MVP)✓ Implemented
get_hoverGet type info and docstring at position2 (LSP)✓ Implemented
go_to_definitionFind definition location for symbol2 (LSP)✓ Implemented
get_completionsGet completion suggestions at position3 (Production)✓ Implemented
find_referencesFind all references to a symbol3 (Production)✓ Implemented

Installation

From Source (Recommended for Development)

git clone https://github.com/islee/pyright-mcp-server.git
cd pyright-mcp-server
uv sync
uv run python -m pyright_mcp

From PyPI (When Published)

# Via uv (recommended)
uv add pyright-mcp

# Via pip
pip install pyright-mcp

Configuration

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "pyright": {
      "command": "uvx",
      "args": ["pyright-mcp"]
    }
  }
}

For development:

{
  "mcpServers": {
    "pyright": {
      "command": "uv",
      "args": ["--directory", "/path/to/pyright-mcp", "run", "python", "-m", "pyright_mcp"]
    }
  }
}

Usage

Once configured, the MCP tools are available in Claude:

# Check types in a file
check_types("/path/to/file.py")

# Check entire project
check_types("/path/to/project/")

# Get type info at position (Phase 2)
get_hover("/path/to/file.py", line=10, column=5)

# Go to definition (Phase 2)
go_to_definition("/path/to/file.py", line=10, column=5)

# Get completions (Phase 3)
get_completions("/path/to/file.py", line=10, column=5, trigger_character=".")

# Find references (Phase 3)
find_references("/path/to/file.py", line=10, column=5)

# Check health with pool stats and metrics (Phase 3)
health_check()

Phase 3 Features (Production)

Multi-Workspace Support

pyright-mcp now supports efficient multi-workspace development:

  • LSP Pool Management: Maintains up to 3 concurrent LSP clients (configurable via PYRIGHT_MCP_LSP_POOL_SIZE)
  • LRU Eviction: Automatically manages memory by evicting least-recently-used workspaces
  • Per-Workspace Metrics: Tracks operation counts, latencies, and error rates for each workspace

New Tools

  • get_completions - Get code completion suggestions at a position with context awareness
  • find_references - Find all references to a symbol across the workspace

Enhanced Health Check

The health_check tool now returns detailed pool statistics and per-workspace metrics:

{
  "status": "healthy",
  "lsp_pool": {
    "active_instances": 2,
    "max_instances": 3,
    "cache_hit_rate": 0.667,
    "eviction_count": 1,
    "workspace_switches": 3,
    "workspaces": ["/path/to/workspace1", "/path/to/workspace2"]
  },
  "metrics": {
    "uptime_seconds": 123.45,
    "workspaces": [
      {
        "workspace": "/path/to/workspace1",
        "operations": {
          "hover": {"count": 5, "avg_ms": 25.3, "errors": 0},
          "definition": {"count": 3, "avg_ms": 35.2, "errors": 0},
          "completion": {"count": 2, "avg_ms": 40.1, "errors": 0},
          "references": {"count": 1, "avg_ms": 50.0, "errors": 0}
        }
      }
    ]
  }
}

Use metrics to identify slow workspaces and optimize your Pyright configuration.

Configuration

Control multi-workspace behavior:

# Increase pool size for more concurrent workspaces
export PYRIGHT_MCP_LSP_POOL_SIZE=5

# Increase idle timeout (useful for slower machines)
export PYRIGHT_MCP_LSP_TIMEOUT=600

See docs/METRICS.md for detailed metrics documentation.

Requirements

  • Python 3.10+
  • uv (recommended) or pip
  • Pyright 1.1.350+ (tested with 1.1.350-1.1.408). Run health_check to verify compatibility.
  • Node.js (for Pyright, installed automatically via pyright package)

Environment Variables

VariableDefaultDescription
PYRIGHT_MCP_ALLOWED_PATHS(none)Colon-separated allowed paths. If not set, all paths allowed.
PYRIGHT_MCP_CLI_TIMEOUT30CLI execution timeout (seconds)
PYRIGHT_MCP_LOG_MODEstderrLogging: stderr, file, or both
PYRIGHT_MCP_LOG_LEVELINFOLog level: DEBUG, INFO, WARNING, ERROR
PYRIGHT_MCP_ENABLE_HEALTH_CHECKtrueEnable health_check tool
PYRIGHT_MCP_LSP_TIMEOUT300LSP idle timeout (seconds)
PYRIGHT_MCP_LSP_COMMANDpyright-langserver --stdioLSP server command
PYRIGHT_MCP_LSP_POOL_SIZE3Maximum LSP clients in pool (Phase 3)

Development

# Install dependencies
uv sync

# Run the MCP server
uv run python -m pyright_mcp

# Run tests
uv run pytest

# Type check
uv run pyright

# Lint and format
uv run ruff check .
uv run ruff format .

Architecture

┌───────────────────────────────────────────────────────┐
│                      Claude Code                      │
└───────────────────────────┬───────────────────────────┘
                            │ MCP Protocol (stdio)
                            ▼
┌───────────────────────────────────────────────────────┐
│                      pyright-mcp                      │
│  ┌─────────────┐  ┌─────────────┐  ┌───────────────┐  │
│  │ MCP Server  │  │   Tools     │  │ Backend       │  │
│  │ (FastMCP)   │◄─┤ check_types │◄─┤ Pyright CLI   │  │
│  │             │  │ get_hover   │  │ LSP Client    │  │
│  └─────────────┘  └─────────────┘  └───────────────┘  │
└───────────────────────────────────────────────────────┘
                            │
              ┌─────────────┼─────────────┐
              ▼             ▼             ▼
       ┌──────────┐  ┌──────────┐  ┌──────────────┐
       │ Pyright  │  │ Pyright  │  │ Python Files │
       │ CLI      │  │ LSP      │  │ (workspace)  │
       └──────────┘  └──────────┘  └──────────────┘

Documentation

License

GPL-3.0 - See LICENSE for details.

工具与能力

工具数量

6

资源数量

0

提示词数量

0

能力标签

静态类型检查Python本地部署Python开发工具LLM集成代码分析开发辅助

支持客户端

Claude DesktopClaude

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

让助手直接读代码

把仓库、提交记录和 issue 交给模型检索,补全和重构时不用来回复制文件。

在对话里跑命令

触发构建、测试和脚本,执行结果直接回到上下文,省去切终端。

接进开发流程

把 PR、CI 状态和代码审查接进助手,减少在几个工具之间跳。

选择建议

值得选的地方

  • 只提供 6 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Claude Desktop、Claude,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 Python,换机器要重新装一遍。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在开发工具场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Pyright MCP Server

MCP World · 本页

6stdio有1 个2026-05-17
Git 838e2ec1

MCP World

12stdio有2 个2026-05-17
Markitdown MCP 2c653a5f

MCP World

1stdio有1 个2026-05-17
Context7 MCP C671e75a

MCP World

0stdio有1 个2026-05-17
Context7 831acf40

MCP World

0stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Pyright MCP Server 怎么安装?

公开资料给出的安装命令是 uv run python -m pyright_mcp,运行环境为 Python。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Pyright MCP Server 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Python;保存后完全退出客户端再打开,配置才会生效。

Pyright MCP Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Pyright MCP Server 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Pyright MCP Server 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP