Gives AI assistants read-only access to your Django project's internals through FastMCP. You get tools to list models, URLs, and management commands, introspect database schemas and migrations, query settings with dot notation, and read application logs with filtering. Authentication is built in via bearer tokens when running in SSE mode for production deployments. The stdio transport is local-only with no auth. Useful when you want your AI pair programmer to understand your Django codebase without manually explaining your models, URL patterns, or configuration. All operations are safe and read-only, so you can expose project structure without worrying about accidental modifications during development or code review sessions.
A Model Context Protocol (MCP) server for developing Django applications, inspired by Laravel Boost. This server exposes Django project information through MCP tools, enabling AI assistants to better understand and interact with Django codebases.

Django AI Boost MCP server providing Django project introspection through AI assistants (Example using OpenCode)
# Using uv (recommended)
uv pip install django-ai-boost
# Or with pip
pip install django-ai-boost
If you want to contribute or run the latest development version:
# Clone the repository
git clone https://github.com/vinta/django-ai-boost.git
cd django-ai-boost
# Install uv if you haven't already
# On macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Install dependencies (creates virtual environment automatically)
uv sync --dev
# Verify installation
uv run django-ai-boost --help
The server requires access to your Django project's settings:
# Set the Django settings module
export DJANGO_SETTINGS_MODULE=myproject.settings
django-ai-boost
# Or specify settings directly
django-ai-boost --settings myproject.settings
# Run with SSE transport (default is stdio, which doesn't use network ports)
django-ai-boost --settings myproject.settings --transport sse
# Run with SSE transport on a custom port (default port is 8000)
django-ai-boost --settings myproject.settings --transport sse --port 3000
# Run with SSE transport on custom host and port
django-ai-boost --settings myproject.settings --transport sse --host 0.0.0.0 --port 8080
Note: The stdio transport (default) communicates via standard input/output and does not use network ports. The --port and --host options only apply when using --transport sse.
Django AI Boost supports bearer token authentication for secure production deployments when using SSE transport.
Set authentication token (recommended for production):
export DJANGO_MCP_AUTH_TOKEN="your-secret-token"
django-ai-boost --settings myproject.settings --transport sse
Or use CLI argument:
django-ai-boost --settings myproject.settings --transport sse --auth-token "your-secret-token"
DEBUG=False and using SSE transport, authentication is automatically required--auth-token with --transport stdio, the server will exit with an error to prevent false security assumptionsWhen running in production (DEBUG=False) with SSE transport, you must provide an authentication token:
# This will fail without a token
django-ai-boost --settings myproject.production_settings --transport sse
# Error: Production mode detected but no authentication token provided
# This works
export DJANGO_MCP_AUTH_TOKEN="strong-secret-token"
django-ai-boost --settings myproject.production_settings --transport sse
# Authentication enabled with bearer token for SSE transport
Generate strong tokens:
python -c "import secrets; print(secrets.token_urlsafe(32))"
Never commit tokens to version control
Use environment variables in production (not CLI arguments)
Rotate tokens periodically
Use HTTPS with a reverse proxy for external access
When using authentication, configure your MCP clients to include the token:
Cursor / Claude Desktop:
{
"mcpServers": {
"django-ai-boost": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings", "--transport", "sse"],
"env": {
"DJANGO_MCP_AUTH_TOKEN": "your-secret-token",
"DJANGO_SETTINGS_MODULE": "myproject.settings",
"PYTHONPATH": "/path/to/your/django/project"
}
}
}
}
Testing with curl:
# Without auth - fails
curl http://127.0.0.1:8000/sse
# With correct token - works
curl -H "Authorization: Bearer your-secret-token" http://127.0.0.1:8000/sse
"Production mode detected but no authentication token provided"
DJANGO_MCP_AUTH_TOKEN environment variable or use --auth-token"Authentication token provided but transport is 'stdio'"
--transport sse--transport sse with your token, or remove the --auth-token argument for stdio"Running in production mode with stdio transport"
--transport sse with authenticationCursor is a popular AI-powered code editor with built-in MCP support.
{
"mcpServers": {
"django-ai-boost": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings",
"PYTHONPATH": "/path/to/your/django/project"
}
}
}
}
Note: Replace /path/to/your/django/project with the actual path to your Django project root directory.
For more information, see the Cursor MCP documentation.
Add to your Claude Desktop configuration:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/claude/claude_desktop_config.json{
"mcpServers": {
"django": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings",
"PYTHONPATH": "/path/to/your/django/project"
}
}
}
}
Note: Make sure to replace /path/to/your/django/project with the actual path to your Django project root directory.
.vscode/mcp.json in your Django project root:{
"inputs": [
// The "inputs" section defines the inputs required for the MCP server configuration.
{
"type": "promptString"
}
],
"servers": {
// The "servers" section defines the MCP servers you want to use.
"django-ai-boost": {
"command": "uv",
"args": ["run", "django-ai-boost", "--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
}
}
Click "Start" in the JSON
Github Copilot Code will automatically connect to the MCP server when you start a conversation in "Agent" mode.
.mcp.json in your Django project root:{
"mcpServers": {
"django-ai-boost": {
"command": "uv",
"args": ["run", "django-ai-boost", "--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
}
}
OpenAI ChatGPT Desktop supports MCP servers. Add to your configuration file:
~/Library/Application Support/OpenAI/ChatGPT/config.json%APPDATA%\OpenAI\ChatGPT\config.json{
"mcpServers": {
"django": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
}
}
{
"django": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
}
Add to your Zed MCP configuration (~/.config/zed/mcp.json):
{
"servers": {
"django": {
"command": "django-ai-boost",
"args": ["--settings", "myproject.settings"],
"env": {
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
}
}
For any MCP-compatible client, you can run the server manually:
# Standard I/O transport (default, no network port)
django-ai-boost --settings myproject.settings
# Server-Sent Events transport (default: 127.0.0.1:8000)
django-ai-boost --settings myproject.settings --transport sse
# SSE transport with custom port
django-ai-boost --settings myproject.settings --transport sse --port 3000
# SSE transport with custom host and port
django-ai-boost --settings myproject.settings --transport sse --host 0.0.0.0 --port 8080
application_infoGet Django and Python versions, installed apps, middleware, database engine, and debug mode status.
get_settingRetrieve any Django setting using dot notation (e.g., DATABASES.default.ENGINE).
list_modelsList all Django models with fields, types, max_length, null/blank status, and relationships.
Arguments:
app_labels: Optional list of app labels to filter (e.g., ["blog", "auth"]). If not provided, returns all models.Note: For large projects, some MCP clients (like PyCharm) may truncate output due to display limits. Use the app_labels parameter to filter by specific apps to avoid truncation. See Troubleshooting for more details.
list_urlsShow all URL patterns with names, patterns, and view handlers (including nested includes).
database_schemaGet complete database schema including tables, columns, types, indexes, and foreign keys.
list_migrationsView all migrations per app with their applied/unapplied status.
list_management_commandsList all available manage.py commands with their source apps.
get_absolute_urlGet the absolute URL for a specific model instance. Requires the model to have a get_absolute_url() method defined.
Arguments:
app_label: The Django app label (e.g., "blog")model_name: The model name (e.g., "Post")pk: The primary key of the instancereverse_urlReverse a named URL pattern to get its actual URL path. Supports both positional args and keyword arguments.
Arguments:
url_name: The URL pattern name (e.g., "post_detail", "admin:index")args: Optional list of positional argumentskwargs: Optional dict of keyword argumentsquery_modelQuery a Django model with read-only operations using the Django ORM manager. This tool allows safe querying of any Django model with filtering, ordering, and pagination.
Arguments:
app_label: The Django app label (e.g., "blog")model_name: The model name (e.g., "Post")filters: Optional dict of field lookups (e.g., {"status": "published", "featured": true})order_by: Optional list of fields to order by (e.g., ["-created_at", "title"])limit: Maximum number of results to return (default: 100, max: 1000)Returns:
Example Queries:
filters={"status": "published"}filters={"featured": true}, order_by=["-created_at"]order_by=["-created_at"], limit=10run_checkRun Django's system checks to identify potential issues in models, settings, and deployment configuration.
Arguments:
app_labels: Optional list of app labels to checktags: Optional list of check tags (e.g., "models", "compatibility")deploy: Include deployment checks when truefail_level: Minimum severity ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")databases: Optional list of database aliases to includeread_recent_logsRead recent lines from file-based log handlers configured in LOGGING.handlers.
Arguments:
lines: Number of lines to return per file (default: 100, configurable via DJANGO_MCP_MAX_LOG_LINES env var)handler_name: Optional handler name to read from a single file handlerNote: This tool reads only file-based handlers (
*FileHandlerclasses). If your project logs to the console only, configure aFileHandlerin your DjangoLOGGINGsettings so the AI can access log output. Example:LOGGING = { "version": 1, "handlers": { "file": { "class": "logging.FileHandler", "filename": "django.log", }, }, "root": {"handlers": ["file"], "level": "INFO"}, }
MCP prompts provide reusable message templates to help guide interactions with AI assistants.
search_django_docsGenerate a formatted prompt to help search for specific topics in Django documentation.
Arguments:
topic: The Django topic or feature to search for (e.g., "models", "queryset", "migrations", "authentication")Returns: A formatted prompt that includes:
Example topics:
This prompt automatically adapts to your Django version (e.g., 5.2, 4.2) to ensure documentation compatibility.
Once configured, you can ask your AI assistant questions like:
Using Tools:
Using Prompts:
The project includes a comprehensive test suite and a fixture Django project for development:
# Run all tests with pytest
uv run pytest
# Run broad integration coverage
uv run pytest test_server.py
# Run focused MCP tool tests
uv run pytest test_auth_logic.py test_prompt.py test_query_model.py test_read_recent_logs.py test_run_check.py
# Run the MCP server with the test project
export PYTHONPATH="${PYTHONPATH}:./fixtures/testproject"
uv run django-ai-boost --settings testproject.settings
# Run linter
uv run ruff check .
# Auto-fix linting issues
uv run ruff check --fix .
# Format code
uv run ruff format .
The fixtures/testproject/ directory contains a complete Django application for testing all MCP tools. See fixtures/README.md for details about the test project structure.
Make sure you've set the DJANGO_SETTINGS_MODULE environment variable or used the --settings flag:
export DJANGO_SETTINGS_MODULE=myproject.settings
django-ai-boost
If Django can't find your project modules, add your project directory to PYTHONPATH:
export PYTHONPATH="${PYTHONPATH}:/path/to/your/project"
django-ai-boost --settings myproject.settings
Or in your MCP client configuration:
{
"env": {
"PYTHONPATH": "/path/to/your/project",
"DJANGO_SETTINGS_MODULE": "myproject.settings"
}
}
django-ai-boost command is accessible in your PATHdjango-ai-boost --settings myproject.settings
Ensure your Django database is properly configured and accessible. The MCP server needs the same database access as your Django application.
If you see an error like "Address already in use" when using SSE transport, the default port 8000 is likely occupied by another service (such as your Django development server). Use a different port:
# Use a different port for the MCP server
django-ai-boost --settings myproject.settings --transport sse --port 8001
Note: The stdio transport (default) does not use network ports and will not have this issue.
Some MCP clients have display limits that may truncate long tool outputs:
PyCharm: Limits tool output to 2000 lines (~100 Django models with typical field counts) Claude Code: Truncates at ~700 characters in terminal display
Symptoms:
list_modelsSolution:
Use the app_labels parameter to filter models by specific Django apps:
# Instead of listing all models (may truncate):
list_models()
# Filter by specific app(s):
list_models(app_labels=["blog"])
list_models(app_labels=["blog", "auth", "contenttypes"])
Verification: The truncation is happening client-side, not in the server. To verify:
python manage.py shell -c "from django.apps import apps; print(len(apps.get_models()))"MIT License - see LICENSE file for details.
This project is inspired by Laravel Boost, which provides similar MCP functionality for Laravel applications.
We welcome contributions from the community! Whether it's bug fixes, new features, documentation improvements, or bug reports, your help is appreciated.
git clone https://github.com/YOUR_USERNAME/django-ai-boost.git
cd django-ai-boost
uv sync --dev
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix
# Check code style
uv run ruff check .
# Auto-fix style issues
uv run ruff check --fix .
# Format code
uv run ruff format .
# Run the test suite
uv run pytest
uv run pytest test_server.py
# Test with the fixture project
export PYTHONPATH="${PYTHONPATH}:./fixtures/testproject"
uv run django-ai-boost --settings testproject.settings
4. **Commit your changes**:
```bash
git add .
git commit -m "feat: add new feature" # or "fix: resolve bug"
We follow Conventional Commits:
feat: for new featuresfix: for bug fixesdocs: for documentation changeschore: for maintenance taskstest: for test changesrefactor: for code refactoringgit push origin feature/your-feature-name
ruff check) and formatting (ruff format)We're especially interested in:
Please be respectful and constructive in all interactions. We aim to maintain a welcoming and inclusive community.
This project is maintained by Vinta Software. Our team of design and development experts is available to help your company launch successful Django-powered products. If you need any commercial support, feel free to get in touch: contact@vinta.com.br
DJANGO_SETTINGS_MODULE*Django settings module path (e.g., 'myproject.settings')