django
Connect Django apps to AI assistants with Model Context Protocol. Simple decorators expose models, admin functions, and custom tools to Claude and other AI assistants.
claude mcp add --transport stdio hyperb1iss-django-mcp uvx django-mcp \ --env DJANGO_MCP_URL_PREFIX="mcp (URL path prefix for MCP endpoints)" \ --env DJANGO_MCP_SERVER_NAME="My Django MCP Server (optional, defaults to project name)" \ --env DJANGO_MCP_INSTRUCTIONS="Instructions for the AI assistant"
How to use
Django-MCP exposes your Django app to AI assistants using the Model Context Protocol. It auto-discovers MCP components such as tools (functions), models, and DRF viewsets, and serves them over an ASGI-compatible channel so an AI assistant can invoke your app’s capabilities. To use it, install the package in your Django project, add the MCP app to INSTALLED_APPS, configure the basic MCP settings, and run your Django server. The AI assistant can then connect to your MCP endpoint (for example /mcp/) and start invoking tools like product searches, model CRUD operations, and more, depending on what you’ve exposed with the provided decorators and admin/DRF integrations. The system supports ASGI for real-time communications and SSE-based MCP messaging, making interactions feel responsive and stateful where needed.
How to install
Prerequisites:
- Python 3.10 or newer
- Django 4.0 or newer
- Access to install Python packages (pip)
Step-by-step:
-
Install Django-MCP in your Django project:
pip install django-mcp
-
Optionally install via UV (recommended for asynchronous MCP communications):
uv add django-mcp
-
Add the MCP app to your Django project settings:
settings.py
INSTALLED_APPS = [ # ... your other apps ... 'django_mcp', ]
-
Configure MCP settings (optional but recommended):
settings.py
DJANGO_MCP_SERVER_NAME = "My Django App" DJANGO_MCP_URL_PREFIX = "mcp" # URL prefix for MCP endpoints DJANGO_MCP_INSTRUCTIONS = "This server provides access to my Django app."
-
Run your Django development server (ASGI) and expose MCP endpoints:
python manage.py runserver 0.0.0.0:8000
Or with UV (if using uvx):
uvx django-mcp
-
Visit the MCP dashboard and endpoints to verify discovery and tool exposure as described in the docs.
Additional notes
Tips and notes:
- Controller and tools are auto-discovered if you enable auto-discovery in settings (DJANGO_MCP_AUTO_DISCOVER).
- You can expose Django models, admin actions, and DRF viewsets for AI access via the decorated interfaces.
- Configure CORS and security settings as needed, especially when exposing MCP endpoints publicly.
- If you modify exposed tools or resources, re-run the server or trigger a refresh to update the MCP registry.
- The dashboard is available at /mcp/dashboard/ to review all registered tools, resources, and prompts.
Related MCP Servers
code-mode
🔌 Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.
mysql_mcp_server
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases
mcp-for-security
MCP for Security: A collection of Model Context Protocol servers for popular security tools like SQLMap, FFUF, NMAP, Masscan and more. Integrate security testing and penetration testing into AI workflows.
skill-to
Convert AI Skills (Claude Skills format) to MCP server resources - Part of BioContextAI
django-firebase
A production-ready Django app implementing Firebase Model Context Protocol (MCP) server with 14 Firebase tools for AI agents. Features standalone agent, HTTP/stdio transport, LangChain integration, and complete Firebase service coverage (Auth, Firestore, Storage).
Convert-Markdown-PDF
Markdown To PDF Conversion MCP