django-admin-mcp
This server exposes Django admin models (MCP Token, Author, Article) as MCP tools for permissioned data management and admin workflows.
Discover available models with
find_models.List, get, create, update, and delete
mcptoken,author, andarticlerecords with filters, search, ordering, and pagination.Run bulk create/update/delete operations for each model.
Describe model fields, relationships, and admin configuration.
List and execute registered admin actions on selected records, including confirmation flows.
Traverse related objects through foreign keys, M2M, and reverse relations.
Read per-record Django admin change history.
Get autocomplete suggestions for FK/M2M fields.
Manage MCP tokens, including linked user, permissions, groups, active status, expiry, and timestamps.
Operations respect Django admin permissions, validation, and audit logging.
Provides tools to interact with Django admin models via MCP, enabling CRUD operations, admin actions, model history, and more on Django models exposed through the admin interface.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@django-admin-mcp list the latest articles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
django-admin-mcp
Add a mixin to your ModelAdmin and MCP clients get CRUD, admin actions and relationship traversal, inside Django's existing permissions. Only Django and Pydantic as dependencies.

One mixin, the request's path through the admin, a token, a conversation with the agent, then getting started. 50 seconds · 1080p · 60 fps · original soundtrack. Watch the film.
Why not just give the agent database access?
A database connection hands the agent raw tables. The Django admin is where your project already encodes who may touch what, how records are validated, and what the sanctioned bulk operations are. This package puts the agent behind that layer instead of around it:
Permissions — every call goes through
ModelAdmin.has_*_permission(). A token can only do what its linked user can do, and starts with no access until you grant it.Validation — writes run
full_clean()and yoursave_model()/save_related()hooks, so the agent cannot save a record the admin form would reject.Audit history — every create, update, delete and action is written to Django's
LogEntryunder the token's user. You can see what the agent changed, and the agent can read the history too.Admin actions — "publish", "refund", "export CSV" and your other registered actions become tools, including two-step confirmation flows. The agent uses the operations you designed rather than inventing SQL.
Scoped exposure —
mcp_fields/mcp_exclude_fieldskeep password hashes and secrets out of the agent's view;get_queryset()still limits which rows it can see.
Related MCP server: drf-mcp-docs
How it compares
A generic Django MCP server or a hand-rolled FastMCP wrapper asks you to define tools, schemas and permission checks yourself, one function at a time. This package reads the ModelAdmin classes you already maintain and generates the tools from them, so field choices, querysets, validation, actions and permissions stay in one place and the agent inherits every change you make to the admin. It also ships as a plain Django app with no MCP SDK or extra HTTP stack.
Installation
pip install django-admin-mcp# settings.py
INSTALLED_APPS = [
'django_admin_mcp',
# ...
]
# urls.py
urlpatterns = [
path('mcp/', include('django_admin_mcp.urls')),
# ...
]python manage.py migrate django_admin_mcpQuick start
1. Expose a model. Set mcp_expose = True to generate tools for it. Models with the mixin but without the flag are discoverable through find_models only.
from django.contrib import admin
from django_admin_mcp import MCPAdminMixin
from .models import Article, Author
@admin.register(Article)
class ArticleAdmin(MCPAdminMixin, admin.ModelAdmin):
mcp_expose = True # list_article, get_article, create_article, ...
mcp_exclude_fields = ['internal_notes']
list_display = ['title', 'author', 'published']
@admin.register(Author)
class AuthorAdmin(MCPAdminMixin, admin.ModelAdmin):
pass # discoverable, no direct tools2. Create a token in the admin at /admin/django_admin_mcp/mcptoken/. Grant it exactly the permissions and groups the agent needs. The linked user caps what the token can do and is the identity its changes are logged under.
3. Point your MCP client at it, for example in a .mcp.json for Claude Code:
{
"mcpServers": {
"django-admin": {
"type": "http",
"url": "http://localhost:8000/mcp/",
"headers": { "Authorization": "Bearer YOUR_TOKEN" }
}
}
}4. Ask the agent.
User: Show me the latest 10 articles
Agent: [calls list_article with limit=10]
User: Mark articles 1, 2 and 3 as published
Agent: [calls action_article with action="mark_as_published", ids=[1, 2, 3]]
User: What changed on article 42?
Agent: [calls history_article with id=42]Tools
For each exposed model (here Article) the server generates:
Tool | Does |
| Read with pagination and filtering (needs view) |
| Write single records (needs add / change / delete) |
| Create, update or delete many records at once |
| List and run registered admin actions, including file-returning exports |
| Field definitions, types and constraints |
| Follow foreign keys and reverse relations |
| Django admin change history |
| Search suggestions for foreign-key fields |
Plus find_models to discover everything exposed, MCP prompts for common workflows, and read-only resources at models:// and data:// URIs. The endpoint speaks JSON-RPC 2.0 over HTTP with GET /mcp/health/ for health checks. Full reference in the docs.
Security in brief
Tokens look like
mcp_<key>.<secret>; only a salted hash of the secret is stored.Each token carries its own permissions and groups, intersected with its user's permissions. Deactivating the user disables its tokens.
Expiry is configurable; revoke a token by deactivating or deleting it in the admin.
Sensitive values are redacted from log messages, and large action downloads are capped by
MCP_ACTION_MAX_FILE_BYTES(default 5 MiB).
See Permissions and Token Management for details.
Requirements
Python 3.10 to 3.14, Django 3.2 to 6.0, Pydantic 2. Tested against every Django release in that range.
Support the project
If this saved you time, a star on GitHub helps others find it. Issues and PRs are welcome; see the contributing guide.
License
MIT
Available Tools
37 toolsaction_articleA
Execute an admin action on selected Article instances. Use actions_article to discover available actions.
Inputs: ids (required), action (required), confirm, confirmation_data.
action_authorA
Execute an admin action on selected Author instances. Use actions_author to discover available actions.
Inputs: ids (required), action (required), confirm, confirmation_data.
action_mcptokenA
Execute an admin action on selected MCP Token instances. Use actions_mcptoken to discover available actions.
Inputs: ids (required), action (required), confirm, confirmation_data.
actions_articleA
List available admin actions for Article. Returns action names and descriptions that can be executed via action_article.
Inputs: no named parameters.
actions_authorA
List available admin actions for Author. Returns action names and descriptions that can be executed via action_author.
Inputs: no named parameters.
actions_mcptokenA
List available admin actions for MCP Token. Returns action names and descriptions that can be executed via action_mcptoken.
Inputs: no named parameters.
autocomplete_articleB
Search Article instances for autocomplete suggestions. Useful for populating FK/M2M field widgets.
Inputs: term, limit.
autocomplete_authorA
Search Author instances for autocomplete suggestions. Useful for populating FK/M2M field widgets.
Inputs: term, limit.
autocomplete_mcptokenA
Search MCP Token instances for autocomplete suggestions. Useful for populating FK/M2M field widgets.
Inputs: term, limit.
bulk_articleB
Perform bulk operations on Article: create, update, or delete multiple items.
For 'create': items is a list of data objects For 'update': items is a list of {id, data} objects For 'delete': items is a list of IDs
Inputs: items (required), operation (required).
bulk_authorA
Perform bulk operations on Author: create, update, or delete multiple items.
For 'create': items is a list of data objects For 'update': items is a list of {id, data} objects For 'delete': items is a list of IDs
Inputs: items (required), operation (required).
bulk_mcptokenA
Perform bulk operations on MCP Token: create, update, or delete multiple items.
For 'create': items is a list of data objects For 'update': items is a list of {id, data} objects For 'delete': items is a list of IDs
Inputs: items (required), operation (required).
create_articleA
Create a new Article, optionally with inline rows.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
id (BigAutoField)
title (CharField) [required]
content (TextField) [required]
author (ForeignKey) [required]
published_date (DateTimeField)
is_published (BooleanField)
created_at (DateTimeField)
updated_at (DateTimeField)
Inputs: data (required), inlines.
create_authorA
Create a new Author, optionally with inline rows.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
articles (ForeignKey)
id (BigAutoField)
name (CharField) [required]
email (CharField) [required]
bio (TextField)
created_at (DateTimeField)
Inputs: data (required), inlines.
create_mcptokenA
Create a new MCP Token, optionally with inline rows.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
id (BigAutoField)
name (CharField) [required]
user (ForeignKey) [required]
is_active (BooleanField)
created_at (DateTimeField)
expires_at (DateTimeField)
last_used_at (DateTimeField)
groups (ManyToManyField)
permissions (ManyToManyField)
Inputs: data (required), inlines.
delete_articleC
Delete a Article by ID
Inputs: id (required).
delete_authorC
Delete a Author by ID
Inputs: id (required).
delete_mcptokenC
Delete a MCP Token by ID
Inputs: id (required).
describe_articleA
Get detailed metadata about the Article model including field definitions, relationships, and admin configuration.
Inputs: no named parameters.
describe_authorA
Get detailed metadata about the Author model including field definitions, relationships, and admin configuration.
Inputs: no named parameters.
describe_mcptokenA
Get detailed metadata about the MCP Token model including field definitions, relationships, and admin configuration.
Inputs: no named parameters.
find_modelsA
Discover available Django models registered with MCP. Use this to find which models have tools available.
Inputs: query.
get_articleB
Get a specific Article by ID with optional inline and related data.
Inputs: id (required), include_inlines, include_related.
get_authorB
Get a specific Author by ID with optional inline and related data.
Inputs: id (required), include_inlines, include_related.
get_mcptokenB
Get a specific MCP Token by ID with optional inline and related data.
Inputs: id (required), include_inlines, include_related.
history_articleA
Get the change history (LogEntry records) for a Article instance. Shows who made what changes and when.
Inputs: id (required), limit.
history_authorB
Get the change history (LogEntry records) for a Author instance. Shows who made what changes and when.
Inputs: id (required), limit.
history_mcptokenA
Get the change history (LogEntry records) for a MCP Token instance. Shows who made what changes and when.
Inputs: id (required), limit.
list_articleA
List Article instances with filtering, searching, ordering, and pagination.
Filter lookups: field (exact), field__iexact, field__contains, field__icontains, field__startswith, field__istartswith, field__endswith, field__iendswith, field__gt, field__gte, field__lt, field__lte, field__in, field__range, field__isnull; date fields also take field__year, field__month, field__day (and field__date on datetimes), optionally followed by a comparison (field__year__gte). Relation paths (e.g. category__slug) and custom filter parameters work only when the admin declares them in list_filter / date_hierarchy: describe_article lists them under admin_config.filters. Invalid filters return an error.
Available fields:
id (BigAutoField)
title (CharField) [required]
content (TextField) [required]
author (ForeignKey) [required]
published_date (DateTimeField)
is_published (BooleanField)
created_at (DateTimeField)
updated_at (DateTimeField)
Inputs: limit, offset, search, filters, +1 more.
list_authorA
List Author instances with filtering, searching, ordering, and pagination.
Filter lookups: field (exact), field__iexact, field__contains, field__icontains, field__startswith, field__istartswith, field__endswith, field__iendswith, field__gt, field__gte, field__lt, field__lte, field__in, field__range, field__isnull; date fields also take field__year, field__month, field__day (and field__date on datetimes), optionally followed by a comparison (field__year__gte). Relation paths (e.g. category__slug) and custom filter parameters work only when the admin declares them in list_filter / date_hierarchy: describe_author lists them under admin_config.filters. Invalid filters return an error.
Available fields:
articles (ForeignKey)
id (BigAutoField)
name (CharField) [required]
email (CharField) [required]
bio (TextField)
created_at (DateTimeField)
Inputs: limit, offset, search, filters, +1 more.
list_mcptokenA
List MCP Token instances with filtering, searching, ordering, and pagination.
Filter lookups: field (exact), field__iexact, field__contains, field__icontains, field__startswith, field__istartswith, field__endswith, field__iendswith, field__gt, field__gte, field__lt, field__lte, field__in, field__range, field__isnull; date fields also take field__year, field__month, field__day (and field__date on datetimes), optionally followed by a comparison (field__year__gte). Relation paths (e.g. category__slug) and custom filter parameters work only when the admin declares them in list_filter / date_hierarchy: describe_mcptoken lists them under admin_config.filters. Invalid filters return an error.
Available fields:
id (BigAutoField)
name (CharField) [required]
user (ForeignKey) [required]
is_active (BooleanField)
created_at (DateTimeField)
expires_at (DateTimeField)
last_used_at (DateTimeField)
groups (ManyToManyField)
permissions (ManyToManyField)
Inputs: limit, offset, search, filters, +1 more.
update_articleA
Update an existing Article with optional inline updates. Only the fields sent are changed.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
id (BigAutoField)
title (CharField) [required]
content (TextField) [required]
author (ForeignKey) [required]
published_date (DateTimeField)
is_published (BooleanField)
created_at (DateTimeField)
updated_at (DateTimeField)
Inputs: id (required), data, inlines.
update_authorA
Update an existing Author with optional inline updates. Only the fields sent are changed.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
articles (ForeignKey)
id (BigAutoField)
name (CharField) [required]
email (CharField) [required]
bio (TextField)
created_at (DateTimeField)
Inputs: id (required), data, inlines.
update_mcptokenA
Update an existing MCP Token with optional inline updates. Only the fields sent are changed.
Date and datetime fields take a single ISO 8601 string (e.g. '2026-03-01' or '2026-03-01T09:30:00Z'). Foreign keys take the related object's ID, many-to-many fields a list of IDs. A field the admin form does not accept (unknown, read-only or non-editable) is rejected with an error, never ignored.
Fields:
id (BigAutoField)
name (CharField) [required]
user (ForeignKey) [required]
is_active (BooleanField)
created_at (DateTimeField)
expires_at (DateTimeField)
last_used_at (DateTimeField)
groups (ManyToManyField)
permissions (ManyToManyField)
Inputs: id (required), data, inlines.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 37 tools
Tools are namespaced by model (mcptoken vs author vs article), so cross-model confusion is minimal. However, within a model there is mild overlap: list_X vs autocomplete_X both search, and bulk_X competes with the individual create/update/delete tools. Descriptions do help disambiguate these, keeping it above mediocre.
The convention is highly predictable: verb_model (list_author, get_article, create_mcptoken, bulk_author, related_article), giving a consistent verb_noun pattern. The only deviation is the generic find_models discovery tool, and the subtle actions_X/action_X pairing, which are minor blemishes.
37 tools is heavy, exceeding the 25+ threshold flagged as excessive. The count is systematic (12 near-identical tools per each of three models plus find_models), so it is defensible for a generic multi-model admin surface, but it is still unwieldy for an agent to navigate.
Each model gets a full lifecycle: list, get, create, update, delete, describe, actions/action, bulk, related, history, and autocomplete. With find_models for discovery and no obvious missing operation, the surface is exhaustive for Django admin management.
Maintenance
Related MCP Connectors
Your DRF API as MCP tools — 1,800 endpoints become 16 dispatchers, permissioned by Django.
Query, browse, and automate OmegaAI workspaces from any MCP client. Streamable HTTP with OAuth 2.0.
One MCP URL for all your connectors — scoped writes, enforced constraints, and a full audit trail.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceExposes Django admin's ModelAdmin as MCP tools, with identical permissions, form validation, and session authentication.175 PyPI5MIT
- AlicenseNot gradedqualityDmaintenanceExposes Django REST Framework API documentation via MCP for AI coding agents to read, understand, and write frontend integration code.15MIT
- AlicenseNot gradedqualityDmaintenanceTurns Django models into MCP tools and a REST API from a single class, and can generate a Django project from a MySQL or Postgres schema.2MIT
- AlicenseNot gradedqualityDmaintenanceExposes Django REST Framework APIs as MCP tools for AI agents via the Model Context Protocol, with automatic discovery and security.1MIT