Skip to main content

Model Context Protocol (MCP) server providing documentation and code analysis for Python packages

Project description

MCPyDoc - Python Package Documentation MCP Server

CI PyPI version Python 3.9+ License: MIT

AI assistants often hallucinate when code depends on private or unfamiliar Python packages: guessed APIs, wrong signatures, and outdated usage that breaks at runtime. MCPyDoc fixes that by giving your assistant real-time access to the actual documentation and source code of the Python packages installed in your environment.

MCPyDoc is a Model Context Protocol (MCP) server that provides comprehensive documentation and code analysis capabilities for Python packages. It enables AI agents like Cline and GitHub Copilot to understand and work with Python codebases more effectively.

✨ Features

  • 📚 Package Documentation: Get comprehensive docs for any Python package
  • 🔍 Symbol Search: Find classes, functions, and modules by pattern
  • 💻 Source Code Access: Retrieve actual implementation code
  • 🏗️ Structure Analysis: Analyze complete package architecture
  • 🔧 Type Hints: Extract and analyze type annotations
  • 📖 Docstring Parsing: Support for Google, NumPy, and Sphinx formats
  • 🏃 High Performance: Efficient caching and optimized operations
  • 🛡️ Error Handling: Robust error management and validation

🚀 Quick Start

VS Code Extension

For a zero-config setup inside VS Code, install the MCPyDoc extension. It registers the server using the MCP Server Definition Provider API and automatically ensures the mcpydoc package is available when the server starts.

Installation for PyCharm AI Assistant

  1. Install MCPyDoc in the Python interpreter PyCharm will use for AI Assistant:

    pip install mcpydoc
    

    💡 If you use multiple interpreters/virtual environments, make sure mcpydoc is installed in the same environment PyCharm uses for MCP servers. You can check or change this in Settings → Project → Python Interpreter.

  2. Open MCP configuration: Go to Settings → Tools → AI Assistant → Model Context Protocol (MCP).

  3. Add a new server:

    • Click Add → As JSON, and paste:

      {
        "mcpServers": {
          "mcpydoc": {
            "command": "python",
            "args": ["-m", "mcpydoc"],
            "env": {},
            "description": "Python package documentation and code analysis server"
          }
        }
      }
      

      Or use Add → Command and fill:

      • Command: python
      • Arguments: -m mcpydoc
  4. Apply and restart AI Assistant: PyCharm will launch MCPyDoc automatically when the AI Assistant starts.

Installation for Other Platforms

  1. Install MCPyDoc:

    pip install mcpydoc
    

    Alternative: You can also use pipx install mcpydoc or uvx mcpydoc if you prefer isolated environments.

  2. Add to your MCP configuration:

    {
      "mcpServers": {
        "mcpydoc": {
          "command": "python",
          "args": ["-m", "mcpydoc"],
          "env": {},
          "description": "Python package documentation and code analysis server"
        }
      }
    }
    

    💡 Platform Note: On some Linux/macOS systems, you may need to use python3 instead of python. To check which command is available, run python --version or python3 --version in your terminal.

    💡 pipx users: If you installed with pipx, you can use "command": "mcpydoc" with empty args instead.

Development Installation

If you want to contribute or modify the source code:

git clone https://github.com/amit608/MCPyDoc.git
cd MCPyDoc
pip install -e .[dev]

📊 Supported Package Types

  • Standard Library - Built-in modules (json, os, sys, etc.)
  • Third-Party Packages - pip-installed packages
  • Local Packages - Development packages in current environment
  • Virtual Environments - Proper path resolution

📝 License

MIT License - see LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run the test suite
  6. Submit a pull request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpydoc-1.2.0.tar.gz (847.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcpydoc-1.2.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file mcpydoc-1.2.0.tar.gz.

File metadata

  • Download URL: mcpydoc-1.2.0.tar.gz
  • Upload date:
  • Size: 847.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcpydoc-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b215f9c91a00cb11e61fb1174b7748c04865e12a7bbec474c9abcb52073135f4
MD5 cf1e44c6d5ad75170753420bf75d7326
BLAKE2b-256 598d821b8f45dd0af506d7f014af5c0e883df7d45a3911ad2413936ddc3c6e30

See more details on using hashes here.

File details

Details for the file mcpydoc-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcpydoc-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcpydoc-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a04d15189efe3bd87d665b1584f4d23561cade9ff6df1411f85190abdf1259e3
MD5 a4d8e1a91c9843e6341d803a964c8279
BLAKE2b-256 46f0c8136a0e4723d2eadcc62c10d1687abf8bbb87a9dd211c46c359314f910a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page