MCP服务器的Django样式指南
Cursor、Windsurf、Claude Desktop和其他AI编辑器中模型上下文协议(MCP)服务器的现成Django Styleguide文档。
这是什么?
结果: 你的AI助手可以很容易地找到并使用原始样式表中的所有Django最佳实践。
运作原理
- Git子模块:我们将原始的Django Styleguide作为子模块包含在内
- 自动拆分:CLI工具按节将大型README.md拆分为单独的文件
- llms.txt生成:为每个部分创建具有绝对URL的索引文件
- 准备消费:MCP服务器可以轻松访问文档
你得到了什么
- 📄 18个单独的文件 Django最佳实践(模型、服务、API等)
- 🔗 llms.txt索引 直接链接到GitHub原始内容
- 🔄 自动更新 当原始样式表更改时
- 🤖 AI友好格式 对于MCP服务器
生成文档示例
处理后,您将得到以下结构:
docs/
├── models.md # Django models
├── services.md # Service layer
├── apis-serializers.md # APIs and serializers
├── urls.md # URL structure
├── settings.md # Django settings
├── errors-exception-handling.md # Error handling
├── testing.md # Testing
├── celery.md # Celery tasks
└── ...other sections
llms.txt # Index for MCP serversllms.txt 包含直接链接:
# Table of Contents
- [Models](https://raw.githubusercontent.com/dmmeteo/django-styleguide-mcp/main/docs/models.md)
- [Services](https://raw.githubusercontent.com/dmmeteo/django-styleguide-mcp/main/docs/services.md)
- [APIs & Serializers](https://raw.githubusercontent.com/dmmeteo/django-styleguide-mcp/main/docs/apis-serializers.md)
...与AI编辑器集成
光标
增添 ~/.cursor/mcp.json:
{
"mcpServers": {
"django-styleguide": {
"command": "uvx",
"args": [
"--from",
"mcpdoc",
"mcpdoc",
"--urls",
"DjangoStyleguide:https://raw.githubusercontent.com/dmmeteo/django-styleguide-mcp/main/llms.txt",
"--transport",
"stdio"
]
}
}
}添加到光标规则中:
For ANY questions about Django best practices, use the django-styleguide MCP server:
+ call list_doc_sources to get available sources
+ call fetch_docs to read llms.txt
+ analyze URLs in llms.txt based on the question
+ fetch relevant documentation sections
+ provide comprehensive answers based on Django Styleguide帆板运动
类似的配置 ~/.codeium/windsurf/mcp_config.json.
克劳德桌面
增添 ~/Library/Application\ Support/Claude/claude_desktop_config.json.
保持文档更新
当原始Django样式指南更改时,文档会自动更新:
# 1. Git submodule automatically updates
git submodule update --remote django-styleguide
# 2. Regenerate documentation
uv run python -m mcpdoc_split.cli django-styleguide/README.md \
--url-prefix "https://raw.githubusercontent.com/dmmeteo/django-styleguide-mcp/main" \
--base-path "/docs" \
--max-level 2
# 3. Commit changes
git add docs/ llms.txt
git commit -m "Update documentation from Django Styleguide"发展
如果要进行更改或在本地运行:
# Clone repository
git clone https://github.com/dmmeteo/django-styleguide-mcp.git
cd django-styleguide-mcp
# Initialize submodule
git submodule update --init --recursive
# Install dependencies
uv sync
# Run CLI
uv run python -m mcpdoc_split.cli django-styleguide/README.md
# Run tests
uv run pytest项目结构
mcpdoc_split/ # CLI tool for splitting documentation
├── cli.py # Command line interface
├── main.py # File splitting logic
└── ...
django-styleguide/ # Git submodule of original styleguide
docs/ # Generated documentation files
llms.txt # Index for MCP servers
tests/ # Tests致谢
- Django风格指南 由HackSoft提供优秀的Django实践
- mcpdoc 由LangChain为MCP服务器提供灵感
- 模型上下文协议 对于MCP规范
相关项目
- Django风格指南 -Django最佳实践指南
- mcpdoc -用于文档访问的MCP服务器
- llms.txt -人工智能友好文档标准
