Metadata-Version: 2.4
Name: prodmcp
Version: 0.1.0
Summary: FastAPI-like production layer on top of FastMCP with schema-driven development, validation, security, middleware, and OpenMCP spec generation.
Author-email: Anish Chelliah CR <anishchelliah.cr@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/prodmcp/prodmcp
Project-URL: Documentation, https://github.com/prodmcp/prodmcp#readme
Project-URL: Repository, https://github.com/prodmcp/prodmcp
Keywords: mcp,fastmcp,schema,validation,openmcp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastmcp>=2.0
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"

# ProdMCP

> **FastAPI-like production layer on top of FastMCP** — schema-driven development, validation, security, middleware, and automatic OpenMCP specification generation.
FastAPI is built on top of Starlette and Pydantic. ProdMCP is built on top of FastMCP and Pydantic.

> **Production Grade security and validation layer for MCP** — We support multiple security providers and validation schemas. While also defining a seperate spec OpenMCP spec (similar to what OpenAPI is for Rest APIs). 42Crunch like security providers can validate the MCP server against the OpenMCP spec. Helping with Enterprice MCP adoption

> **OpenMCP spec** — Checkout OpenMCP-spec at https://github.com/ProdMCP/OpenMCP-spec/blob/main/schemas/v1.0.0/schema.json


## Installation

```bash
pip install prodmcp
```

## Quick Start

```python
from pydantic import BaseModel
from prodmcp import ProdMCP

app = ProdMCP("MyServer", version="1.0.0")


# --- Define Schemas ---

class UserInput(BaseModel):
    user_id: str

class UserOutput(BaseModel):
    name: str
    email: str


# --- Define a Tool ---

@app.tool(
    name="get_user",
    input_schema=UserInput,
    output_schema=UserOutput,
    security=[{"type": "bearer", "scopes": ["user"]}],
)
def get_user(user_id: str) -> dict:
    return {"name": "Alice", "email": "alice@example.com"}


# --- Define a Prompt ---

@app.prompt(
    name="summarize",
    input_schema=UserInput,
)
def summarize(user_id: str) -> str:
    return f"Please summarize data for user {user_id}"


# --- Define a Resource ---

@app.resource(
    uri="data://users",
    name="user_db",
    output_schema=UserOutput,
)
def fetch_users() -> list:
    return [{"name": "Alice", "email": "alice@example.com"}]


# --- Export OpenMCP Spec ---

spec = app.export_openmcp()
print(spec)

# --- Run the server ---

if __name__ == "__main__":
    app.run()
```

## Features

- **Decorator API** — `@app.tool()`, `@app.prompt()`, `@app.resource()` with schema, security, and middleware support
- **Schema-First** — Pydantic models or raw JSON Schema for input/output definitions
- **Validation Engine** — Automatic input/output validation with structured error reporting
- **Security Layer** — Bearer tokens, API keys, custom auth providers
- **Middleware System** — Global before/after hooks (logging, rate limiting, tracing)
- **Dependency Injection** — Composable dependencies injected into handlers
- **OpenMCP Spec** — Auto-generated, machine-readable specification from code

## License

MIT
