Drf
БесплатноНе проверенExposes Django REST Framework APIs as MCP tools for AI agents via the Model Context Protocol, with automatic discovery and security.
Описание
Exposes Django REST Framework APIs as MCP tools for AI agents via the Model Context Protocol, with automatic discovery and security.
README
PyPI version Python 3.10+ Django 4.2+ License: MIT
Enterprise-grade Model Context Protocol (MCP) integration for Django REST Framework with FastMCP 3.0
Automatically expose your Django REST Framework APIs as tools for AI agents via the Model Context Protocol. Zero configuration, maximum security, enterprise-ready.
Overview
DRF MCP transforms your Django REST Framework views into AI-native tools via the Model Context Protocol standard. Built on FastMCP 3.0, it automatically:
- 🔍 Discovers all DRF views and ViewSets in your Django URLconf
- 🔧 Exposes them as MCP tools with auto-generated JSON schemas
- 🔐 Secures with DRF's permission system (no security bypass)
- ⚡ Async-first execution for non-blocking LLM interactions
- 📊 Traces with OpenTelemetry for observability
- 🚀 Scales with stateless, transport-agnostic architecture
Quick Start
# In your Django project
from drf_mcp import DRFMCP
from myapp.views import CustomerViewSet
# Initialize MCP server
mcp = DRFMCP("MyEnterpriseAPI")
# Option 1: Register specific ViewSets
mcp.register_viewset(CustomerViewSet, namespace="crm")
# Option 2: Auto-discover all DRF views
mcp.autodiscover()
# Run server (stdio, HTTP, or SSE transport)
if __name__ == "__main__":
mcp.run()
Your DRF serializers automatically become MCP tool parameters. No extra configuration needed.
Architecture
Discovery
Scans Django's URLconf to find all DRF APIView and ViewSet classes.
Schema Generation
Uses drf-spectacular to convert DRF serializers into JSON schemas for MCP tool arguments.
Execution
Wraps DRF view invocations with async support, permission checking, and error handling.
Security
Enforces DRF's authentication and permission classes on every tool call. Agents are authenticated users.
Transport
Supports stdio, HTTP, and SSE via FastMCP's built-in transports.
Features
- ✅ Automatic DRF view discovery and MCP tool generation
- ✅ drf-spectacular schema integration (nested serializers, complex validators)
- ✅ DRF permission system integration (no security bypass)
- ✅ Async-first executor (non-blocking LLM execution)
- ✅ OAuth2/OIDC agent authentication
- ✅ OpenTelemetry tracing for observability
- ✅ Interactive
manage.py mcp_inspectorCLI - ✅ Type hints and Pydantic v2 schemas
- ✅ Django 4.2 LTS and 5.0+ support
- ✅ Python 3.10+ support
Installation
uv add drf-mcp
Or with pip:
pip install drf-mcp
Documentation
Full documentation is available at drf-mcp.readthedocs.io
Requirements
- Python: 3.10+
- Django: 4.2+ (LTS) or 5.0+
- Django REST Framework: 3.14+
- FastMCP: 3.0+
Development
# Clone and setup
git clone https://github.com/ziyacivan/drf-mcp.git
cd drf-mcp
uv venv
uv pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/drf_mcp tests
isort src/drf_mcp tests
# Type checking
mypy src/drf_mcp
License
MIT License - See LICENSE file for details.
Contributing
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
Acknowledgments
- FastMCP - High-level MCP framework
- drf-spectacular - OpenAPI schema generation
- Django REST Framework - Best-in-class Python API framework
- gts360/django-mcp-server - Original reference implementation
Установить Drf в Claude Desktop, Claude Code, Cursor
unyly install drf-mcpСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add drf-mcp -- uvx drf-mcpFAQ
Drf MCP бесплатный?
Да, Drf MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Drf?
Нет, Drf работает без API-ключей и переменных окружения.
Drf — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Drf в Claude Desktop, Claude Code или Cursor?
Открой Drf на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Drf with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
