django-admin-mcp
Provides read-only access to Django admin data through MCP, allowing AI agents to query and search models, retrieve objects, and discover schema, all scoped to the user's permissions.
Click on "Install 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-mcplist available models"
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
Give an AI agent read-only access to your Django admin data over MCP — scoped to exactly what the signed-in staff user could already see in the admin. No new data surface, just a new protocol over the one you already trust.
agent ──stdio──▶ shim ──HTTPS(x-api-key)──▶ /admin-mcp/ views ──▶ ModelAdmin (perms + queryset) ──▶ read replicaEvery read is driven through the model's own ModelAdmin, so the agent sees precisely what that
user sees in /admin/ — same permission checks, same row scoping, same search — with secrets
redacted and cost gates on every query.
Why it's different
Permission-faithful by construction. Access is gated by
ModelAdmin.has_view_permission(model and object level), scoped byModelAdmin.get_queryset, and searched viaModelAdmin.get_search_results— the exact calls the admin UI makes. A user with view rights on three models sees three models. There is no parallel permission system to keep in sync.Zero-copy auth. No API keys to mint, paste, or rotate. The MCP shim runs a loopback browser sign-in (OAuth-style PKCE): it opens
/auth/, catches a one-time code on a127.0.0.1listener, and exchanges it for a scoped, sliding-expiry token stored per-host at0600. Expired token → the agent silently re-auths. The token authenticates to this endpoint only, so a leak can't reach any other API.Safe to point at production. Reads route to a configurable replica alias, run under a per-query statement timeout, never issue an unbounded
COUNT(*), refuse deep pagination, and are per-user rate-limited. Secret-looking fields (password,token,api_key, …, incl. keys nested in JSON columns) come back***. Whole models can be hidden by policy.Drop-in. One
include()in your URLconf, a few optional settings, zero required dependencies beyond Django. Works with any MCP client (Claude Code, Codex, …) — the shim is stdlib-only.
Related MCP server: django-admin-mcp-api
Install
pip install django-admin-mcp# settings.py
INSTALLED_APPS = [..., "admin_mcp"]
ADMIN_MCP_BASE_PATH = "/admin-mcp" # must match where you mount the urls
# urls.py
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("admin-mcp/", include("admin_mcp.urls")),
]That's the minimum. Then a staff user opens https://<your-host>/admin-mcp/auth/ and copies the
one command it shows for their agent.
Try it in 60 seconds
git clone https://github.com/paritoshv/django-admin-mcp && cd django-admin-mcp/example
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
# open http://127.0.0.1:8000/admin-mcp/auth/ → follow the one-liner it printsThe demo app ships an Author/Book model (with a redacted api_key field) and a SecretRecord
model that's hidden from MCP via ADMIN_MCP_HIDDEN_MODELS — so you can see scoping, redaction, and
model-hiding immediately.
MCP tools
Tool | Maps to | Notes |
| which models you may view | discovery entry point |
| fields, relations, | read this to know what's queryable |
| the changelist |
|
| the change view | one row by pk, object-level permission enforced |
| the loopback sign-in | usually automatic; call to sign in ahead of time |
Endpoints
Mounted under ADMIN_MCP_BASE_PATH. model is app_label.ModelName.
Path | Params | Auth | Returns |
| – | staff | models the caller may view |
|
| staff | fields, relations, search/filter/sort surface |
|
| staff | changelist rows + bounded count |
|
| staff | one object |
|
| browser session | setup page, or the loopback PKCE redirect |
|
| one-time PKCE code | exchanges a loopback code for a fresh token |
| – | staff | the stdio shim source (so setup is one |
Configuration
Everything is optional; defaults are safe.
Setting | Default | Purpose |
|
| master on/off |
| – | dotted path to |
|
| DB alias reads route to; point at a replica in prod |
|
|
|
| – | dotted path to |
|
| Django cache backing tokens/codes/throttle — use a shared Redis/Memcached in production |
| password, secret, token, api_key, … | substrings that mark a field for redaction |
|
| MCP server name on the setup page; scope per environment |
|
| where the app is mounted (advertised to the shim) |
| 25 / 100 / 1000 / 5000 | pagination + cost caps |
| 120 / 60 | per-user rate limit |
| 86400 / 604800 / 60 | token idle window, absolute lifetime, one-time-code TTL |
Production notes
Set
ADMIN_MCP_CACHE_ALIASto a shared cache (Redis/Memcached). The default LocMem cache is per-process, so tokens minted on one worker won't resolve on another.Point
ADMIN_MCP_READONLY_DBat a read replica so agent reads never touch the primary.Wire
ADMIN_MCP_ENABLED_HOOKto a feature flag if you want to kill the endpoint without a deploy.
Security model
Auth: a live admin session, or a scoped token in the
x-api-keyheader. The token is a random opaque string; only its SHA-256 is stored. Idle 24h expiry that slides on use, plus a 7-day absolute cap. It resolves to an active staff user on every call, so deactivating the account or revoking staff invalidates it immediately, TTL notwithstanding.Loopback PKCE refresh:
/auth/only ever redirects the one-time code to a validatedhttp://127.0.0.1|localhostURI — never an external host — and the code (60s, single-use) is worthless without the PKCE verifier held by the shim that started the flow.Redaction runs after honouring each admin's
exclude/fieldswhitelist — defence in depth, so even a mis-configured admin can't leak a secret column into an LLM context.Never evaluates
list_displaycallables (they can trigger N+1s or side effects); serialises concrete fields only.Audit trail: one structured record per call (who/what/outcome/timing) on the
admin_mcp.auditlogger — never the response values, so the log isn't a second data-egress path.
Tests
python runtests.pyLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceExpose Django admin models to MCP clients for CRUD, admin actions, model introspection, and more via HTTP with token authentication.Last updated11MIT
- Alicense-qualityAmaintenanceExposes Django admin's ModelAdmin as MCP tools, with identical permissions, form validation, and session authentication.Last updated4MIT
- Flicense-qualityDmaintenanceExposes Django runtime information (settings, apps, URLs, models, migrations) as MCP resources for AI agents to inspect a live Django project without static analysis.Last updated
- FlicenseAqualityBmaintenanceRead-only MySQL database access via MCP. Enables listing databases, tables, schemas, running SELECT queries, and EXPLAIN plans.Last updated6
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Read-only MCP access to sessions, funnels, campaigns, errors, live visitors, and anomalies.
Query metrics, targets, entities, and team data in your Steep workspace via MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/paritoshv/django-admin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server