What it does
Django MCP Server is a Django extension that exposes your application's models and custom methods as Model Context Protocol tools, allowing AI agents and MCP clients to interact with your Django application. It serves an HTTP MCP endpoint implementing the streamable HTTP protocol, supporting both WSGI and ASGI without infrastructure changes. Define tool access declaratively: subclass ModelQueryToolset to expose a Django model with optional queryset filtering, or subclass MCPToolset to publish custom Python methods as callable tools. The extension handles serialization, parameter validation, and tool discovery.
Who it's for
Django developers building applications that need to integrate with AI agents—backend engineers wiring Claude or other MCP clients into existing Django services, teams adding AI features to Django REST applications, developers who want to expose domain-specific models or business logic to agents without building additional REST layers.
Common use cases
- Expose Django ORM models to Claude with automatic queryset-level filtering (no REST API needed).
- Convert Django REST Framework endpoints to MCP tools via a single decorator.
- Allow AI agents to call custom Django methods—sending notifications, generating reports, updating records—from within agent workflows.
- Build multi-step agent routines that query your database and trigger server-side tasks.
Setup pitfalls
- OAuth2 is mandatory for Claude AI. As of June 2025, Claude AI requires OAuth2 authentication to connect. Install Django OAuth Toolkit and configure
DJANGO_MCP_AUTHENTICATION_CLASSES; Dynamic Client Registration is only partially supported (a third-party add-on fills the gap). - OAuth2 URLs must be at standard locations. Keep
/register,/token, and/authorizeat their defaults unless you fully implement the OAuth metadata RFC—custom paths will break discovery. - Requires INSTALLED_APPS and URL configuration. Both
mcp_serverinINSTALLED_APPSand the URL include inurls.pyare mandatory; endpoint defaults to/mcp. - No continuous integration. There is no CI pipeline—test thoroughly before deploying to production, especially when upgrading Django or the MCP server itself.