Skip to main content

py-easy-mcp ⚡🤖

PyPI version Python versions License: MIT Tests good first issues Contributions welcome

Ultra-lightweight, zero-dependency Python framework for Model Context Protocol (MCP). Build MCP servers for Claude in seconds.

Turn standard Python functions (both sync and async def) into Model Context Protocol tools, resources, and prompt templates for Claude Desktop and Claude Code with simple decorators.

Start here: your first contribution

Featured beginner issue #11: Write an offline walkthrough of the existing math example. Read CONTRIBUTING.md for setup, claiming an issue, and opening a draft PR.

Repository: easy-mcp; PyPI distribution: py-easy-mcp; Python import: easy_mcp. Both py-easy-mcp and easy-mcp are installed CLI aliases.

Try this from a reviewed source checkout, in the repository root, with Python 3.8+. It uses synthetic inputs and needs no API key or network access:

from examples.basic_math import mcp
print(mcp.call_tool("add", {"a": 2, "b": 3}))

Expected output:

{'content': [{'type': 'text', 'text': '5'}], 'isError': False}

⚡ Why py-easy-mcp?

  • Zero dependencies: Written in 100% pure standard Python. No third-party runtime dependencies; review code and build tools before use.
  • Sync & Async Support: Supports both standard def and modern async def tool, resource, and prompt handlers.
  • Full MCP Protocol Support (v0.3.0): Tools (@mcp.tool()), Resources (@mcp.resource()), and Prompts (@mcp.prompt()).
  • 1-Click Claude Desktop Installer: Run py-easy-mcp install server.py to auto-detect and configure claude_desktop_config.json with automatic backup.
  • Dev Inspector & Interactive REPL: Test your tools in the terminal with py-easy-mcp dev server.py without needing Claude Desktop open.
  • Automatic Schema Inspection: Docstrings and type annotations are automatically converted into standard JSON Schemas.
  • Offline & Safe: Standard I/O (stdio) JSON-RPC 2.0 communication.

📦 Installation

pip install py-easy-mcp

(Note: Both CLI commands py-easy-mcp and easy-mcp are available)


🚀 30-Second Quickstart

1. Write your server (my_server.py)

from easy_mcp import EasyMCP

mcp = EasyMCP(name="my-server", version="0.3.0")

# 1. Register a Sync or Async Tool
@mcp.tool()
async def fetch_weather(city: str) -> dict:
    """Fetch weather forecast for a given city.

    Args:
        city: The city name (e.g. 'Tokyo', 'San Francisco')
    """
    return {"city": city, "temp": "22°C", "condition": "Sunny"}

# 2. Register a Resource (readable context)
@mcp.resource("memo://guidelines")
def guidelines() -> str:
    """Engineering principles."""
    return "1. Keep it simple.\n2. Zero external dependencies.\n3. Write clear tests."

# 3. Register a Prompt Template
@mcp.prompt()
def code_review(code: str, language: str = "python") -> str:
    """Review code for bugs and maintainability."""
    return f"Please review this {language} snippet:\n\n{code}"

if __name__ == "__main__":
    mcp.run()

2. 1-Click Install to Claude Desktop

Simply run:

py-easy-mcp install my_server.py

py-easy-mcp will:

  1. Locate your OS Claude config (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/... on macOS).
  2. Create a timestamped backup (claude_desktop_config.json.bak).
  3. Register my-server pointing to your current Python environment.

Restart Claude Desktop, and your tools will appear instantly!


🛠️ CLI Utilities & Dev Tools

Dev Inspector (Offline Testing)

Inspect all registered schemas, parameter requirements, and docstrings:

py-easy-mcp dev my_server.py

Direct Tool Execution

Test a tool directly from your command line:

py-easy-mcp dev my_server.py --call fetch_weather -a '{"city": "Tokyo"}'

Interactive REPL

Start an interactive terminal session to explore tools and resources:

py-easy-mcp dev my_server.py -i

Scaffold a New Project

py-easy-mcp init weather-server

📂 Production MCP Examples

Check out our ready-to-run examples in examples/:

  • examples/sqlite_server.py - Full SQLite database inspector with list_tables, describe_table, execute_query (read-only), and schema DDL resource.
  • examples/basic_math.py - Arithmetic calculation tools.
  • examples/pii_shield_mcp.py - AI data privacy sanitizer for Claude.

🤝 Contributing for Hacktoberfest

We welcome beginner-friendly contributions! Add new lightweight tool examples or protocol extensions. See CONTRIBUTING.md to get started.


📄 License

MIT License © 2026 lui01212

Metadata

Release files for py-easy-mcp 0.3.1

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

Source distribution (sdist)

Source distribution for py-easy-mcp 0.3.1
File Size Uploaded
py_easy_mcp-0.3.1.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-easy-mcp 0.3.1
File Interpreter ABI Platform
py_easy_mcp-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 42.0 kB

Release files / py_easy_mcp-0.3.1.tar.gz

Download URL py_easy_mcp-0.3.1.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5d6dfa0e19bcb54edd7daa2c1ff7dbd21b00fbc24ce94d70458f14f400948f
BLAKE2b-256 checksum
How to use checksums
01493b09b0bea7c48ab73861f313a78e17baea04d377a15ee61a1b343e6fe81f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 5, 2026.

Transparency log

Release files / py_easy_mcp-0.3.1-py3-none-any.whl

Download URL py_easy_mcp-0.3.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73d5a4c364ca7a1cdbe82589b8e5c8cd367a7c2e6a84209dd15d7a09512e2e91
BLAKE2b-256 checksum
How to use checksums
f4a1e86c780d747565b3a8e7caa56a4d30d201286fc1511b534473bfeb5b267f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

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