drf-mcp-docs exposes your Django REST Framework API documentation through the Model Context Protocol (MCP) so AI coding agents can read, understand, and help you write correct frontend integration code.
How is this different from other Django+MCP packages?
Packages like django-mcp-server and django-rest-framework-mcp expose DRF as MCP tools — the AI agent calls your endpoints directly. is fundamentally different: it exposes API so AI agents can help developers (React, Vue, Angular, etc.).
API documentation via MCP for AI coding agents
星數
16
工具
—
可用率
—
actions
drf-mcp-docs
documentation
write frontend code
Think of it as: drf-spectacular generates docs for humans in a browser → drf-mcp-docs generates docs for AI agents via MCP.
Features
MCP Resources — Browse your API structure: overview, endpoints, schemas, auth methods
You: "Show me all the product endpoints"
Agent: [reads api://endpoints resource, filters by tag]
You: "Generate a React hook to create a new product"
Agent: [calls get_endpoint_detail for POST /api/products/]
[calls get_request_example for the request body]
[calls generate_code_snippet with typescript + fetch]
→ Generates a complete, typed React hook with correct fields
Available Resources
Resource URI
Description
api://overview
API title, version, base URL, auth summary, tags, endpoint count
api://endpoints
All endpoints: path, method, summary, tags (compact listing)
api://endpoints/{method}/{path}
Full detail for one endpoint
api://schemas
All schema/model definitions (names + field summaries)
api://schemas/{name}
Full schema with properties, types, constraints
api://auth
Authentication guide with all auth methods
Available Tools
Tool
Parameters
Description
search_endpoints
query, method?, tag?
Search endpoints by keyword
get_endpoint_detail
path, method
Full endpoint documentation
get_request_example
path, method
Example request body and parameters
get_response_example
path, method, status_code?
Example response
generate_code_snippet
path, method, language?, client?
Integration code (JS/TS, Python, cURL) with pagination support
list_schemas
—
All data model names and descriptions
get_schema_detail
name
Full schema with all fields and types
Configuration
All settings are optional. Add a DRF_MCP_DOCS dict to your Django settings:
DRF_MCP_DOCS = {
# Server
'SERVER_NAME': 'my-api', # MCP server name (default: 'drf-mcp-docs')
'SERVER_INSTRUCTIONS': 'Custom prompt...', # Instructions shown to AI agents
# Schema
'SCHEMA_ADAPTER': None, # Auto-detect, or full dotted path
'SCHEMA_PATH_PREFIX': '/api/', # Only include endpoints under this prefix
'EXCLUDE_PATHS': ['/api/internal/'], # Paths to exclude
'CACHE_SCHEMA': not DEBUG, # Cache in production, refresh in dev
'CACHE_TTL': None, # Schema cache TTL in seconds (None = no expiry)
# Transport
'TRANSPORT': 'streamable-http', # Default transport: 'streamable-http' or 'stdio'
'MCP_ENDPOINT': '/mcp/', # URL path for HTTP transport
# Code generation
'DEFAULT_CODE_LANGUAGE': 'javascript', # 'javascript', 'typescript', or 'python'
'DEFAULT_HTTP_CLIENT': 'fetch', # 'fetch', 'axios', 'ky', 'requests', or 'httpx'
}
Schema Adapter Selection
drf-mcp-docs auto-detects your schema generator in this priority order:
drf-spectacular (recommended) — most complete OpenAPI 3.x output
drf-yasg — Swagger 2.0 auto-converted to OpenAPI 3.0
DRF built-in — basic fallback with limited schema detail