Django DRF MCP Server
Provides tools to interact with Django REST Framework API endpoints, enabling CRUD operations on models defined in the Django project.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Django DRF MCP Servershow me all users in the system"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Django REST Framework + MCP Integration
A simple Django REST Framework application with integrated Model Context Protocol (MCP) server.
Overview
This project demonstrates the simplest way to add MCP (Model Context Protocol) support to any Django REST Framework project. Just copy one file (mcp_view.py) and add one URL pattern - that's it!
Related MCP server: mcp-db-server
Features
Django REST Framework API - Complete CRUD operations for User management
Simple MCP Integration - Single file MCP view with auto-discovery
Zero Dependencies - Only uses Django, DRF, and Python standard library
Auto-discovery - Automatically finds DRF ViewSets and creates MCP tools
Quick Start
1. Install Dependencies
pip install -r requirements.txt2. Setup Database
python manage.py migrate3. Start the Server
python manage.py runserverThe server provides:
REST API:
http://localhost:8000/api/users/MCP Endpoint:
http://localhost:8000/mcp/Admin:
http://localhost:8000/admin/
Adding MCP to Your Django Project
Want to add MCP support to your existing Django DRF project? It's incredibly simple:
1. Copy the MCP View
Copy django_mcp_project/mcp_view.py to your Django project.
2. Add URL Pattern
In your urls.py:
from your_project.mcp_view import MCPView
urlpatterns = [
# your existing patterns...
path("mcp/", MCPView.as_view(), name="mcp"),
]3. That's it!
Your Django project now has MCP support. The view automatically discovers all your DRF ViewSets and creates MCP tools for them.
Testing MCP Integration
Test that your MCP endpoint is working:
curl -X POST http://127.0.0.1:8000/mcp/ \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}'API Endpoints
User Management
GET/POST /api/users/- List all users / Create new userGET/PUT/PATCH/DELETE /api/users/{id}/- User detail operationsPOST /api/users/{id}/activate/- Activate userPOST /api/users/{id}/deactivate/- Deactivate user
MCP Integration
POST /mcp/- MCP JSON-RPC endpoint with auto-discovered tools
Project Structure
django-drf-mcp/
├── django_mcp_project/
│ ├── mcp_view.py # 🌟 The magic file - copy this to any DRF project
│ ├── settings.py # Django settings
│ ├── urls.py # URL configuration with MCP endpoint
│ └── wsgi.py # WSGI configuration
├── users/ # Example Django app with User model
│ ├── models.py # Extended User model
│ ├── serializers.py # DRF serializers
│ ├── views.py # DRF ViewSets
│ └── urls.py # User API endpoints
├── manage.py # Django management script
├── requirements.txt # Dependencies
└── .vscode/ # VS Code MCP client configurationHow It Works
The MCPView class in mcp_view.py:
Auto-discovers all Django apps and their ViewSets
Creates MCP tools for each CRUD operation (list, create, retrieve, update, destroy)
Provides JSON-RPC interface compatible with MCP clients
Requires zero configuration - just works out of the box
VS Code Integration
Add to your .vscode/mcp.json:
{
"servers": {
"django-mcp": {
"type": "http",
"url": "http://127.0.0.1:8000/mcp/"
}
}
}License
MIT License - feel free to use this in your projects!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityFmaintenanceAn implementation of the Model Context Protocol for Django that enables AI agents to interact with applications by exposing models, logic, and REST Framework APIs as tools.Last updated365MIT
- Flicense-qualityDmaintenanceEnables querying PostgreSQL and MySQL databases using natural language, with RESTful endpoints for listing tables, describing schemas, and executing read-only queries.Last updated1
- Alicense-qualityDmaintenanceExposes Django REST Framework APIs as MCP tools, enabling natural language interactions with your data models such as CRUD operations and custom actions, with automatic schema generation from DRF serializers.Last updated52BSD 3-Clause
- Alicense-qualityCmaintenanceExposes Django REST Framework API documentation via MCP for AI coding agents to read, understand, and write frontend integration code.Last updated16MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
Universal AI API Orchestrator — 1,554 tools, 96 services. One install.
Create and manage AI agents that collaborate and solve problems through natural language interacti…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Joel-hanson/django-drf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server