Recipes¶
Short, opinionated cookbook entries. Each one is a complete, runnable snippet that solves a single concrete problem. Browse the list:
- Expose a service — the smallest possible end-to-end.
- Swap the session store — when the default cache isn't what you want.
- Ship TOON for large lists — token-efficient tool output.
- Add a custom permission — beyond
ScopeRequired. - Write an async-native auth backend —
httpxintrospection against a remote IDP without blocking the event loop. - Add rate limiting — per-binding
MCPRateLimitwith the shippedFixedWindowRateLimit/SlidingWindowRateLimitor your own. - Multi-worker SSE with Redis — swap the in-memory
broker for
RedisSSEBrokerso any ASGI worker can fan out push messages. - Resume SSE with Last-Event-ID — opt-in per-session replay buffer so reconnecting clients catch up on missed events.
- Honor
drf-spectacularannotations — feed@extend_schema_serializer/@extend_schema_fieldmetadata into the MCPinputSchemaautomatically. - Selector tool with FilterSet —
expose a list-shaped read tool with
django-filter, ordering, and pagination, generatedinputSchemaand all. - Migrate from
fastapi-mcp/ hand-rolled MCP — step by step from a custom Django MCP view or afastapi-mcpapp.