Skip to main content

Prerequisites

  • Claude Desktop app installed
  • Pylance MCP Server running
  • Anthropic account with API access

Quick Start

1

Install Pylance MCP

Install via pip:
2

Configure Claude

Edit Claude Desktop configuration:macOS: ~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.jsonLinux: ~/.config/Claude/claude_desktop_config.json
3

Restart Claude Desktop

Quit and reopen Claude Desktop app
4

Verify Setup

In Claude chat, type:
Claude should respond with workspace information.

Configuration Examples

Single Workspace

claude_desktop_config.json

Multiple Workspaces

claude_desktop_config.json

Cloud-Hosted

claude_desktop_config.json
Get your API key from pylancemcp.dev/dashboard

Usage Examples

Code Review

Ask Claude to review your code:
Claude will analyze:
  • Type safety issues
  • Potential bugs
  • Security vulnerabilities
  • Code style consistency
  • Best practice violations

Refactoring Assistance

Request refactoring help:
Claude will:
  1. Analyze current implementation
  2. Suggest refactoring approach
  3. Generate refactored code
  4. Explain changes made

Documentation Generation

Generate docstrings:
Output:

Test Generation

Generate unit tests:
Claude generates comprehensive tests including:
  • Happy path scenarios
  • Edge cases
  • Error handling
  • Fixtures and mocks

Advanced Features

Context-Aware Conversations

Claude maintains context across messages:

Multi-File Analysis

Analyze dependencies across files:
Claude maps the flow:
Search using natural language:
Claude locates potential SQL injection vulnerabilities.

Conversation Templates

Bug Investigation

Feature Implementation

Performance Optimization

Troubleshooting

Error: Command 'python' not foundFix: Use absolute path to Python:
Error: Failed to initialize workspaceChecklist:
  • ✅ Workspace path exists
  • ✅ Path has no trailing slash
  • ✅ User has read permissions
  • ✅ Contains Python files (.py)
Error: 401 UnauthorizedSolutions:
  • Check API key is valid
  • Verify subscription is active
  • Ensure API key has correct permissions
Symptoms: No response to @pylance commandsDebug:
  1. Check Claude Desktop logs:
    • macOS: ~/Library/Logs/Claude/
    • Windows: %APPDATA%\Claude\logs\
  2. Verify MCP server is running:
  3. Test server manually:

Performance Optimization

Large Workspaces

For projects with >5,000 files:
claude_desktop_config.json

Memory Limits

Constrain memory usage:

Security Best Practices

Never commit claude_desktop_config.json with API keys to version control
Use environment variables:
claude_desktop_config.json
Set in shell profile:
~/.zshrc

Tips & Tricks

Tip 1: Use @pylance at the start of messages for better context
Tip 2: Reference specific files: @pylance analyze src/models/user.py
Tip 3: Ask for alternatives: @pylance show 3 ways to implement this function
Tip 4: Request explanations: @pylance explain this decorator pattern

Next Steps

Continue.dev Setup

Configure for VS Code

Custom Workspace

Advanced workspace configuration