Django MCP Server is a Django extensions to easily enable AI Agents to interact with Django Apps through the Model Context Protocol it works equally well on WSGI and ASGI
{
"mcpServers": {
"django-mcp-server": {
"args": [
"-y",
"mymcp"
],
"command": "npx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Django MCP Server is an implementation of the Model Context Protocol (MCP) extension for Django. This module allows MCP Clients and AI agents to interact with any Django application seamlessly.
Is it safe?
No known CVEs for mymcp.
No authentication — any process on your machine can connect.
MIT. View license →
Is it maintained?
Last commit 29 days ago. 308 stars.
Will it work with my client?
Transport: stdio, sse, http. Works with Claude Desktop, Cursor, Claude Code, and most MCP clients.
Context cost
6 tools. ~500 tokens (0.3% of 200K).
Run this in your terminal to verify the server starts. Then let us know if it worked — your result helps other developers.
npx -y 'mymcp' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
ModelQueryToolsetExpose Django models as MCP tools for querying with optional filtering
MCPToolsetGeneric toolset to publish custom methods as MCP tools
drf_publish_create_mcp_toolConvert Django Rest Framework CreateAPIView to MCP tool
drf_publish_update_mcp_toolConvert Django Rest Framework UpdateAPIView to MCP tool
drf_publish_delete_mcp_toolConvert Django Rest Framework DestroyAPIView to MCP tool
drf_publish_list_mcp_toolConvert Django Rest Framework ListAPIView to MCP tool
mcp_endpointMCP server endpoint for client connections
/mcp
No known vulnerabilities.
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Dynamic problem-solving through sequential thought chains
A Model Context Protocol server for searching and analyzing arXiv papers
An open-source AI agent that brings the power of Gemini directly into your terminal.
The official Python SDK for Model Context Protocol servers and clients
MCP Security Weekly
Get CVE alerts and security updates for Django Mcp Server and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Django MCP Server is an implementation of the Model Context Protocol (MCP) extension for Django. This module allows MCP Clients and AI agents to interact with any Django application seamlessly.
🚀 Django-Style declarative style tools to allow AI Agents and MCP clients tool to interact with Django.
🚀 Expose Django models for AI Agents and MCP Tools to query in 2 lines of code in a safe way.
🚀 Convert Django Rest Framework APIs to MCP tools with one annotation.
✅ Working on both WSGI and ASGI without infrastructure change.
✅ Validated as a Remote Integration with Claude AI.
🤖 Any MCP Client or AI Agent supporting MCP , (Google Agent Developement Kit, Claude AI, Claude Desktop ...) can interact with your application.
Many thanks 🙏 to all the contributor community
Maintained ✨ with care by Smart GTS software engineering.
Licensed under the MIT License.
pip install django-mcp-server
Or directly from GitHub:
pip install git+https://github.com/omarbenhamid/django-mcp-server.git
✅ Add mcp_server to your INSTALLED_APPS:
INSTALLED_APPS = [
# your apps...
'mcp_server',
]
✅ Add the MCP endpoint to your urls.py:
from django.urls import path, include
urlpatterns = [
# your urls...
path("", include('mcp_server.urls')),
]
By default, the MCP endpoint will be available at /mcp.
In mcp.py create a subclass of ModelQueryToolset to give access to a model :
from mcp_server import ModelQueryToolset
from .models import *
class BirdQueryTool(ModelQueryToolset):
model = Bird
def get_queryset(self):
"""self.request can be used to filter the queryset"""
return super().get_queryset().filter(location__isnull=False)
class LocationTool(ModelQueryToolset):
model = Location
class CityTool(ModelQueryToolset):
model = City
Or create a sub class of MCPToolset to publish generic methods (private _ methods are not published)
Example:
from mcp_server import MCPToolset
from django.core.mail import send_mail
class MyAITools(MCPToolset):
def add(self, a: int, b: int) -> list[dict]:
"""A service to add two numbers together"""
return a+b
def send_email(self, to_email: str, subject: str, body: str):
""" A tool to send emails"""
send_mail(
subject=subject,
message=body,
from_email='your_email@example.com',
recipient_list=[to_email],
fail_silently=False,
)
Use the management commande mcp_inspect to ensure your tools are correctly declared :
python manage.py mcp_inspect
The mcp tool is now published on your Django App at /mcp endpoint.
IMPORTANT For production setup, on non-public data, consider enabling authorization through : DJANGO_MCP_AUTHENTICATION_CLASSES
Y