django-mcp
by hyperb1iss·★ 16·Score 36
A Python package that bridges Django apps with AI assistants using MCP through decorators.
Overview
Django-MCP is a Model Context Protocol implementation designed to expose Django applications' functionality to AI assistants like Claude. It provides a decorator-based API for exposing models, admin functions, and custom tools. The project features seamless Django integration with automatic discovery of MCP components, built-in ASGI server support, and compatibility with Django REST Framework. It follows Django's configuration patterns and emphasizes security with permission controls.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose Django-MCP if you're building a Django application and want to enable AI assistants to interact with your models, admin functions, and custom tools without complex integrations.
When NOT to choose this
Avoid Django-MCP if you need write access to your database (currently read-only), have non-Django applications, or require a production-ready solution (this is still in alpha status).
Tools this server exposes
4 tools extracted from the READMEsearch_productssearch_products(context: Context, query: str) -> listSearch for products by name and return product details
product_toolsproduct_tools()Exposes CRUD operations for Product model
product_resourceproduct_resource()Exposes Product instances as resources
get_categoryget_category(slug: str) -> strGet information about a product category including its products
Comparable tools
Installation
Installation
# Install with pip
pip install django-mcp
# Or with UV
uv add django-mcpConfiguration
- Add to INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# ... your other apps ...
'django_mcp',
]- Update ASGI configuration:
# asgi.py
from django_mcp.asgi import get_asgi_application
application = get_asgi_application()- Include MCP URLs:
# urls.py
from django.urls import path, include
urlpatterns = [
# ... your other URLs ...
path('', include('django_mcp.urls')),
]Claude Desktop Configuration
Add to Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"django-mcp": {
"command": "python",
"args": ["-m", "django_mcp.server"],
"env": {
"DJANGO_SETTINGS_MODULE": "your_project.settings"
}
}
}
}FAQ
- What MCP features does Django-MCP support?
- Django-MCP supports tools (functions), resources (data objects), and prompts. It can expose Django models, admin functions, DRF viewsets, and custom tools through a decorator-based API.
- How does Django-MCP handle security?
- Django-MCP follows Django's security patterns with permission controls. It allows configuration of allowed origins for SSE endpoints and inherits Django's authentication system for protected resources.
Compare django-mcp with
Last updated · Auto-generated from public README + GitHub signals.