loading…
Search for a command to run...
loading…
A capability-first MCP server toolkit for FastAPI that supports Streamable HTTP and stdio transports, with registries for tools, prompts, and resources, plus op
A capability-first MCP server toolkit for FastAPI that supports Streamable HTTP and stdio transports, with registries for tools, prompts, and resources, plus optional auth hooks and task management.
Python CI codecov PyPI - Version PyPI Downloads Docs License: MIT Python 3.10+
Documentation | Quick Start | Tasks | Security | Middleware
PyMCP Kit is a capability-first MCP server toolkit for FastAPI. It keeps the built-in transport surface small, supports Streamable HTTP and stdio, and ships app-scoped registries, roots, tasks, and optional auth hooks without pulling in a larger framework.
Install from PyPI:
pip install pymcp-kit
For local development from this repo:
pip install -e .
Register tools, prompts, and resources, then build an app:
from pymcp import (
CapabilitySettings,
ServerSettings,
create_app,
prompt_registry,
resource_registry,
tool_registry,
)
@tool_registry.register
def add(a: float, b: float) -> str:
return str(a + b)
@prompt_registry.register(description="Create a release summary prompt.")
def summarize_release(topic: str) -> str:
return f"Summarize the release impact for {topic}."
@resource_registry.register(
uri="memo://release-plan",
name="release_plan",
description="Latest release checklist",
mime_type="text/markdown",
)
def release_plan() -> str:
return "# Release Plan\n- freeze API\n- tag build\n"
app = create_app(
server_settings=ServerSettings(
name="demo-server",
version="0.1.0",
capabilities=CapabilitySettings(
advertise_empty_prompts=False,
advertise_empty_resources=False,
),
)
)
The HTTP transport is mounted at /mcp. For local-process integrations, use run_stdio_server(app).
Hosted documentation is built from docs/ with MkDocs Material and published to GitHub Pages.
CapabilitySettingsMiddlewareConfiginitialize, ping, notifications/initialized, and notifications/cancelledtools/list and tools/callprompts/list and prompts/getresources/list, resources/read, resources/subscribe, and resources/unsubscriberoots/listtasks/list, tasks/get, tasks/cancel, and tasks/resultRun the bundled example server:
python example/run_server.py
That starts a FastAPI app on http://127.0.0.1:8088 with the MCP endpoint mounted at http://127.0.0.1:8088/mcp.
from pymcp import create_app, run_stdio_server
app = create_app()
run_stdio_server(app)
Middleware stays separate from capability registration. Use MiddlewareConfig to control CORS, compression, logging, auth hooks, and custom ASGI middleware, then pass it into create_app(). See the hosted Middleware guide for examples.
create_app() runspymcp-kitRun in your terminal:
claude mcp add pymcp-kit -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.