A zero-dependency Python micro-framework for the Model Context Protocol. Sync and async implementations (umcp.py and aioumcp.py) with a shared umcp_shared.py module, no third-party packages, stdio, Streamable HTTP, legacy HTTP+SSE and TCP transports, and a naming convention — functions starting with tool_ or prompt_ are discovered and exposed automatically. Type hints become JSON Schema; docstrings become descriptions. Adding MCP to an existing script takes minutes.
The protocol layer reads JSON-RPC 2.0 over stdio, Streamable HTTP, legacy HTTP+SSE or raw TCP. It discovers tool_ and prompt_ methods on your subclass via introspection, generates inputSchema from type hints (including Literal, Union, Optional, TypedDict), and infers MCP annotations (readOnlyHint, destructiveHint) from naming conventions. Return a value and it serialises automatically. Pick MCPServer for local-disk and compute work; pick AsyncMCPServer when tools are network-bound.
Pure Python 3.10+ standard library; no third-party packages.
stdio, Streamable HTTP, legacy HTTP+SSE and raw TCP.
Name a method tool_ or prompt_ — discovery, schema generation, and MCP wiring happen automatically.
MCPServer for compute / disk-bound tools; AsyncMCPServer for network-bound tools. Same API surface.
Literal, Union, Optional, TypedDict -> JSON Schema. Strict argument validation, type coercion for stringy clients.
prompt_* methods exposed via prompts/list and prompts/get. Reusable structured interactions for AI assistants.