django-admin
Expose Django admin models to MCP (Model Context Protocol) clients. Add a mixin to your ModelAdmin classes and let AI assistants like Claude perform CRUD operations, execute admin actions, and explore relationships—all respecting Django's permission system.
claude mcp add --transport stdio 7tg-django-admin-mcp python -m django_admin_mcp \ --env DJANGO_SETTINGS_MODULE="django_admin_mcp.settings" \ --env DJANGO_SUPERUSER_PASSWORD="optional, set if needed" \ --env DJANGO_SUPERUSER_USERNAME="optional, set if needed"
How to use
This MCP server exposes Django admin models to MCP clients over HTTP. By attaching the django_admin_mcp mixin to your Django ModelAdmin classes, you gain a set of MCP-enabled tools that allow remote clients to list, retrieve, create, update, delete, and perform admin actions on your models. It also supports model introspection, field filtering, and change history access, all while respecting Django permissions and token authentication. To use it, configure a token in the Django admin, then point your MCP client at the server’s endpoint (for example, http://localhost:8000/mcp/). The client can then discover available models with find_models, call CRUD tools like list_article, get_article, create_article, update_article, and delete_article, and leverage features such as actions_article, bulk_article, describe_article, and related_article to navigate relationships and history.
How to install
Prerequisites:
- Python 3.8+ and Django installed in your project
- A Django project already set up
- Install the package:
pip install django-admin-mcp
- Add the MCP app to INSTALLED_APPS in settings.py:
# settings.py
INSTALLED_APPS = [
'django_admin_mcp',
# ... other apps
]
- Include the MCP URLs in your project’s urls.py:
# urls.py
from django.urls import path, include
urlpatterns = [
path('mcp/', include('django_admin_mcp.urls')),
# ... other urls
]
- Run migrations to create the token model (for authentication):
python manage.py migrate django_admin_mcp
- Start your Django development server:
python manage.py runserver 8000
- Optional: configure a client token via the Django admin interface at /admin/django_admin_mcp/mcptoken/ and then point your MCP client to http://localhost:8000/mcp/ with proper Authorization headers.
Additional notes
Tips and considerations:
- Ensure you enable mcp_expose on the specific ModelAdmin classes you want to expose. You can use mcp_expose = True to expose direct tools for a model, or rely on discovery via find_models.
- Use mcp_exclude_fields to prevent sensitive fields from being exposed.
- Tokens can be scoped to users, groups, or permissions; manage access via Django admin.
- The HTTP protocol is JSON-based over POST to the /mcp/ endpoint. Use tools/list to discover available tools and tools/call to execute operations.
- If you run behind a reverse proxy, ensure proper wiring of the /mcp/ endpoint and adjust allowed hosts accordingly.
- For debugging, check Django logs and ensure the MCP server app is included in the project’s URL routing.
Related MCP Servers
mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
openapi
OpenAPI definitions, converters and LLM function calling schema composer.
notebooklm -secure
Secure NotebookLM MCP Server - Query Google NotebookLM from Claude/AI agents with 14 security hardening layers
asterisk
Asterisk Model Context Protocol (MCP) server.
elasticsearch-memory
🧠 Elasticsearch-powered MCP server with hierarchical memory categorization, intelligent auto-detection, and batch review capabilities