Skip to main content

ezmcp

Easy-to-use MCP server framework specialized for SSE.

Overview

ezmcp is a lightweight framework that makes it easy to create MCP-compatible servers using a FastAPI-like syntax. It provides a simple decorator-based API for defining tools that can be called by MCP clients.

Features

  • FastAPI-style decorator API for defining MCP tools
  • Automatic parameter validation and type conversion
  • Automatic generation of tool schemas from function signatures
  • Built-in support for SSE transport
  • FastAPI-style middleware support
  • Easy integration with existing Starlette applications
  • Interactive documentation page for exploring and testing tools

Installation

pip install ezmcp

Quick Start

from ezmcp import ezmcp, TextContent

# Create an ezmcp application
app = ezmcp("my-app")

# Define a tool
@app.tool(description="Echo a message back to the user")
async def echo(message: str):
    """Echo a message back to the user."""
    return [TextContent(type="text", text=f"Echo: {message}")]

# Run the application
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Once the server is running, you can:

  • Access the interactive documentation at http://localhost:8000/docs
  • Connect to the SSE endpoint at http://localhost:8000/sse

Middleware

ezmcp supports middleware similar to FastAPI, allowing you to add behavior that is applied across your entire application.

from starlette.requests import Request

from ezmcp import TextContent, ezmcp

app = ezmcp("my-app")

@app.middleware
async def process_time_middleware(request: Request, call_next):
    """Add a header with the processing time."""
    import time
    start_time = time.perf_counter()
    response = await call_next(request)
    process_time = time.perf_counter() - start_time
    response.headers["X-Process-Time"] = str(process_time)
    return response

@app.tool(description="Echo a message back to the user")
async def echo(message: str):
    """Echo a message back to the user."""
    return [TextContent(type="text", text=f"Echo: {message}")]

For more information on middleware, see the middleware documentation.

Documentation

For more detailed documentation, see the ezmcp/README.md file.

License

MIT

commands

  • install for test pdm install -G test
  • install for dev pdm install -G dev

Metadata

Release files for ezmcp 0.0.2

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

Source distribution (sdist)

Source distribution for ezmcp 0.0.2
File Size Uploaded
ezmcp-0.0.2.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ezmcp 0.0.2
File Interpreter ABI Platform
ezmcp-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / ezmcp-0.0.2.tar.gz

Download URL ezmcp-0.0.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6ebac8ae3bdbb4111878dcd62e9d487f9fef0a9ba225482e3964c93883935cfc
BLAKE2b-256 checksum
How to use checksums
07ae4fb16afca3f910e915b2066422ef40480dbb5635c88df4e316d09962f1b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.22.3 CPython/3.13.2 Darwin/24.3.0

Release files / ezmcp-0.0.2-py3-none-any.whl

Download URL ezmcp-0.0.2-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87b5dd89fce708bb75b8ca02868c2a8f87c66d1bf5e553a7f6d50afbc3a970fd
BLAKE2b-256 checksum
How to use checksums
bc0de00190e34f93078b156fc4b4347e14b069f043af6f08782df19965f360bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.22.3 CPython/3.13.2 Darwin/24.3.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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