Token导航 LogoToken导航

MCP Server · 开发工具

Django Migrations MCP服务

一个用于在分布式环境中管理Django迁移的Model Context Protocol (MCP)服务,提供迁移状态检查、创建新迁移、应用迁移等功能,并支持CI/CD集成。

stdio官方级别未说明来源级核验工具 0
Python开发工具命令行工具

快速开始

作者 / 组织
mrrobotke
提供方
mrrobotke
运行时
Python

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

6

仓库热度

收录来源

3 个

MCP World

选型结论

Django Migrations MCP服务 属于开发工具类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,客户端适配情况以官方文档为准,有可以直接复制的安装命令;接入前先确认权限范围。

分类

开发工具

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

pip install -r requirements.txt

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Python,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 0 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

Django迁移MCP服务

用于管理分布式环境中Django迁移的模型上下文协议(MCP)服务。该服务封装了Django的迁移命令,并将其作为MCP端点公开,从而可以轻松管理跨多个服务的迁移并与CI/CD管道集成。

特性

  • 检查迁移状态(相当于 showmigrations)
  • 创建带有验证的新迁移(相当于 makemigrations)
  • 应用带有安全检查的迁移(相当于 migrate)
  • 附加验证和安全检查:

- 顺序迁移顺序验证 - 冲突检测 - 依赖性验证 - 迁移操作的安全性分析

安装

地方发展

  1. 克隆存储库:
git clone https://github.com/mrrobotke/django-migrations-mcp.git
cd django-migrations-mcp
  1. 安装依赖项:
pip install -r requirements.txt

配置

设置以下环境变量:

export DJANGO_SETTINGS_MODULE="your_project.settings"
export MCP_SERVICE_PORT=8000  # Optional, defaults to 8000

用法

运行服务

  1. 直接使用Python:
python -m migrations_mcp.service
  1. 使用Docker:
docker build -t django-migrations-mcp .
docker run -e DJANGO_SETTINGS_MODULE=your_project.settings \
          -v /path/to/your/django/project:/app/project \
          -p 8000:8000 \
          django-migrations-mcp

MCP端点

  1. 显示迁移:
from mcp import MCPClient

client = MCPClient()
migrations = await client.call("show_migrations")
  1. 进行迁移:
result = await client.call("make_migrations", {
    "app_labels": ["myapp"],  # Optional
    "dry_run": True  # Optional
})
  1. 应用迁移:
result = await client.call("migrate", {
    "app_label": "myapp",  # Optional
    "migration_name": "0001",  # Optional
    "fake": False,  # Optional
    "plan": True  # Optional
})

CI/CD集成

GitHub操作工作流示例:

name: Django Migrations Check

on:
  pull_request:
    paths:
      - '*/migrations/*.py'
      - '*/models.py'

jobs:
  check-migrations:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2
    
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.11'
    
    - name: Install dependencies
      run: |
        pip install -r requirements.txt
    
    - name: Start MCP service
      run: |
        python -m migrations_mcp.service &
    
    - name: Check migrations
      run: |
        python ci/check_migrations.py

check_migrations.py脚本示例:

import asyncio
from mcp import MCPClient

async def check_migrations():
    client = MCPClient()
    
    # Check current status
    migrations = await client.call("show_migrations")
    
    # Try making migrations
    result = await client.call("make_migrations", {"dry_run": True})
    if not result.success:
        print(f"Error: {result.message}")
        exit(1)
    
    print("Migration check passed!")

if __name__ == "__main__":
    asyncio.run(check_migrations())

发展

运行测试

pytest migrations_mcp/tests/

代码的风格

该项目遵循PEP 8指南。使用以下方式格式化代码:

black migrations_mcp/
isort migrations_mcp/

许可证

MIT许可证。有关详细信息,请参阅LICENSE文件。

贡献

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

Docker使用

该项目包括 docker-commands.json 为不同部署场景提供结构化命令的文件。您可以直接使用这些命令,也可以在脚本中解析它们。

可用的Docker配置

  1. Redis MCP服务器
# Run Redis MCP server
docker run -i --rm mcp/redis redis://host.docker.internal:6379
  1. Django迁移MCP服务器
# Basic setup
docker run -d \
  --name django-migrations-mcp \
  -e DJANGO_SETTINGS_MODULE=your_project.settings \
  -e MCP_SERVICE_PORT=8000 \
  -v /path/to/your/django/project:/app/project \
  -p 8000:8000 \
  django-migrations-mcp

# With Redis integration
docker run -d \
  --name django-migrations-mcp \
  -e DJANGO_SETTINGS_MODULE=your_project.settings \
  -e MCP_SERVICE_PORT=8000 \
  -e REDIS_URL=redis://host.docker.internal:6379 \
  -v /path/to/your/django/project:/app/project \
  -p 8000:8000 \
  --network host \
  django-migrations-mcp
  1. 开发环境
# Using docker-compose
docker-compose up -d --build
  1. 测试环境
# Run tests in container
docker run --rm \
  -e DJANGO_SETTINGS_MODULE=your_project.settings \
  -e PYTHONPATH=/app \
  -v ${PWD}:/app \
  django-migrations-mcp \
  pytest
  1. 生产环境
# Production setup with health check
docker run -d \
  --name django-migrations-mcp \
  -e DJANGO_SETTINGS_MODULE=your_project.settings \
  -e MCP_SERVICE_PORT=8000 \
  -e REDIS_URL=redis://your-redis-host:6379 \
  -v /path/to/your/django/project:/app/project \
  -p 8000:8000 \
  --restart unless-stopped \
  --network your-network \
  django-migrations-mcp

以编程方式使用命令

您可以以编程方式解析和使用命令:

import json
import subprocess

# Load commands
with open('docker-commands.json') as f:
    commands = json.load(f)

# Run Redis MCP server
redis_config = commands['mcpServers']['redis']
subprocess.run([redis_config['command']] + redis_config['args'])

# Run Django Migrations MCP server
django_config = commands['mcpServers']['djangoMigrations']
subprocess.run([django_config['command']] + django_config['args'])

网络设置

  1. 开发网络
docker network create mcp-dev-network
  1. 生产网络
docker network create --driver overlay --attachable mcp-prod-network

使用MCP工具

该服务公开了几个可以通过curl或任何HTTP客户端访问的端点:

  1. 显示迁移
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method": "show_migrations"}'
  1. 进行迁移
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method": "make_migrations", "params": {"apps": ["your_app"]}}'
  1. 应用迁移
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"method": "migrate", "params": {"app": "your_app"}}'

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

Django迁移Python本地部署分布式管理CI/CD集成数据库迁移开发工具

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

让助手直接读代码

把仓库、提交记录和 issue 交给模型检索,补全和重构时不用来回复制文件。

在对话里跑命令

触发构建、测试和脚本,执行结果直接回到上下文,省去切终端。

接进开发流程

把 PR、CI 状态和代码审查接进助手,减少在几个工具之间跳。

选择建议

值得选的地方

  • 只提供 0 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 3 个目录同时收录,信息可以交叉核对。

先想清楚的地方

  • stdio 方式要求本地装好 Python,换机器要重新装一遍。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在开发工具场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Django Migrations MCP服务

MCP World · 本页

0stdio有3 个2026-05-17
Git 838e2ec1

MCP World

12stdio有2 个2026-05-17
Markitdown MCP 2c653a5f

MCP World

1stdio有1 个2026-05-17
Context7 831acf40

MCP World

0stdio有1 个2026-05-17
Context7 MCP C671e75a

MCP World

0stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Django Migrations MCP服务 怎么安装?

公开资料给出的安装命令是 pip install -r requirements.txt,运行环境为 Python。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Django Migrations MCP服务 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Python;保存后完全退出客户端再打开,配置才会生效。

Django Migrations MCP服务 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Django Migrations MCP服务 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Django Migrations MCP服务 支持哪些客户端?

公开资料没有标注具体客户端;能配置本地 MCP 命令的客户端都能接,配置方式参照官方文档。

来源信息

继续浏览同类 MCP