Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

ezmcp

MCP.Pizza Chef: jujumilk3

ezmcp is a lightweight MCP server framework designed for easy creation of MCP-compatible servers using a FastAPI-like decorator API. It supports automatic parameter validation, type conversion, tool schema generation, and SSE transport. It integrates seamlessly with Starlette applications and includes interactive documentation for tool exploration and testing.

Use This MCP server To

Create MCP servers with minimal code using FastAPI-style decorators Define and expose callable MCP tools with automatic schema generation Stream real-time data to MCP clients using SSE transport Integrate MCP servers into existing Starlette web applications Validate and convert tool parameters automatically on server side Provide interactive documentation for MCP tools for easier testing Build custom MCP servers for AI agents and workflow automation

README

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

docs_image

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

ezmcp FAQ

How do I install ezmcp?
Install ezmcp easily via pip using 'pip install ezmcp'.
What transport protocols does ezmcp support?
ezmcp has built-in support for Server-Sent Events (SSE) transport.
Can I integrate ezmcp with existing web frameworks?
Yes, ezmcp integrates easily with Starlette applications and supports FastAPI-style middleware.
How does ezmcp handle parameter validation?
It automatically validates and converts parameters based on function signatures.
Does ezmcp provide documentation for defined tools?
Yes, it includes an interactive documentation page for exploring and testing tools.
What programming style does ezmcp use for defining tools?
It uses a FastAPI-like decorator syntax for defining MCP tools.
Is ezmcp suitable for real-time applications?
Yes, its SSE support enables real-time streaming to MCP clients.
Can I define multiple tools in one ezmcp server?
Yes, you can define multiple tools using decorators within a single ezmcp app.