
zacharypodbela/django-rest-framework-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
zacharypodbela/django-rest-framework-mcp は [https://github.com/zacharypodbela/django-rest-framework-mcp.] からインポートされた MCP サーバーの候補です
概要
zacharypodbela/django-rest-framework-mcp は [https://github.com/zacharypodbela/django-rest-framework-mcp.] からインポートされた MCP サーバーの候補です
概要(AI 翻訳)
[django-rest-framework-mcp を使用すると、Django Rest Framework API を MCP ツールとして公開する MCP サーバを数行だけ回転させることができます。
管理者ワークフローをスーパーチャージャー(管理者インターフェイスを過去のものにする)
- 「[email protected]のアカウントを無効化」 → 実際に無効化
- 「ジャック@teams.comの無料トライアルを1週間延長」 → プランの更新
- 「週単位で新規ユーザー数が加わったの?」 → 実際のデータを返す → LLM はすぐにグラフを作成できます (複雑な FE グラフライブラリは必要ありません)
または、会話のやりとりでSaaS UXを退屈させるあなたの伝統を変換します。
- 古い方法:ユーザーは「管理」をクリックし、「マイ投稿」をクリックし、リストから投稿をクリックし、「編集」をクリックし、タイトルを変更し、「保存」をクリックします。
- Django Rest Framework MCP:「Beginners Guide to Django」から「Django 101」に投稿の名前を変更できますか?
クイックスタート
-
パッケージを取付けて下さい:
-
[
INSTALLED_APPSに追加します。 -
MCP エンドポイントを [
urls.pyに追加します。
4。 DRF ViewSetを単一のデコレータでMCPツールに変換します
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Django REST Framework MCP
django-rest-framework-mcp allows you to spin up MCP servers that expose your Django Rest Framework APIs as MCP tools with just a few lines of code.
Supercharge your admin workflows (and make developing Admin interfaces a thing of the past):
- “Deactivate [email protected]’s account” → Actually deactivates it
- “Extend [email protected]’s free trial by 1 week” → Updates their plan
- “How many new users joined week-over-week?” → Returns real data → LLMs can quickly create graphs (no more complex FE graphing libraries needed)
Or transform your traditional, boring SaaS UX with conversational interactions:
- Old way: User Clicks “Manage”, Clicks “My Posts”, Clicks a post from the list, Clicks “Edit”, changes the title, Clicks “Save”
- With Django Rest Framework MCP: “Can you rename my post from ‘Beginners Guide to Django’ to ‘Django 101’?”
Quick Start
- Install the package:
pip install django-rest-framework-mcp
- Add to your
INSTALLED_APPS:
INSTALLED_APPS = [
# ... your other apps
'djangorestframework_mcp',
]
- Add the MCP endpoint to your
urls.py:
urlpatterns = [
# ... your other URL patterns
path('mcp/', include('djangorestframework_mcp.urls')),
]
- Transform any DRF ViewSet into MCP tools with a single decorator:
from djangorestframework_mcp.decorators import mcp_viewset
@mcp_viewset()
class CustomerViewSet(ModelViewSet):
queryset = Customer.objects.all()
serializer_class = CustomerSerializer
When @mcp_viewset is applied to a ViewSet class that inherits from GenericViewSet (such as ModelViewSet or ReadOnlyModelViewSet), any of the following methods that are defined will be automatically exposed as MCP tools:
list-> List customers withcustomers_listtool.retrieve-> Retrieve a customer withcustomers_retrievetool.create-> Create new customers withcustomers_createtool.update-> Update customers withcustomers_updatetool. (All fields must be passed in)partial_update-> Update customers withcustomers_partial_updatetool. (A subset of fields can be passed in)destroy-> Delete customers withcustomers_destroytool.
For each tool the library automatically:
- Generates tool schemas from your DRF serializers
- Preserves your existing permissions, authentication, and filtering
- Returns context rich error messages to guide LLMs
(See: Custom Actions below for more info on how to expose additional endpoints you created using the @action decorator as tools).
- Connect any MCP client to
http://localhost:8000/mcp/and try it out!
Important Differences between MCP Requests and API Requests
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"my-django-mcp": {
"command": "node",
"args": [
"path/to/mcp-remote",
"http://localhost:8000/mcp/",
"--transport",
"http-only"
]
}
}
}