ZD

zacharypodbela/django-rest-framework-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

55 stars 7 forks 품질 71 트렌드 0BSD-3-Clause

zacharypodbela/django-rest-framework-mcp는 MCP 서버 후보가 https://github.com/zacharypodbela/django-rest-framework-mcp.에서 가져온 것입니다

개요

zacharypodbela/django-rest-framework-mcp는 MCP 서버 후보가 https://github.com/zacharypodbela/django-rest-framework-mcp.에서 가져온 것입니다

개요(AI 번역)

django-rest-framework-mcp] 는 MCP 서버가 Django Rest Framework API를 MCP 도구로 몇 줄의 코드로 노출시킬 수 있도록 합니다.

관리자 작업 흐름을 Supercharge (그리고 개발 관리자 인터페이스 과거의 일):

  • “Deactivate [email protected] 계정” → 실제 비활성화
  • “Extend [email protected]의 무료 평가판 1 주” → 계획을 업데이트
  • “많은 새로운 사용자는 일주일에 가입합니까?” → 실제 데이터를 반환 → LLM은 신속하게 그래프를 만들 수 있습니다 (더 복잡한 FE 그래픽 라이브러리 필요 없음)

또는 대화의 상호 작용과 함께 전통, 보링 SaaS UX를 변형:

  • 이전 방법 : 사용자는 "내 게시물"을 클릭, 목록에서 게시물을 클릭, “Edit”, 제목을 변경, "Save"를 클릭합니다
  • Django Rest Framework MCP : "Beginner Guide to Django"에서 'Django 101’로 내 게시물을 이름을 변경할 수 있습니까?

빠른 시작

  1. 패키지를 설치:

  2. INSTALLED_APPS에 추가:

  3. MCP 엔드포인트를 urls.py에 추가하십시오:

  4. 단일 장식자와 MCP 도구로 DRF ViewSet를 변환 :

이 페이지는 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

  1. Install the package:
pip install django-rest-framework-mcp
  1. Add to your INSTALLED_APPS:
INSTALLED_APPS = [
    # ... your other apps
    'djangorestframework_mcp',
]
  1. Add the MCP endpoint to your urls.py:
urlpatterns = [
    # ... your other URL patterns
    path('mcp/', include('djangorestframework_mcp.urls')),
]
  1. 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 with customers_list tool.
  • retrieve -> Retrieve a customer with customers_retrieve tool.
  • create -> Create new customers with customers_create tool.
  • update -> Update customers with customers_update tool. (All fields must be passed in)
  • partial_update -> Update customers with customers_partial_update tool. (A subset of fields can be passed in)
  • destroy -> Delete customers with customers_destroy tool.

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

  1. Connect any MCP client to http://localhost:8000/mcp/ and try it out!

Important Differences between MCP Requests and API Requests

GitHub에서 전체 README 보기

설치

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