home / mcp / django migrations mcp server
A Model Context Protocol (MCP) service for managing Django migrations in distributed environments.
Configuration
View docs{
"mcpServers": {
"mrrobotke-django-migrations-mcp": {
"command": "docker",
"args": [
"run",
"-d",
"--name",
"django_migrate_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"
],
"env": {
"REDIS_URL": "redis://host.docker.internal:6379",
"MCP_SERVICE_PORT": "8000",
"DJANGO_SETTINGS_MODULE": "your_project.settings"
}
}
}
}You can manage Django migrations across distributed services by running a dedicated MCP server. This service wraps Django’s migration commands and exposes them as MCP endpoints, enabling centralized migration management, validation, and safe application in CI/CD pipelines.
You interact with the Django Migrations MCP Server using an MCP client. First, verify the current migration status across apps, then generate and apply migrations in a controlled way. Use the client to check status, create new migrations with validation, and apply migrations with safety checks. You can integrate these steps into your CI/CD workflow to ensure migrations are correct before affecting production.
Prerequisites: Python and Docker installed on your machine, plus access to your Django project. You will also need a working network to pull container images or run local containers.
Step-by-step commands to run locally with Docker (complete runtime command shown):
docker run -d \
--name django_migrate_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-mcpConfiguration focuses on environment variables that control how the MCP server runs, including which Django settings module to use and which port the service exposes.
Security and best practices include restricting access to the MCP endpoints, using CI/CD gating for migrations, and validating migration plans before applying changes to environments beyond development.
Notes about usage: you can run the service directly with Python or via Docker. When running through Docker, you typically build the image first and then start a container with the necessary environment variables and volume mounts to point to your Django project.
The Django Migrations MCP Server provides key tools to manage migrations programmatically via MCP endpoints.
Check the current migration status for all apps, equivalent to Django's showmigrations command.
Generate new migrations for selected apps with validation to ensure proper structure before applying.
Apply migrations with safety checks, including plan or dry-run options to pre-check changes.