Django

v1.0.0Coding Agentsstable

Connect Django apps to AI assistants with Model Context Protocol. Simple decorators expose models, admin functions, and custom tools to Claude and other AI assistants.

ai-assistantsdjangointegrationmcpmodel-context-protocol
Share:
16
Stars
0
Downloads
0
Weekly
0/5

What is Django?

Django is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to connect django apps to ai assistants with model context protocol. simple decorators expose models, admin functions, and custom tools to claude and other ai assistants.

Connect Django apps to AI assistants with Model Context Protocol. Simple decorators expose models, admin functions, and custom tools to Claude and other AI assistants.

This server falls under the Coding Agents and Developer Tools categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Connect Django apps to AI assistants with Model Context Prot

Use Cases

Expose Django models and admin functions to Claude with simple decorators.
Allow AI assistants to interact with custom Django tools programmatically.
hyperb1iss

Maintainer

LicenseApache-2.0
Languagepython
Versionv1.0.0
UpdatedApr 27, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx django

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Django

django-mcp is a Python library that bridges Django web applications and MCP-compatible AI assistants like Claude by using simple decorators to expose Django models, admin actions, REST framework viewsets, and custom functions as MCP tools and resources. With decorators like @mcp_tool() and @mcp_model_tool(Model), developers can register any Django function or model CRUD operation without boilerplate, and the library auto-discovers MCP components across all installed Django apps. It is ideal for Django developers who want to give AI assistants direct, controlled access to their application data and business logic.

Prerequisites

  • Python 3.9+ with an existing Django project
  • Django 4.0+ installed
  • pip or uv package manager
  • An MCP client such as Claude Desktop
  • Optional: Django REST Framework if exposing viewsets
1

Install django-mcp

Install the django-mcp package into your Django project environment using pip or uv.

pip install django-mcp
# or with uv
uv add django-mcp
2

Add to INSTALLED_APPS

Add 'django_mcp' to the INSTALLED_APPS list in your Django settings.py file to enable the library.

# settings.py
INSTALLED_APPS = [
    ...
    'django_mcp',
]
3

Update ASGI configuration

Update your project's asgi.py to use the django-mcp ASGI application wrapper.

# asgi.py
from django_mcp.asgi import get_asgi_application
application = get_asgi_application()
4

Include MCP URLs

Add the django-mcp URL patterns to your project's urls.py. This enables the MCP endpoint and optional dashboard.

# urls.py
from django.urls import path, include
urlpatterns = [
    ...
    path('', include('django_mcp.urls')),
]
5

Expose tools and models with decorators

Create mcp_tools.py files in your Django apps and use the provided decorators to expose functions and models as MCP tools.

# myapp/mcp_tools.py
from django_mcp import mcp_tool, mcp_model_tool
from .models import Product

@mcp_tool()
def search_products(context, query: str) -> list:
    """Search for products by name"""
    return list(Product.objects.filter(name__icontains=query).values())

@mcp_model_tool(Product)
def product_crud(context):
    pass
6

Configure Claude Desktop

Add a Django MCP server entry to your Claude Desktop config. The server runs as part of your Django application via ASGI or a management command.

{
  "mcpServers": {
    "django": {
      "command": "python",
      "args": ["manage.py", "run_mcp_server"],
      "cwd": "/path/to/your/django/project"
    }
  }
}

Django Examples

Client configuration

Claude Desktop configuration to launch the django-mcp server via Django's management command interface.

{
  "mcpServers": {
    "django": {
      "command": "python",
      "args": ["manage.py", "run_mcp_server"],
      "cwd": "/path/to/your/django/project"
    }
  }
}

Prompts to try

Example prompts for interacting with Django models and custom tools through the MCP server.

- "Search for products matching 'widget' in the database"
- "List the last 10 orders placed in the system"
- "Create a new customer record with name 'Acme Corp' and email '[email protected]'"
- "What MCP tools are registered in the Django app?"

Troubleshooting Django

MCP tools not discovered automatically across apps

Ensure each Django app containing MCP tools has a mcp_tools.py file and that the app is listed in INSTALLED_APPS. django-mcp auto-discovers components only from installed apps.

ASGI connection errors when the AI client tries to connect

Verify that asgi.py imports from django_mcp.asgi and that the django_mcp URLs are included in urls.py. Check that the Django app is running with an ASGI server like uvicorn, not the development WSGI server.

Frequently Asked Questions about Django

What is Django?

Django is a Model Context Protocol (MCP) server that connect django apps to ai assistants with model context protocol. simple decorators expose models, admin functions, and custom tools to claude and other ai assistants. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Django?

Follow the installation instructions on the Django GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Django?

Django works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Django free to use?

Yes, Django is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "django": { "command": "npx", "args": ["-y", "django"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Django?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides