pylance-mcp-server
v1.1.0
Published
Pyright/Pylance language server for MCP - Enhanced Python IntelliSense for Claude Desktop
Maintainers
Readme
Pylance MCP Pro
Professional Python Intelligence Server with REST API and AI Features
A production-ready Model Context Protocol (MCP) server that provides enhanced Pylance/Pyright language server capabilities with REST API access, AI-powered code analysis, and OpenTelemetry tracing.
🎯 What Makes This Different?
Unlike Microsoft's standard Pylance server, Pylance MCP Pro includes:
- ✅ REST API - HTTP endpoints for web/mobile integration
- ✅ AI Features - Claude-powered type error explanations (Pro tier)
- ✅ API Key Authentication - Secure access with tier-based rate limiting
- ✅ OpenTelemetry Tracing - Monitor performance and debug issues
- ✅ Conversation Logging - Track AI interactions for analysis
- ✅ Advanced Code Intelligence - Enhanced completions and diagnostics
- ✅ Professional Branding - Shows up distinctly in VS Code
- ✅ Custom Tools - 12 specialized Python analysis tools
🌐 Access Methods
1. MCP Protocol (Claude Desktop, Continue, Cursor)
Traditional MCP client integration via stdio.
2. REST API (Web/Mobile Apps)
HTTP endpoints for any application:
curl -X POST https://api.pylancemcp.com/api/v1/analyze \
-H "X-API-Key: pmcp_your_key" \
-H "Content-Type: application/json" \
-d '{"file_path": "test.py", "content": "x: int = \"hello\""}'See API_TESTING_GUIDE.md for full documentation.
🚀 Quick Installation
One-Line Install:
python install_to_vscode.pyThen reload VS Code (Ctrl+Shift+P → "Developer: Reload Window")
Manual Installation:
Add to your VS Code settings.json:
{
"mcpServers": {
"pylance-mcp-pro": {
"command": "/path/to/.venv/Scripts/python.exe",
"args": ["/path/to/server.py"],
"env": {
"WORKSPACE_ROOT": "${workspaceFolder}"
},
"enabled": true
}
},
"chat.mcp.autostart": "always"
}🔧 Finding Your Tools in VS Code
After installation and reload:
- Open Copilot Chat (Ctrl+Alt+I)
- Click the 🔧 tools icon in the chat input area
- Look for "pylance-mcp-pro" (your custom server!)
- You'll see all 12 tools listed
Note: This shows up separately from Microsoft's "pylance" server.
🛠️ Available Tools (12)
Code Intelligence:
get_completions- Intelligent code completions with full type infoget_hover- Type hints and documentation on hoverget_definition- Go to definition across workspaceget_references- Find all references to symbols
Code Quality:
get_diagnostics- Errors, warnings, and type issuesformat_document- Professional code formattingrename_symbol- Safe refactoring across files
Navigation:
get_signature_help- Function signatures and parametersget_document_symbols- File outline and structureget_workspace_symbols- Project-wide symbol search
Operations:
apply_workspace_edit- Apply code changes safelyhealth_check- Monitor server status
📊 Features
OpenTelemetry Tracing
Monitor your code intelligence operations in real-time with the AI Toolkit trace viewer.
Smart Environment Detection
Automatically detects and uses:
- Virtual environments (.venv, venv, env)
- Python version from your project
- Workspace-specific configurations
Professional Integration
- Seamless Copilot Chat integration
- Natural language queries
- Automatic tool selection
- Context-aware responses
💬 Usage Examples
Just ask naturally in Copilot Chat:
"What's the type of this variable?"
"Show me all references to calculate_total"
"Are there any type errors in this file?"
"Get completions for line 42, column 10"
"Format this document"The appropriate tools are invoked automatically!
🔍 Verification
Check if it's running:
- View → Output
- Select "pylance-mcp-pro" from dropdown
- Should show: "Discovered 12 tools"
Or run the test:
python server.py --test🎓 For Users Installing Your Server
When someone installs this:
- They run
python install_to_vscode.py - Reload VS Code
- Open Copilot Chat
- Click 🔧 → See "pylance-mcp-pro" listed
- Start asking Python questions!
The tools appear professionally in the Configure Tools menu!
🆚 vs Microsoft's Pylance
| Feature | Microsoft Pylance | Pylance MCP Pro | |---------|------------------|-----------------| | Basic Language Intelligence | ✅ | ✅ | | OpenTelemetry Tracing | ❌ | ✅ | | Conversation Logging | ❌ | ✅ | | Custom MCP Tools | ❌ | ✅ (12 tools) | | Shows in Configure Tools | Default | Distinct entry | | Professional Branding | Generic | Branded |
📝 Configuration
All settings in settings.json:
{
"mcpServers": {
"pylance-mcp-pro": {
"command": "python.exe",
"args": ["server.py"],
"env": {
"WORKSPACE_ROOT": "${workspaceFolder}"
},
"enabled": true
}
}
}🐛 Troubleshooting
Tools not showing?
- Reload VS Code
- Check Output panel for "pylance-mcp-pro"
- Verify
chat.mcp.autostartis "always"
Wrong server running?
- Look for "pylance-mcp-pro" not "pylance"
- Microsoft's is built-in, yours is custom
Need help?
- Run
python server.py --test - Check MCP_USAGE.md
- Review Output panel logs
🎉 Success!
When you see in Output:
Starting server pylance-mcp-pro
Discovered 12 toolsYou're ready to go! 🚀
Your professional Python intelligence server is running and available in Copilot Chat's Configure Tools menu.
