Skip to content

Django REST Framework

With drf-spectacular installed, DRF emits a valid OpenAPI 3.x schema and Postman MCP uses the OpenAPI path:

postman-mcp init
# → detects Django, finds the schema endpoint / committed openapi.yaml
# → inputMode = openapi

This is the most accurate path: serializers, responses, and auth all come straight from the generated schema.

Code-parsing fallback

Without a spec, the DRF parser (input/parsers/django.py) extracts:

Aspect From
Routes urls.py patterns, viewsets
Body / response types serializers
Auth permission_classes

Known limits

Router-registered viewsets

The current parser covers path('x/', View.as_view()) and explicit viewsets. DefaultRouter-registered viewsets and nested include() chains are not yet fully resolved in the code path — see the roadmap. If your URLs are router-driven, prefer the OpenAPI path (drf-spectacular), which captures them all.

Example

See examples/django-rest-framework/.