PyEye 👁️
PyEye Server
An extensible MCP (Model Context Protocol) server that provides intelligent Python code analysis, navigation, and understanding capabilities for AI assistants like Claude.
Features
- 🔍 Semantic Code Navigation: Resolve any identifier to a stable canonical handle, then inspect or outline it
- 📊 Structural Traversal: Walk
members,callees,imports,imported_by,subclasses,superclasses, andsubmodules— one hop withexpand, many withtrace - 🤝 Honest by Construction: Unsupported questions (notably "who calls this") are refused, not guessed; absent counts mean "not measured", never "zero"
- 🏗️ Multi-Project Support: Analyze multiple projects and dependencies simultaneously
- 📦 Namespace Packages: Handle packages distributed across multiple repositories
- 📝 Standalone Scripts: Analyze notebooks, scripts, and examples alongside formal packages
- 🔄 Auto-Update: Automatically detects and reflects file changes with smart cache invalidation
- ⚙️ Configuration System: Flexible configuration via files, env vars, or auto-discovery
- 🔌 Extensible Plugin System: Framework-specific analyzers (Pydantic, Django, Flask)
- 🚀 Fast & Cached: Intelligent caching with LRU eviction and performance optimization
- 🎯 Type-Aware: Full understanding of Python type hints and annotations
- 📈 Performance Monitoring: Built-in metrics tracking with p50/p95/p99 latencies
- 🛡️ Input Validation: Secure parameter validation and path checking
- 🤖 Development Automation: Release automation, dogfooding metrics, and worktree safety
Installation
PyEye can be installed in three ways: as a Claude Code plugin (zero-config), into your project's venv, or globally.
Option 0: Claude Code Plugin (zero-config)
When PyEye is installed as a Claude Code plugin, dependencies install automatically into a per-user venv on first session start — no manual pip install needed.
- First session start: a
SessionStarthook runsuv sync --no-dev --frozenagainst the plugin checkout, with the venv built at${CLAUDE_PLUGIN_DATA}/.venv(typically~/.claude/plugins/data/<plugin-id>/.venv). - Subsequent sessions: the hook compares
uv.lockin the plugin checkout against the last-installed copy in${CLAUDE_PLUGIN_DATA}and is a silent no-op unless the lockfile changed. - Requirement:
uvmust be on yourPATH. See uv installation.
Both the install hook and the MCP server invocation use uv run, so this works on Linux, macOS, and Windows without OS-specific configuration.
Option 1: Project-Specific Installation (Recommended)
Install directly into your Python project's virtual environment:
# Activate your project's virtual environment
source /path/to/your/project/venv/bin/activate
# Install from PyPI
pip install pyeye-mcp
# Or install from source
git clone https://github.com/okeefeco/pyeye-mcp.git
pip install -e ./pyeye-mcp
Then create a .mcp.json file in your project root:
{
"mcpServers": {
"pyeye": {
"type": "stdio",
"command": "python",
"args": ["-m", "pyeye.mcp"],
"env": {}
}
}
}
This way, the MCP server uses your project's environment and has access to all your project's dependencies.
Option 2: Global Installation
For analyzing multiple projects or using with global Python:
# Install globally with pipx (recommended for isolation)
pipx install pyeye-mcp
# Or with pip
pip install --user pyeye-mcp
# Or from source
git clone https://github.com/okeefeco/pyeye-mcp.git
cd pyeye-mcp
pip install --user .
Configure with Claude Code (Global)
# Add the MCP server globally (available in all projects)
claude mcp add pyeye -s user -- python -m pyeye.mcp
# Verify it's connected
claude mcp list
Configure with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"pyeye": {
"command": "python",
"args": ["-m", "pyeye.mcp"],
"env": {}
}
}
}
Note: Use the full path to Python if needed (e.g., /usr/local/bin/python3 or C:\\Python311\\python.exe).
Configure with GitHub Copilot (VS Code)
As of 2025, GitHub Copilot has full MCP support in VS Code, JetBrains, Eclipse, and Xcode. Follow these steps to use this PyEye server with GitHub Copilot:
Prerequisites
- GitHub Copilot Business or Enterprise subscription (required for MCP support)
- VS Code version 1.102 or later (MCP support is GA)
- Organization MCP policy enabled by your admin
Step 1: Enable MCP in Your Organization
Your GitHub Copilot administrator needs to enable the MCP servers policy:
- Go to your organization settings on GitHub
- Navigate to Copilot → Policies
- Enable "MCP servers in Copilot" policy
- Save changes
Step 2: Install the MCP Server
Install the PyEye server in your project or globally:
# Option A: Install in your project's virtual environment (recommended)
pip install pyeye-mcp
# Option B: Install globally with pipx
pipx install pyeye-mcp
# Option C: Install from source
git clone https://github.com/okeefeco/pyeye-mcp.git
pip install -e ./pyeye-mcp
Step 3: Configure VS Code
Add the MCP server configuration to your VS Code settings:
User Settings (applies to all projects):
// File: ~/.config/Code/User/settings.json (Linux/Mac)
// or %APPDATA%\Code\User\settings.json (Windows)
{
"github.copilot.chat.mcpServers": {
"pyeye": {
"command": "python",
"args": ["-m", "pyeye.mcp"],
"env": {}
}
}
}
Workspace Settings (project-specific):
// File: .vscode/settings.json in your project root
{
"github.copilot.chat.mcpServers": {
"pyeye": {
"command": "${workspaceFolder}/.venv/bin/python",
"args": ["-m", "pyeye.mcp"],
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
}
}
}
Step 4: Verify Connection
- Open VS Code in your Python project
- Open the GitHub Copilot Chat panel
- Type:
@mcp listto see available MCP servers - You should see
pyeyein the list - Test with:
@mcp pyeye resolve MyClass
Troubleshooting
MCP not available:
- Ensure you have Copilot Business/Enterprise (not Free/Pro)
- Check that your organization admin enabled the MCP policy
- Update VS Code to version 1.102 or later
Server not connecting:
- Verify Python path in the configuration
- Check that
pyeyeis installed:python -m pyeye.mcp --help - Look for errors in VS Code Output panel → GitHub Copilot Logs
Import errors:
- If using a virtual environment, ensure the path points to the venv Python
- Add
PYTHONPATHto the env configuration if needed
Other IDEs
JetBrains IDEs (IntelliJ, PyCharm, etc.):
- MCP support is GA - configure in Settings → Tools → GitHub Copilot → MCP Servers
Visual Studio:
- MCP support is in preview - configure in Tools → Options → GitHub Copilot → MCP Servers
Eclipse & Xcode:
- MCP support is GA - see IDE-specific documentation for configuration
Configuration
The server can be configured to analyze packages in other locations. Create a .pyeye.json file in your project:
{
"packages": [
"../my-shared-library",
"~/repos/company-utils",
"/absolute/path/to/package"
],
"namespaces": {
"mycompany": [
"~/repos/mycompany-auth",
"~/repos/mycompany-api"
]
}
}
Configuration Methods
Configuration is loaded in the following order (later sources override earlier ones):
- Global Config:
~/.config/pyeye/config.jsonor~/.pyeye.json- User defaults - Project Config:
.pyeye.jsonin project root or[tool.pyeye]inpyproject.toml - Override File:
.pyeye.override.json- Local development overrides (git-ignored) - Auto-Discovery: Automatically detects source layouts and sibling packages if no packages configured
Using Override Files
Override files are perfect for local development configurations that shouldn't be committed:
// .pyeye.override.json (git-ignored)
{
"packages": [
"../my-local-dev-package",
"~/dev/experimental"
],
"namespaces": {
"company.feature": ["/home/user/feature-branch"]
}
}
Performance Settings
Performance settings are configured through environment variables:
| Environment Variable | Default | Description | Valid Range |
|---|---|---|---|
PYEYE_MAX_PROJECTS |
10 | Maximum number of projects in memory | 1-1000 |
PYEYE_CACHE_TTL |
300 | Seconds a cached scope file list or lookup result lives (file changes also clear it) | 0-86400 (24h) |
PYEYE_ARTIFACT_CACHE_MAX_ENTRIES |
2000 | Parsed files (AST/Jedi script) kept in memory; see Sizing the parsed-file cache | 1-1000000 |
PYEYE_PARSO_CACHE_MAX_ENTRIES |
600 | Parse trees kept in Jedi's parse cache (least recently used are dropped first; answers are unaffected) | 1-1000000 |
PYEYE_SCRIPT_CACHE_MAX_ENTRIES |
200 | Jedi scripts kept in memory (each keeps the modules it inferred alive, so this bounds parse-tree memory; answers are unaffected) | 1-1000000 |
PYEYE_WATCHER_DEBOUNCE |
0.5 | File watcher debounce delay in seconds | 0.0-10.0 |
PYEYE_ENABLE_PERFORMANCE_METRICS |
false | Enable performance metrics | true/false |
| Deprecated | No effect; removed in v3.0 | ||
PYEYE_ENABLE_CONNECTION_POOLING |
true | Deprecated, no effect: the connection pool was removed (#628) | |
PYEYE_POOL_MAX_CONNECTIONS |
10 | Deprecated, no effect: the connection pool was removed (#628) | |
PYEYE_POOL_TTL |
3600 | Deprecated, no effect: the connection pool was removed (#628) | |
| Logging | |||
PYEYE_LOG_LEVEL |
INFO | DEBUG, INFO, WARNING or ERROR |
|
PYEYE_LOG_FILE |
unset | Append logs to this file (otherwise stderr only) |
These are read when the server starts, from the server's own environment.
The MCP client starts the server, so set them on its server entry (Claude
Code: claude mcp add pyeye -s user -e PYEYE_MAX_PROJECTS=20 -- python -m pyeye.mcp;
other clients take an env map in their config), then restart the client.
An export in your shell only reaches the server if the client was launched
from that shell.
Packages and namespaces are not configured through environment variables. Use
.pyeye.json, pyproject.toml, the global config file, or the
configure_packages tool (see Configuration).
Sizing the parsed-file cache
pyeye walks every .py file in a project to build its name index and its
subclass and import graphs, and rebuilds them after every file change.
PYEYE_ARTIFACT_CACHE_MAX_ENTRIES decides how many of those parsed files stay
in memory between walks. Answers are the same at any value; only speed and
memory change.
- Set it at or above your project's
.pyfile count (the default 2000 covers most projects). Each rebuild after an edit then re-parses only what changed. - Don't set it just below that count. The cache then evicts files during each walk and parses them again in the same walk, so it is both slower and uses more memory than the default.
- To save memory, go well below it (about 250) and accept slower rebuilds.
Measured on a 1,167-file project (#768), including a rebuild after one edit:
| Value | Resident memory | Rebuild after an edit |
|---|---|---|
| 2000 (default) | +1,224 MB | 133–151 s |
| 1000 | +1,353–1,374 MB | 176–178 s |
| 500 | +1,092–1,096 MB | 179–191 s |
| 250 | +1,002–1,006 MB | 178–195 s |
Performance Tuning Examples
Large codebase with stable files:
export PYEYE_MAX_PROJECTS=50 # Handle more projects
export PYEYE_CACHE_TTL=1800 # 30 minute cache
export PYEYE_WATCHER_DEBOUNCE=2.0 # Less frequent updates
Active development with frequent changes:
export PYEYE_MAX_PROJECTS=5 # Fewer projects, faster switching
export PYEYE_CACHE_TTL=60 # 1 minute cache
export PYEYE_WATCHER_DEBOUNCE=0.1 # Near real-time updates
Memory-constrained environment:
export PYEYE_MAX_PROJECTS=3 # Minimal project cache
export PYEYE_ARTIFACT_CACHE_MAX_ENTRIES=250 # Fewer parsed files: less memory, slower rebuilds
This file is automatically ignored by git and takes precedence over all other configuration sources.
Auto-Detection of Source Layouts
PyEye automatically detects source layouts from pyproject.toml build backend metadata, supporting projects that use the src/ directory pattern. This works with multiple build backends:
Setuptools:
[tool.setuptools.packages.find]
where = ["src"]
Poetry:
[[tool.poetry.packages]]
include = "mypackage"
from = "src"
Hatch:
[tool.hatch.build.targets.wheel]
sources = ["src"]
PDM:
[tool.pdm.build]
package-dir = "src"
If no configuration is found in pyproject.toml, PyEye will also check for the presence of a src/ directory containing Python packages and automatically add it to the package paths.
Note: Explicit [tool.pyeye] configuration always takes precedence over auto-detected layouts.
Core Tools
PyEye exposes a small set of progressive-disclosure primitives that work on
canonical handles (a re-exported path collapses to its definition site). They are
cheap by default — they return structural facts and pointers, never source
content. For the full mechanics, the authoritative list of supported edges, and
worked examples, see the python-explore skill (skills/python-explore/SKILL.md).
Navigation & Inspection
resolve- Resolve a name or dotted path to canonical handle(s); the usual entry pointresolve_at- Resolve the symbol at afile:line:columnlocationinspect- Structured facts for a handle: signature, type, docstring, edge countsoutline- Structural outline of a module, package, or class and its membersexpand- Follow one relationship edge from a handle (e.g.members,imports,imported_by,subclasses); the skill lists the full supported-edge settrace- Multi-hop traversal across edges (e.g.follow=["imports"]for the dependency closure,follow=["subclasses"]for the full hierarchy)
Multi-Project
configure_packages- Register additional package locations to analyze alongside the project
Known limitation: no reverse references
The interface does not answer "who calls / references this". Reverse-reference
support is deferred to a planned Pyright backend
(#333). When you ask for a
callers or references edge, pyeye reports it as unsupported rather than
guessing, and inspect's edge_counts omits those keys entirely instead of
reporting 0. Delegate caller questions to a language server; pyeye's resolve
gives you the definition-site position an LSP reference query needs.
Forward and structural questions are answered: callees (what a function calls),
imported_by / imports, subclasses / superclasses, members, submodules.
Removed in v2.0.
find_references,get_call_hierarchy, andanalyze_dependencieswere removed in #505 — not deprecated — because they returned confidently wrong answers rather than merely incomplete ones. See the CHANGELOG's migration map for replacements.
Framework-Specific Tools (Auto-Activated)
Django (when Django is detected)
find_django_models- Find all Django modelsfind_django_views- Find all viewsfind_django_urls- Find URL patternsfind_django_templates- Find templatesfind_django_migrations- Find migrations
Pydantic (when Pydantic is detected)
find_pydantic_models- Discover all BaseModel classesget_model_schema- Extract complete model schemafind_validators- Locate all validation methodsfind_field_validators- Find field-specific validatorsfind_model_config- Extract model configurationstrace_model_inheritance- Map model inheritance hierarchiesfind_computed_fields- Find computed_field and @property fields
Flask (when Flask is detected)
find_flask_routes- Discover all route decorators with methods and endpointsfind_flask_blueprints- Locate Blueprint definitions and registrationsfind_flask_views- Find view functions and MethodView classesfind_flask_templates- Locate Jinja2 templates and render_template callsfind_flask_extensions- Identify Flask extensions (SQLAlchemy, Login, CORS, etc.)find_flask_config- Find configuration files and app.config usagefind_error_handlers- Locate @app.errorhandler decoratorsfind_cli_commands- Find Flask CLI commands (@app.cli.command)
Advanced Features
Multi-Project Support
Analyze your main project along with local dependencies:
# Configure to analyze multiple packages
configure_packages(
packages=["../my-lib", "~/repos/shared-utils"],
namespaces={"company": ["~/repos/company-*"]}
)
Namespace Packages
Handle packages distributed across multiple repositories:
# company.auth in repo A, company.api in repo B
configure_packages(
namespaces={"company": ["~/repos/company-auth", "~/repos/company-api"]}
)
Auto-Update on File Changes
The server uses file watching to automatically update when code changes:
- Detects modifications in real-time
- Invalidates cache for changed files
- Maintains separate watchers per project
Architecture
PyEye
├── Core Server (MCPServer, MCP Python SDK)
│ └── MCP tools (primitives + auto-activated framework plugins)
├── Project Manager
│ ├── Multi-project support (LRU cache, max 10)
│ ├── Namespace resolver
│ └── Configuration loader (multiple sources)
├── Analysis Engine
│ └── Jedi (semantic analysis & type inference)
├── Caching & Performance
│ ├── File watchers (watchdog with debouncing)
│ ├── Granular cache (5min TTL with smart invalidation)
│ ├── Metrics collection (p50/p95/p99 latencies)
│ └── Performance monitoring & reporting
├── Validation & Security
│ ├── Input validation (MCP tool parameters)
│ ├── Path security checks
│ └── Safe file operations
├── Plugin System
│ ├── Base plugin class (AnalyzerPlugin)
│ ├── Pydantic plugin (7 specialized tools)
│ ├── Django plugin (5 specialized tools)
│ └── Flask plugin (8 specialized tools)
├── Utility Systems
│ ├── Dependency tracking & circular detection
│ ├── Import analysis & re-export resolution
│ ├── Scope management (main/all/namespace scoping)
│ ├── Async utilities (concurrent operations)
│ └── Cross-platform path handling
└── Development & Automation
├── Release automation agent
├── Dogfooding metrics tracking
└── Worktree safety management
Plugin Development
Create custom plugins for your project patterns:
from pyeye.plugins.base import AnalyzerPlugin
class MyProjectPlugin(AnalyzerPlugin):
def name(self) -> str:
return "MyProject"
def detect(self) -> bool:
# Return True if this plugin should activate
return (self.project_path / "my_framework.conf").exists()
def find_patterns(self, pattern_name: str):
# Find your custom patterns
pass
Performance Monitoring Details
The server includes comprehensive performance monitoring to help identify bottlenecks and optimize performance for large-scale deployments.
Connection Pooling (deprecated)
The connection pool was removed in #628: it built jedi.Project objects that
nothing used. Its three settings are deprecated and have no effect; setting one
logs a warning at startup, and they will be removed in v3.0:
PYEYE_ENABLE_CONNECTION_POOLING # deprecated, no effect
PYEYE_POOL_MAX_CONNECTIONS # deprecated, no effect
PYEYE_POOL_TTL # deprecated, no effect
Metrics Tracked
- Operation Latencies: p50, p95, p99 percentiles for all MCP tools
- Cache Performance: Hit rate, miss rate, evictions
- Memory Usage: RSS, VMS, percentage used
- Error Rates: Track failures per operation
- Throughput: Operations per second
Performance Baselines
The following performance baselines are enforced in CI:
| Operation | p50 (ms) | p95 (ms) | p99 (ms) |
|---|---|---|---|
| symbol_search | 50 | 100 | 200 |
| goto_definition | 30 | 75 | 150 |
| cache_lookup | 0.1 | 0.5 | 1.0 |
Development
# Install development dependencies
uv add --dev pytest black ruff mypy
# Run tests
uv run pytest
# Format code
uv run black src/
uv run ruff check src/
Documentation
- Installation Guide
- Configuration Guide
- Troubleshooting Guide - Common issues and solutions
- API Reference
Security
Please report vulnerabilities privately through GitHub's private vulnerability reporting, not in public issues. SECURITY.md covers supported versions, what to expect after reporting, and pyeye's security model (static analysis only; it reads whatever paths the MCP client points it at).
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Acknowledgments
Built on top of:
- Jedi - Python static analysis and type inference
- MCP Python SDK - MCP server framework (
MCPServer) - Watchdog - File system monitoring
Metadata
Release files for pyeye-mcp 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyeye_mcp-2.1.0.tar.gz | 1.7 MB | With provenance | Details for pyeye_mcp-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyeye_mcp-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyeye_mcp-2.1.0-py3-none-any.whl |
Total release size: 2.0 MB
Release files / pyeye_mcp-2.1.0.tar.gz
| Download URL | pyeye_mcp-2.1.0.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5afdbff2afaa6703fa9b29e675eb86134eadde60d42694c31c7cc389edb3e884
|
|
BLAKE2b-256 checksum How to use checksums |
f6d2bbcc8d5dd580e134ef29c874e9d4811fefe03caaa455b98e9678daf076dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pyeye_mcp-2.1.0-py3-none-any.whl
| Download URL | pyeye_mcp-2.1.0-py3-none-any.whl |
|---|---|
| Size | 324.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e75b8dc9f21338a9ebc050c527ac489be3869e81a97cb99d9e3254684cda0ca2
|
|
BLAKE2b-256 checksum How to use checksums |
a47fb6ff6735a640a278352e95c7f2629ed57cb5b9cead44f91c7a721004453d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for pyeye-mcp 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyeye_mcp-2.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.