pydantic-rpc
by i2y·★ 74·Score 45
PydanticRPC rapidly exposes Pydantic models as gRPC, ConnectRPC, and MCP services without protobuf files.
Overview
PydanticRPC is a Python library that enables automatic generation of protobuf files from Pydantic model signatures, allowing developers to rapidly expose services via multiple protocols. The library provides comprehensive support for both gRPC and Connect-RPC, with built-in features like health checking, server reflection, and streaming capabilities. Its MCP support allows exposing services as AI assistant tools via both stdio and HTTP/SSE transports, making it versatile for AI integration scenarios.
Try asking AI
After installing, here are 4 things you can ask your AI assistant:
When to choose this
Choose PydanticRPC when you need to expose Python services with strong typing via multiple protocols and want to avoid manual protobuf definitions.
When NOT to choose this
Avoid if you need fine-grained control over generated protobuf files or require advanced features like comprehensive observability built-in.
Tools this server exposes
2 tools extracted from the READMEask(req: OlympicsQuery) -> CityLocationQuery information about Olympic locations for a specific year
ask_stream(req: OlympicsDurationQuery) -> AsyncIterator[StreamingResult]Stream information about Olympic locations across a range of years
Note: Tool names were inferred from the example code showing methods of the OlympicsAgent class. The actual MCP tool naming convention isn't explicitly documented in this README excerpt.
Comparable tools
Installation
Install PydanticRPC via pip:
pip install pydantic-rpcFor CLI support:
pip install pydantic-rpc-cliTo use in Claude Desktop, add to config.json:
{
"mcpServers": {
"pydantic-rpc": {
"command": "python",
"args": ["-m", "pydantic_rpc.server"],
"env": {
"PYDANTIC_RPC_PACKAGE_NAME": "my.services"
}
}
}
}FAQ
- What protocols does PydanticRPC support?
- PydanticRPC supports gRPC, Connect-RPC, and MCP protocols, with built-in support for both stdio and HTTP/SSE transports for MCP.
- Can I skip protobuf generation in production?
- Yes, set the environment variable PYDANTIC_RPC_SKIP_GENERATION=true to skip runtime generation and use pre-generated modules.
Compare pydantic-rpc with
Last updated · Auto-generated from public README + GitHub signals.