Skip to main content

PyEye 👁️

PyEye Server

CI codecov Python 3.11+ Code style: black Ruff Pre-commit

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 relationship edges (listed below) one hop with expand, or many with trace
  • 🤝 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 standalone .py files (for example in scripts/ or examples/ directories) alongside formal packages
  • 🔄 Auto-Update: Watches the project's files and drops cached results when they change
  • ⚙️ Configuration System: Configure packages and namespaces in config files, or let pyeye auto-discover them; tune performance with environment variables
  • 🔌 Plugin System: Built-in framework analyzers (Pydantic, Django, Flask)
  • 🎯 Type-Aware: Uses Jedi's type inference, including type hints and annotations
  • 📈 Performance Metrics: Optional per-tool latency metrics (get_performance_metrics)

Installation

You use Recommended Alternatives
Claude Code The plugin claude mcp add
Another MCP client (Claude Desktop, VS Code, …) uvx pyeye-mcp An installed pyeye-mcp
One project, pinned to a version Install into the project's environment
You're working on pyeye itself CONTRIBUTING

pyeye needs Python >=3.11. The plugin and uvx need uv. pyeye analyses the directory its server starts in, and every analysis tool also takes a project_path. The entry points list the commands that start the server.

Your project's environment. pyeye reads the project's installed third-party packages (requests, django, …) from the project's own Python environment, whichever way pyeye itself runs. It uses the first of:

  1. the environment setting in the project's pyeye config: the path to a virtualenv, or false for none;
  2. a virtualenv in the project: .venv, venv or env (for a project that is itself a package, in its parent directory too, unless that directory is shared: group- or world-writable, or owned by another user);
  3. the activated environment (VIRTUAL_ENV, or CONDA_PREFIX for conda), as Poetry, Pipenv and Hatch set it for an environment outside the project, unless it is pyeye's own environment, which is skipped. One activated environment serves every project that has none of its own.

It reads the environment's packages from disk and never runs its Python. It skips an environment, or a path one adds, that is in or contains a system directory or a credential store, with a warning. When it finds none, a third-party import doesn't resolve, and resolve and inspect say that no environment was found (#993).

In Claude Code:

/plugin marketplace add okeefeco/pyeye-mcp
/plugin install pyeye@pyeye-marketplace

From a shell, the same is claude plugin marketplace add okeefeco/pyeye-mcp followed by claude plugin install pyeye@pyeye-marketplace. Claude Code's plugin documentation covers updating and removing plugins.

The plugin brings:

  • the pyeye MCP server;
  • the skills python-explore, architecture-review, duplication-review and decision-log;
  • a session-start hook that installs pyeye's dependencies with uv into a per-user environment, the first time and again whenever its lockfile changes.

Install pyeye either as the plugin or with claude mcp add, not both: with both, every tool appears twice (mcp__plugin_pyeye_pyeye__… and mcp__pyeye__…). If you added it with claude mcp add before, run claude mcp remove pyeye.

Claude Code without the plugin

claude mcp add pyeye -s user -- uvx pyeye-mcp
claude mcp list   # check that pyeye is connected

uvx runs the latest release from PyPI in an environment of its own. To use an installed command instead, see Installing the command and register -- pyeye-mcp. Claude Code's MCP documentation covers scopes and options.

Other MCP clients

pyeye is a standard stdio MCP server. Give your client the command uvx with the argument pyeye-mcp, or an installed pyeye-mcp. Where that goes depends on the client, so follow its own documentation:

For example, in a client that takes an mcpServers map:

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

Installing the command

To install pyeye-mcp once instead of running it through uvx, use uv tool install pyeye-mcp or pipx install pyeye-mcp. The server command is then pyeye-mcp.

Install into a project's environment

Install pyeye into the project's virtual environment (pip install pyeye-mcp, or uv pip install pyeye-mcp, with that environment active), then point your client at that environment's Python. For Claude Code, a .mcp.json in the project root:

{
  "mcpServers": {
    "pyeye": {
      "type": "stdio",
      "command": "/path/to/your/project/.venv/bin/python",
      "args": ["-m", "pyeye.mcp"]
    }
  }
}

On Windows the path is .venv\Scripts\python.exe. A bare "command": "python" works only if your MCP client was started from a shell with that environment active; otherwise it runs whichever Python is first on the client's PATH.

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):

  1. Global Config: the first of ~/.config/pyeye/config.json, ~/.pyeye.json that exists - User defaults
  2. Project Config: the first of .pyeye.json, .pyeye.yaml, .pyeye.yml, pyproject.toml, .claude/pyeye.json in the project root (in pyproject.toml, the [tool.pyeye] section)
  3. Override File: .pyeye.override.json - Local development overrides (keep it out of git)
  4. Auto-Discovery, only if no packages are configured yet: a src/ layout is used when there is one; otherwise sibling packages are added. (The project's virtualenv isn't a package: pyeye reads it as the project's environment, above.)
  5. This session's unsaved additions: packages, namespaces and standalone directories added with configure_packages(save=false). They're applied last and don't stop auto-discovery

The top-level keys pyeye reads are packages, namespaces, standalone, scope_defaults, scope_aliases, environment.

Using Override Files

Override files are perfect for local development configurations that shouldn't be committed. .pyeye.override.json takes precedence over the other sources; add it to your project's .gitignore:

{
  "packages": [
    "../my-local-dev-package",
    "~/dev/experimental"
  ],
  "namespaces": {
    "company.feature": ["/home/user/feature-branch"]
  }
}

Performance Settings

Performance settings are configured through environment variables. The generated reference lists every PYEYE_* variable pyeye reads, with its default, range and status (live or deprecated). Deprecated variables have no effect.

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 and restart the client. In Claude Code, remove the server and add it again with -e flags, using the command you registered it with (here uvx pyeye-mcp): claude mcp remove pyeye && claude mcp add pyeye -s user -e PYEYE_MAX_PROJECTS=20 -- uvx pyeye-mcp. Other clients take an env map in their config. 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 .py file count (the default is 2000). 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 and accept slower rebuilds.

This advice comes from measurements on one large project in #768.

Performance Tuning Examples

Set the variables on the server entry, so they reach the server however the client was started. For example, with Claude Code (remove the server first, and use the command you registered it with):

claude mcp remove pyeye

# Keep more projects in memory, cache longer and batch file changes more
claude mcp add pyeye -s user \
  -e PYEYE_MAX_PROJECTS=50 -e PYEYE_CACHE_TTL=1800 -e PYEYE_WATCHER_DEBOUNCE=2.0 \
  -- uvx pyeye-mcp

# Or use less memory: fewer projects and fewer parsed files kept
claude mcp add pyeye -s user \
  -e PYEYE_MAX_PROJECTS=3 -e PYEYE_ARTIFACT_CACHE_MAX_ENTRIES=250 \
  -- uvx pyeye-mcp

Other clients take the same names in the server entry's env map.

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"

Two conditions apply. pyproject.toml is read only when it is the project's config file, the first of the project config files above that exists, so a .pyeye.json or .pyeye.yaml in the root means it is never read. And detection only runs when no packages are set yet, including by your global config.

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.

The core tools are configure_packages, expand, inspect, outline, resolve, resolve_at, trace. The usual flow is to resolve a name to a handle, inspect or outline it, then follow relationship edges with expand (one hop) or trace (many hops); configure_packages registers extra package locations. The tool reference gives every tool's parameters and defaults, and the edge reference lists the supported edges. For worked examples, see the python-explore skill (skills/python-explore/SKILL.md).

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, through the implemented edges:

`members`, `callees`, `imported_by`, `subclasses`, `superclasses`, `imports`, `enclosing_scope`, `submodules`, `re_exports`.

Static-surface ceiling: each edge measures a stated scope, and its answer is complete only over that scope. The edge reference gives each edge's ceiling.

Removed in v2.0. find_references, get_call_hierarchy, and analyze_dependencies were 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)

A plugin's tools are registered when its framework is detected in the project. See the tool reference for each tool's parameters.

  • Django: find_django_migrations, find_django_models, find_django_templates, find_django_urls, find_django_views
  • Pydantic: find_computed_fields, find_field_validators, find_model_config, find_pydantic_models, find_validators, get_model_schema, trace_model_inheritance
  • Flask: find_cli_commands, find_error_handlers, find_flask_blueprints, find_flask_config, find_flask_extensions, find_flask_routes, find_flask_templates, find_flask_views

Advanced Features

Multi-Project Support

Analyze your main project along with local dependencies. Put them in .pyeye.json (see Configuration), or ask your assistant to call the configure_packages tool with arguments like these:

{
  "packages": ["../my-lib", "~/repos/shared-utils"],
  "namespaces": {"company": ["~/repos/company-auth", "~/repos/company-api"]}
}

Namespace Packages

Handle packages distributed across multiple repositories, for example company.auth in one repo and company.api in another:

{
  "namespaces": {"company": ["~/repos/company-auth", "~/repos/company-api"]}
}

Auto-Update on File Changes

The server watches the project's files and drops cached results for the files that change, so answers follow your edits without a restart. See Caching for how invalidation works.

Architecture

The architecture pages describe how pyeye works inside:

  • Resolution: how a name becomes a canonical handle
  • Caching: what is cached and when it is invalidated
  • Plugin system: how framework plugins are detected and register their tools

Plugin Development

Plugins are built into pyeye; there is no dynamic loading. To add a framework plugin, follow Adding a plugin.

Performance Monitoring

Set PYEYE_ENABLE_PERFORMANCE_METRICS to true to register the admin tools:

`get_performance_metrics`, which reports per-tool latencies, and `get_connection_diagnostics`, which reports the server's

connection state and recent errors. Their parameters are in the tool reference.

Development

# Install pyeye with its development dependencies, exactly as locked
uv sync --frozen

# Run tests
uv run pytest

# Format and lint
uv run black src/
uv run ruff check src/

See CONTRIBUTING.md for the full setup and workflow.

Documentation

The full documentation is published at okeefeco.github.io/pyeye-mcp, built from the Markdown in this repository.

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! See CONTRIBUTING.md before opening a pull request.

License

MIT License - see LICENSE 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyeye-mcp 2.2.0
File Size Uploaded Provenance Actions
pyeye_mcp-2.2.0.tar.gz 2.0 MB With provenance Details for pyeye_mcp-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyeye-mcp 2.2.0
File Interpreter ABI Platform Actions
pyeye_mcp-2.2.0-py3-none-any.whl Python 3 none any Details for pyeye_mcp-2.2.0-py3-none-any.whl

Total release size: 2.5 MB

Release files / pyeye_mcp-2.2.0.tar.gz

Download URL pyeye_mcp-2.2.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f92c821a2e7b3ec2cb5ea5c8644165b0fec219789d8b0bd896f4dcde4ac274d1
BLAKE2b-256 checksum
How to use checksums
f30ce5e3209301bb3b914960969a1ce04124db57354ea6a458497feab6fc0a69
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 19, 2026.

Transparency log

Release files / pyeye_mcp-2.2.0-py3-none-any.whl

Download URL pyeye_mcp-2.2.0-py3-none-any.whl
Size 459.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25f6a515629feaf5f4b65150e6c0dea2968321d9981942063f170e1e09211656
BLAKE2b-256 checksum
How to use checksums
723f0cae4b1240f5b92c3cdd7930e36cab62b9625201ccd80ad619f405afd867
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 19, 2026.

Transparency log

Security for pyeye-mcp 2.2.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.

Select from 2 files

Attestation for pyeye_mcp-2.2.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 19, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page