Skip to main content

Prerequisites

  • Cursor IDE installed
  • Pylance MCP Server running (local or cloud)
  • Active subscription (Hobby, Pro, or Enterprise)

Installation Steps

1

Install MCP Extension

Open Cursor settings and enable MCP support:
Toggle Enable MCP to ON
2

Configure MCP Server

Create or edit ~/.cursor/mcp_config.json:
3

Authenticate

On first use, Cursor will prompt for authentication:
  1. Click Sign in with Clerk
  2. Complete OAuth flow in browser
  3. Return to Cursor
4

Verify Connection

Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
Should show: ✅ Pylance MCP: Connected

Configuration Options

Local Deployment

For maximum privacy, run Pylance MCP locally:
~/.cursor/mcp_config.json

Cloud Deployment

Connect to hosted Pylance MCP:
~/.cursor/mcp_config.json
Never commit API keys to version control. Use environment variables or Cursor’s secret storage.

Usage Examples

Code Completion

Type naturally and press Tab to accept suggestions:

Hover Documentation

Hover over any symbol for instant documentation:

Go to Definition

Cmd+Click (Mac) or Ctrl+Click (Windows) on any symbol:

Find References

Right-click → Find All References:

Rename Symbol

Right-click → Rename Symbol (F2):
All references update automatically across your workspace.

Advanced Features

Workspace Settings

Configure per-workspace settings in .cursor/workspace.json:
.cursor/workspace.json

Keybindings

Customize keyboard shortcuts in keybindings.json:
keybindings.json

Troubleshooting

Symptoms: “Failed to start Pylance MCP server”Solutions:
  • Check Python is in PATH: which python or where python
  • Verify installation: python -m pylance_mcp.server --version
  • Check logs: ~/.cursor/logs/mcp-pylance.log
Symptoms: No autocomplete suggestions appearSolutions:
  • Ensure file is saved (Pylance analyzes saved files)
  • Check file encoding (must be UTF-8)
  • Restart Cursor: Cmd+Shift+P → “Reload Window”
  • Clear cache: Delete ~/.cursor/cache/pylance/
Symptoms: Completions take >2 secondsSolutions:
  • Reduce diagnosticMode to “openFilesOnly”
  • Exclude large directories in .cursorignore:
  • Upgrade subscription tier for higher rate limits
Symptoms: “Unauthorized” or “Invalid API key”Solutions:

Best Practices

Enable Auto-Save: Pylance analyzes saved files for best results
Use Type Hints: Add type annotations for better completions
Organize Imports: Keep imports at top of file for faster analysis
Configure .cursorignore: Exclude virtual environments and caches
Large Workspaces: Workspaces >10,000 files may need diagnosticMode: "openFilesOnly"

Performance Tips

Optimize Cursor for large Python projects:
settings.json

Video Tutorial

Next Steps

API Reference

Explore all available tools

Custom Workspace

Configure workspace settings