Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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
  1. Install the package:
pip install django-admin-mcp
  1. Add the MCP app to INSTALLED_APPS in settings.py:
# settings.py
INSTALLED_APPS = [
    'django_admin_mcp',
    # ... other apps
]
  1. 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
]
  1. Run migrations to create the token model (for authentication):
python manage.py migrate django_admin_mcp
  1. Start your Django development server:
python manage.py runserver 8000
  1. 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

Sponsor this space

Reach thousands of developers