MCP Catalogs
首页

drf-mcp-docs

by Abdulkhalek-1·17·综合分 43

一个将Django REST Framework API文档通过MCP协议暴露给AI编码助手,帮助前端开发的MCP服务器。

developer-toolsai-llmproductivity
2
Forks
1
活跃 Issue
2 个月前
最近提交
2 天前
收录于

概述

drf-mcp-docs将你的DRF API文档转换为MCP资源和工具,AI助手可以使用这些工具理解你的API并生成前端集成代码。它支持多种模式生成器(drf-spectacular、drf-yasg、DRF内置),并提供stdio和HTTP传输选项。该服务器将API文档暴露为可浏览的资源,并提供工具用于搜索端点、检索示例以及为JavaScript/TypeScript、Python和cURL生成客户端代码。

试试问 AI

装完之后,这里有 4 个你可以让 AI 做的事:

:AI助手生成用于消费DRF API的React/Vue/Angular hooks
:自动生成TypeScript或Python中的类型化API客户端代码
:文档探索,AI可以查询端点详细信息和示例
:使用自动生成的代码片段创建集成教程和指南

什么时候选它

如果你使用 Django REST Framework 并希望 AI 编码助手能访问 API 文档帮助前端集成,请选择这个。

什么时候不要选它

如果你需要 AI 直接调用 API 端点(这个服务器只暴露文档,不暴露操作),不要选择这个。

此 server 暴露的工具

从 README 抽取出 7 个工具
  • search_endpointssearch_endpoints(query, method?, tag?)

    Search endpoints by keyword

  • get_endpoint_detailget_endpoint_detail(path, method)

    Get full endpoint documentation

  • get_request_exampleget_request_example(path, method)

    Get example request body and parameters

  • get_response_exampleget_response_example(path, method, status_code?)

    Get example response for an endpoint

  • generate_code_snippetgenerate_code_snippet(path, method, language?, client?)

    Generate integration code with types and docs

  • list_schemaslist_schemas()

    Get all data model names and descriptions

  • get_schema_detailget_schema_detail(name)

    Get full schema with all fields and types

可对比工具

django-mcp-serverdrf-spectacularpostman

安装

安装

pip install drf-mcp-docs
# 使用特定模式生成器:
pip install drf-mcp-docs[spectacular]   # 推荐
pip install drf-mcp-docs[yasg]

配置

添加到Django设置中:

INSTALLED_APPS = [
    # ...
    'rest_framework',
    'drf_mcp_docs',
]

运行

**stdio传输**(用于本地AI工具):

python manage.py runmcpserver --transport stdio

**可流式HTTP传输**(用于网络访问):

python manage.py runmcpserver --transport streamable-http --host 0.0.0.0 --port 8100

Claude桌面配置

添加到~/.claude.json

{
  "mcpServers": {
    "my-api-docs": {
      "command": "python",
      "args": ["manage.py", "runmcpserver", "--transport", "stdio"],
      "cwd": "/path/to/your/django/project"
    }
  }
}

drf-mcp-docs 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。