GD

gts360/django-mcp-server

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

383 stars 59 forks Качество 70 Тренд 19MIT

Django MCP Server — это расширение Django, которое позволяет агентам искусственного интеллекта легко взаимодействовать с приложениями Django через протокол контекста модели; он одинаково хорошо работает на WSGI и ASGI

Обзор

является реализацией расширения для Django. Этот модуль позволяет и взаимодействовать с ним бесшовно. 🚀 Инструменты декларативного стиля Django, позволяющие агентам ИИ и клиентам MCP взаимодействовать с Django. 🚀 Предоставить модели Django для AI Agents и MCP Tools для безопасного запроса в 2 строках кода. 🚀 Конвертировать API Django Rest Framework в MCP-инструменты с помощью одной аннотации. ✅ Работа с WSGI и ASGI без изменения инфраструктуры. ✅ Валидировано как удалённая интеграция с Claude AI. 🤖 Любой MCP-клиент или AI-агент, поддерживающий MCP (Google Agent Developement Kit, Claude AI, Claude Desktop и др.), может взаимодействовать с вашим приложением. Большое спасибо 🙏 всем участникам Поддерживается ✨ с заботой благодаря Smart GTS Software Engineering. - Отображать модели и логику Django как . - Обслуживать MCP-конечную точку внутри вашего приложения Django. - Легко интегрировать с AI-агентами, MCP-клиентами или инструментами, такими как Google ADK.

Обзор (машинный перевод)

Django MCP Server — это реализация расширения Model Context Protocol (MCP)* для Django. Этот модуль позволяет MCP Clients и AI-агентам бесшовно взаимодействовать с любым приложением Django.

🚀 Декларативные инструменты в стиле Django, позволяющие агентам ИИ и клиентам MCP взаимодействовать с Django.
🚀 Используйте модели Django для AI Agents и MCP Tools для безопасного запроса в 2 строках кода.
🚀 Преобразовать API Django Rest Framework в MCP-инструменты с помощью одной аннотации.
✅ Работая как на WSGI, так и над ASGI без изменений в инфраструктуре.
✅ Проверено как удалённая интеграция с Claude AI.
🤖 Любой клиент MCP или AI-агент, поддерживающий MCP (Google Agent Developement Kit, Claude AI, Claude Desktop …), может взаимодействовать с вашим приложением.

Большое спасибо 🙏 всем участникам

Поддерживается ✨ с заботой благодаря Smart GTS Software Engineering.

Лицензирован под MIT-лицензией.


Особенности

  • Экспонировать модели и логику Django в виде MCP-инструментов.
  • Подайте MCP-конечную точку внутри вашего приложения Django.
  • Лёгкая интеграция с AI-агентами, MCP-клиентами или инструментами, такими как Google ADK.

Быстрый старт

1️⃣ Установить

Или напрямую с GitHub:


2️⃣ Configure Django

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

Django MCP Server

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.


Features

  • Expose Django models and logic as MCP tools.
  • Serve an MCP endpoint inside your Django app.
  • Easily integrate with AI agents, MCP Clients, or tools like Google ADK.

Quick Start

1️⃣ Install

pip install django-mcp-server

Or directly from GitHub:

pip install git+https://github.com/omarbenhamid/django-mcp-server.git

2️⃣ Configure Django

✅ 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.


3️⃣ Define MCP Tools

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)

Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "test_django_mcp": { "command": "/path/to/interpreter/python", "args": [ "/path/to/your/project/manage.py", "stdio_server" ] } }