Skip to content

PyEye Server - Full Documentation

Table of Contents

  1. Overview
  2. Installation
  3. Configuration
  4. Tools Reference
  5. Architecture
  6. Security
  7. Use Cases
  8. Plugin Development
  9. Troubleshooting

Overview

The PyEye Server provides semantic code analysis for Python projects through the Model Context Protocol (MCP). It enables AI assistants like Claude to understand Python codebases without reading every file.

Key Capabilities

  • Semantic Analysis: Understands Python code structure, not just text matching
  • Multi-Project: Analyzes multiple projects and dependencies simultaneously
  • Auto-Update: Follows file changes without a restart
  • Framework plugins: Built-in plugins for Django, Pydantic and Flask
  • Cached: Keeps parse and analysis results in memory and drops them when files change

Installation

See the README's Installation: the Claude Code plugin, uvx pyeye-mcp for other MCP clients, or an install into your project's environment. To work on pyeye itself, see CONTRIBUTING.

Configuration

Configuration File (.pyeye.json)

Create in your project root:

{
  "packages": [
    ".",
    "../my-shared-library",
    "~/repos/company-utils",
    "/absolute/path/to/package",
    "~/repos/plugins/*"
  ],
  "namespaces": {
    "mycompany": [
      "~/repos/mycompany-*"
    ],
    "plugins": [
      "./plugins/builtin",
      "~/repos/community-plugins"
    ]
  }
}

packages lists package directories: relative to the project, under your home directory (~), absolute, or a glob. Each namespaces entry names a namespace package and lists the repositories that each hold part of it, one by one or as a glob. A glob (* only) expands to its matching directories in sorted order, and that order is the namespace's precedence: the first repository to define a module wins. A glob that matches nothing leaves the namespace with no repositories, and its scope is then reported as unsearched (#872).

Older docs also showed keys that are deprecated and have no effect: pyeye never read them, and it logs a warning when one is set (#581). They are

analysis, cache, default_packages, exclude, exclude_patterns, logging, performance, plugins, watch_exclude. Use the environment variables for cache tuning.

Configuration in pyproject.toml

[tool.pyeye]
packages = [
    "../shared-lib",
    "~/repos/utils"
]

[tool.pyeye.namespaces]
company = [
    "~/repos/company-auth",
    "~/repos/company-api"
]

Environment Variables

Packages and namespaces are not configured through environment variables. Use a project config file (above), the global configuration (below), or the configure_packages tool. Environment variables only tune performance and logging; the reference lists them, and the README's Performance Settings explains how to set them.

Global Configuration

Create ~/.config/pyeye/config.json:

{
  "packages": [
    "~/my-common-libs",
    "~/work/shared-utils"
  ]
}

Configuration Precedence

The README's Configuration Methods gives the order in which the sources are read and override each other.

Tools Reference

PyEye's core tools are configure_packages, expand, inspect, outline, resolve, resolve_at, trace: the progressive-disclosure primitives, plus configure_packages for registering extra package locations. The tool reference gives every tool's parameters and defaults, and the edge reference lists the supported edges. Worked examples live in the python-explore skill (.claude/skills/python-explore/SKILL.md).

The v1 navigation tools were removed in 2.0. The CHANGELOG's migration map lists the replacement for each.

Framework-Specific Tools

A plugin's tools are registered when its framework is detected in the project. Their parameters are in the tool reference, and each plugin's page in docs/api/ explains what it finds.

  • 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

Architecture

The design contracts are in docs/architecture/: Resolution and Determinism, Plugin System and Caching Strategy.

Security

SECURITY.md covers pyeye's security model: what it reads and writes, what its path checks cover, and how to report a vulnerability.

Use Cases

1. Monorepo Development

{
  "packages": [
    "./packages/core",
    "./packages/utils",
    "./packages/api",
    "./apps/web",
    "./apps/mobile"
  ]
}

2. Microservices Architecture

{
  "packages": [
    "../auth-service",
    "../payment-service",
    "../notification-service",
    "../shared-libs"
  ]
}

3. Plugin-Based Application

{
  "namespaces": {
    "myapp.plugins": [
      "./plugins/builtin",
      "~/repos/community-plugins",
      "~/my-plugins"
    ]
  }
}

4. Enterprise Namespace Packages

{
  "namespaces": {
    "company": [
      "~/repos/company-common",
      "~/repos/company-auth",
      "~/repos/company-billing",
      "~/repos/company-analytics"
    ]
  }
}

Fuller configurations, with scope aliases and defaults, are in examples/configurations/.

Plugin Development

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

Troubleshooting

docs/TROUBLESHOOTING.md covers more cases.

Server Not Starting

  1. Check the Python version: pyeye needs Python >=3.11
  2. Run the server command yourself, from your project directory: the command in your client's config, for example uvx pyeye-mcp. It should start and wait for input (stop it with Ctrl-C); an error it prints is the real one
  3. Check logs: set PYEYE_LOG_LEVEL=DEBUG on the server entry, and PYEYE_LOG_FILE to write them to a file (see the environment variables)

Packages Not Found

  1. Verify paths in .pyeye.json
  2. Check path resolution: Use absolute paths for testing
  3. Verify packages exist and contain Python files

Stale Results

The caches live in the server's memory. Restart the server (reconnect it in your MCP client) to start from empty caches. To keep cached lookups for a shorter time, lower PYEYE_CACHE_TTL (see the environment variables).

File Changes Not Detected

  1. Check that the file system supports inotify (Linux) or FSEvents (macOS)
  2. Increase the logging level (PYEYE_LOG_LEVEL=DEBUG) to see watcher events

Performance Issues

  1. Reduce number of included packages
  2. Increase the cache TTL (PYEYE_CACHE_TTL; see the environment variables)
  3. Size the parsed-file cache: see the README's Sizing the parsed-file cache

MCP Connection Issues

  1. Check the server's status: /mcp inside Claude Code
  2. Check MCP server health: claude mcp list
  3. Review Claude logs for connection errors
  4. Register it again with the command you used before, for example claude mcp remove pyeye && claude mcp add pyeye -s user -- uvx pyeye-mcp. For the plugin, disable and re-enable pyeye in /plugin

Contributing

See CONTRIBUTING.md.

License

MIT License - See LICENSE for details.