GD

gts360/django-mcp-server

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

383 stars 59 forks 品質 70 トレンド 19MIT

Django MCP Serverは、Model Context Protocolを通じてAIエージェントがDjangoアプリと簡単にやり取りできるようにするためのDjango拡張であり、WSGIとASGIの両方で同様に動作します

概要

はDjangoの拡張の実装です。このモジュールはシームレスに相互作用を可能にします。 🚀 Djangoスタイルの宣言型ツールで、AIエージェントやMCPクライアントツールがDjangoとやり取りできるようにします。🚀 Djangoモデルを公開し、AIエージェントとMCPツールを安全に2行のコードでクエリできます。🚀 Django Rest Framework APIを1つの注釈でMCPツールに変換できます。✅インフラ変更なしでWSGIとASGIの両方に対応可能です。✅ Claude AIとのリモート統合として検証済みです。🤖 MCPをサポートする任意のMCPクライアントまたはAIエージェント(Google Agent Developement Kit、Claude AI、Claude Desktopなど)があなたのアプリケーションとやり取りできます。 すべての寄稿者の皆様に心から感謝🙏します Smart GTSソフトウェアエンジニアリングによって丁寧にメンテナンスされています✨。 - Djangoのモデルとロジックを公開する。- Djangoアプリ内にMCPエンドポイントを提供する。- AIエージェント、MCPクライアント、Google ADKのようなツールと簡単に統合できる。

概要(AI 翻訳)

Django MCP Serverは、Django向けのModel Context Protocol(MCP)拡張の実装です。このモジュールは、MCPクライアントおよびAIエージェントが任意のDjangoアプリケーションとシームレスにやり取りできるようにします。

🚀 Djangoスタイルの宣言型ツールで、AIエージェントやMCPクライアントツールがDjangoとやり取りできるようにします。 🚀 DjangoモデルをAIエージェントとMCPツール向けに公開し、安全な方法で2行のコードでクエリを行ってください。 🚀 Django Rest Framework APIを1つの注釈でMCPツールに変換できます。 ✅ インフラ変更なしでWSGIとASGIの両方に取り組んでいます。 ✅ Claude AIとのリモート統合として検証済み。 🤖 MCPをサポートする任意のMCPクライアントやAIエージェント(Google Agent Developement Kit、Claude AI、Claude Desktopなど)はあなたのアプリケーションとやり取りできます。

すべての寄稿者の皆様に心から感謝🙏します

Smart GTSソフトウェアエンジニアリングによって丁寧にメンテナンスされています✨。

MITライセンスの下でライセンスされています。


特徴

  • DjangoモデルとロジックをMCPツールとして公開すること。
  • Djangoアプリ内でMCPエンドポイントを提供。
  • AIエージェント、MCPクライアント、Google ADKなどのツールと容易に統合できる。

クイックスタート

1️インストール

またはGitHubから直接アクセスすることもできます。


2️¶ ジャンゴの設定

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

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)

GitHub で README 全文を見る

インストール

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" ] } }