MCP Catalogs
Home

pydantic-rpc

by i2y·74·Score 45

PydanticRPC rapidly exposes Pydantic models as gRPC, ConnectRPC, and MCP services without protobuf files.

developer-toolsai-llm
7
Forks
1
Open issues
3 mo ago
Last commit
2d ago
Indexed

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:

you:Building AI services with tools exposed through MCP protocol
you:Creating gRPC services without writing protobuf files
you:Developing HTTP-based RPC services using Connect-RPC
you:Can I skip protobuf generation in production?

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 README
  • ask(req: OlympicsQuery) -> CityLocation

    Query 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

fastapi-mcppython-mcpgrpc-gateway

Installation

Install PydanticRPC via pip:

pip install pydantic-rpc

For CLI support:

pip install pydantic-rpc-cli

To 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

GitHub →

Last updated · Auto-generated from public README + GitHub signals.