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 iflow-mcp_jujumilk3-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)
| File | Size | Uploaded | |
|---|---|---|---|
| iflow_mcp_jujumilk3_ezmcp-0.0.2.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iflow_mcp_jujumilk3_ezmcp-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.3 kB
Release files / iflow_mcp_jujumilk3_ezmcp-0.0.2.tar.gz
| Download URL | iflow_mcp_jujumilk3_ezmcp-0.0.2.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b22ba1dab147a297e0f554db647412f8120e2780cadc18e6dbac394bfb465910
|
|
BLAKE2b-256 checksum How to use checksums |
6a8f6bd9c1cd6d820b982b9974a88435b4b575564f5cd7f15feffcd7f236fdda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_jujumilk3_ezmcp-0.0.2-py3-none-any.whl
| Download URL | iflow_mcp_jujumilk3_ezmcp-0.0.2-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
523a75704099770bb97af4c3ee30918b0f6537d663b4e6ef8b95f54ebf66c933
|
|
BLAKE2b-256 checksum How to use checksums |
61407ecda662b9356c5e88a27f8f3c8090218fda1a9e7c55f197f0c1ea08dc16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|