# Django Admin MCP

Exposes Django ModelAdmin classes to MCP agents. Enforces your existing permissions, model validation, and audit logs during automated edits.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 30
- Author: 7tg
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/7tg/django-admin-mcp
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/django-admin-mcp

## What it does

Instead of exposing raw database tables, this server routes agent operations through Django admin classes. Adding `MCPAdminMixin` to a `ModelAdmin` alongside the exposure flag generates the corresponding tools. The exposed model then supports record inspection and modification through standard JSON-RPC calls.

Every request respects standard admin permission checks. Records must pass `full_clean` and model save routines, preventing invalid states. Every record change is saved directly into the admin audit log under the user tied to the token.

The package requires only Django and Pydantic. Tokens are created directly inside the Django admin interface. A token without explicitly granted user permissions cannot read or mutate any records.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `host` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add django-admin-mcp -e host=<host> -- uvx django-admin-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from django-admin-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add django-admin-mcp --env host=<host> -- uvx django-admin-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from django-admin-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "django-admin-mcp": {
            "command": "uvx",
            "args": [
                "django-admin-mcp"
            ],
            "env": {
                "host": "<host>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from django-admin-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "django-admin-mcp": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "django-admin-mcp"
            ],
            "env": {
                "host": "<host>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from django-admin-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e host=<host> django-admin-mcp uvx django-admin-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from django-admin-mcp <command>

## When to use it
- prevent direct agent access to raw database tables
- run model validation before saving records from agents
- execute registered Django admin actions via MCP
- record automated agent changes inside the admin audit log

## Example prompts
- Show the latest articles from the database
- Run the publication action on the selected articles
- Check the change history for this record in the admin

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [OpenWork MCP Gateway](https://affpapa.org/en/nevibecode/mcp/openwork-mcp-gateway.md) — MCP server · ★ 24242
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [basebalance.cloud — x402 RPC & MCP gateway](https://affpapa.org/en/nevibecode/mcp/basebalancecloud-x402-rpc-mcp-gateway.md) — MCP server · ★ 7506

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
