django-mcp-server
by gts360·★ 332·Score 50
Django MCP Server enables AI agents to interact with Django applications through Model Context Protocol.
Overview
Django MCP Server is a Django extension that provides MCP (Model Context Protocol) capabilities to any Django application, whether using WSGI or ASGI. It allows exposing Django models as MCP tools with minimal code, enabling AI agents to query and interact with application data securely. The server supports both async and sync operations and integrates seamlessly with Django Rest Framework APIs.
Try asking AI
After installing, here are 3 things you can ask your AI assistant:
When to choose this
Choose this if you're working with Django applications and want to enable AI agents to interact with your models and APIs through MCP.
When NOT to choose this
Avoid if you need complex write operations or if you're not using Django, as this server is specifically designed for Django applications.
Tools this server exposes
9 tools extracted from the READMEBirdQueryToolQuery Bird models with location information
LocationToolQuery Location models
CityToolQuery City models
addAdd two numbers together
send_emailSend an email with specified subject and body
get_species_countGet count of a bird species by name
increment_speciesIncrement the count of a bird species
get_foo_barGet first FooBar instance
MyModelViewCreate instances of MyModel
Comparable tools
Installation
Installation
- Install the package:
pip install django-mcp-server- Add to Django settings:
INSTALLED_APPS = [
# your apps...
'mcp_server',
]- Add URL patterns:
from django.urls import path, include
urlpatterns = [
# your urls...
path("", include('mcp_server.urls')),
]- Define MCP tools in
mcp.py:
from mcp_server import ModelQueryToolset
from .models import *
class BirdQueryTool(ModelQueryToolset):
model = BirdClaude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"django_mcp": {
"command": "/path/to/interpreter/python",
"args": [
"/path/to/your/project/manage.py",
"stdio_server"
]
}
}
}Compare django-mcp-server with
Last updated · Auto-generated from public README + GitHub signals.