File layout
A generated MCP server contains the following files:_auth.py is only generated if the OpenAPI specification 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 authentication 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 50+ format validators covering all 49 OAS Format Registry formats plus custom extensions:
| Category | Formats |
|---|---|
| Integer | int8, int16, int32, int64, uint8, uint16, uint32, uint64, double-int |
| Number | float, double, decimal, decimal128 |
| Date/time | date-time, date, time, duration, date-time-local, time-local, http-date, unixtime |
| Identifiers | uuid, uri, iri, json-pointer, relative-json-pointer, media-range |
| Network | ipv4, ipv6, hostname, idn-hostname, email, idn-email |
| Text | commonmark, html, char, regex, password |
| Structured Fields | sf-integer, sf-decimal, sf-string, sf-token, sf-boolean, sf-binary |
| Encoding | byte, binary, base64url |
StrictModel, PermissiveModel) that all generated models inherit from. See Strict/Permissive models for details.
_auth.py
Authentication handler classes, one per security scheme found in your specification. 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 authentication is usedrequests— if OAuth2 browser-based flow is used
.mcp.json
Pre-configured MCP client configuration template:
.mcp.json
server.py.
Next steps
Authentication
Configure credentials for each authentication type.
Security features
Circuit breakers, rate limiting, retries.