File layout
A generated MCP server contains the following files:_auth.py is only generated if the OpenAPI spec defines security schemes. APIs without authentication skip this file entirely.Core files
server.py
The main entry point. Contains:
- Tool definitions — One
@mcp.tool()async function per API operation - HTTP client setup — Connection pooling, timeouts, mTLS support
- Resilience logic — Retry with exponential backoff, circuit breaker, rate limiting
- Authentication injection — Selects correct auth per operation
- Response handling — JSON parsing, error formatting, optional validation
- Transport selection — stdio, SSE, or streamable-http (selected at runtime)
_models.py
Pydantic models for every operation’s parameters and (optionally) responses. Models are generated from the OpenAPI schema definitions and enforce:
- Type safety — Correct Python types for each parameter
- Required fields — Missing required parameters are rejected
- Format validation — Dates, emails, UUIDs, etc. are validated against their declared formats
- Strict mode — Unknown fields in requests are rejected (prevents malformed calls)
_validators.py
Shared validation infrastructure with 25+ format validators covering:
| Category | Formats |
|---|---|
| Date/time | date-time, date, time, duration (RFC 3339, ISO 8601) |
| Identifiers | uuid, uri, iri, json-pointer |
| Network | ipv4, ipv6, hostname, email |
| Numbers | int32, int64, float, double, decimal |
| Other | byte, binary, regex, password |
RequestModel, ResponseModel) that all generated models inherit from.
_auth.py
Authentication handler classes, one per security scheme found in your spec. See Authentication for details on each type.
Includes OPERATION_AUTH_MAP — a mapping from each operation ID to its required authentication schemes, supporting both OR (use any available) and AND (use all together) logic.
Configuration files
.env
Runtime configuration split into sections:
.env
requirements.txt
Auto-detected dependencies based on what the generated code imports:
requirements.txt
authlibandPyJWT— if OAuth2, OIDC, or JWT auth is usedrequests— if OAuth2 browser-based flow is used
.mcp.json
Pre-configured MCP client configuration template:
.mcp.json
server.py.
metadata.json
Generation metadata used by deployment platforms:
metadata.json