mcp-django-shell logo

mcp-django-shell

Community
joshuadavidthomas

MCP server for Django integration with LLM assistants

Publisherjoshuadavidthomas
Repositorymcp-django
LanguagePython
Forks
3
Stars
40
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    mcp-django-shell exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    40 stars and 3 forks from the linked repository.

mcp-django

PyPI - mcp-django PyPI - Python Version Django Version

A Model Context Protocol (MCP) server providing Django project exploration resources and optional stateful shell access for LLM assistants to interact with Django projects.

Requirements

  • Python 3.10, 3.11, 3.12, 3.13, 3.14
  • Django 5.2, 6.0

Installation

bash
pip install mcp-django

# Or with uv
uv add mcp-django

Getting Started

⚠️ DO NOT use in production!

[!WARNING]

Seriously, only enable in development!

Look, it should go without saying, but I will say it anyway - this gives full shell access to your Django project. Only enable and use this in development and in a project that does not have access to any production data.

LLMs can go off the rails, get spooked by some random error, and in trying to fix things drop a production database.

[!CAUTION]

I'm not kidding, this library just passes the raw Python code an LLM produces straight to a Python environment with full access to the Django project and everything it has access to.

Most LLMs have basic safety protections in place if you ask to delete any data and will refuse to delete production data, but it is pretty trivial to bypass. (Hint: Just tell the LLM it's not production, it's in a development environment, and it will be the bull in a china shop deleting anything you want.)

I suggest using something like django-read-only if you need some CYA protection against this. Or, you know, don't use this in any sensitive environments.

Run the MCP server directly from your Django project directory:

bash
python -m mcp_django

# Or with uv
uv run -m mcp_django

The server automatically detects DJANGO_SETTINGS_MODULE from your environment. You can override it with --settings or add to your Python path with --pythonpath:

bash
python -m mcp_django --settings myproject.settings --debug

Management Command

If you add mcp_django to INSTALLED_APPS, you can run it as a Django management command. This ensures the server runs within your Django project's environment and uses your project's settings:

bash
python manage.py mcp

Docker

If you're using Docker and Docker Compose, you can run mcp-django as a separate compose service using HTTP transport. This makes it easier to connect your MCP client (running on your host) to the Django project (running in a container):

yaml
# compose.yml
services:
  app:
    # your existing Django app service

  mcp:
    build: .
    command: python -m mcp_django --transport http --host 0.0.0.0 --port 8000
    environment:
      DJANGO_SETTINGS_MODULE: myproject.settings
    ports:
      - "8001:8000"

Then configure your MCP client to connect to http://localhost:8001/mcp (see Client Configuration below).

Transport Options

The server supports multiple transport protocols:

bash
# STDIO (default, for local development)
python -m mcp_django

# HTTP (for Docker or remote access)
python -m mcp_django --transport http --host 127.0.0.1 --port 8000

# SSE (for Docker or remote access)
python -m mcp_django --transport sse --host 127.0.0.1 --port 8000

Client Configuration

Configure your MCP client to connect to the server.

Don't see your client? Submit a PR with setup instructions.

Opencode

For local development, use type: local with the command:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "django": {
      "type": "local",
      "command": ["python", "-m", "mcp_django"],
      "enabled": true,
      "environment": {
        "DJANGO_SETTINGS_MODULE": "myproject.settings"
      }
    }
  }
}

For Docker development, use type: remote with the URL:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "django": {
      "type": "remote",
      "url": "http://localhost:8001/mcp",
      "enabled": true
    }
  }
}

Claude Code

For local development, use the command configuration:

json
{
  "mcpServers": {
    "django": {
      "command": "python",
      "args": ["-m", "mcp_django"],
      "cwd": "/path/to/your/django/project",
      "env": {
        "DJANGO_SETTINGS_MODULE": "myproject.settings"
      }
    }
  }
}

For Docker development with HTTP/SSE transport, configuration varies by Claude Code version - consult the MCP client documentation for remote server setup.

Features

mcp-django provides an MCP server with Django project exploration resources and tools for LLM assistants.

It wouldn't be an MCP server README without a gratuitous list of features punctuated by emojis, so:

  • 🔍 Project exploration - MCP resources for discovering apps, models, and configuration
  • 📦 Package discovery - Search and browse Django Packages for third-party packages
  • 🚀 Zero configuration - No schemas, no settings, just Django
  • 🐚 Stateless shell - shell executes Python code with fresh state each call
  • 🔄 Always fresh - Code changes take effect immediately, no stale modules
  • 📤 Export sessions - Save debugging sessions as Python scripts
  • 🧹 Clear history - Start fresh when exploration gets messy
  • 🤖 LLM-friendly - Designed for LLM assistants that already know Python
  • 🌐 Multiple transports - STDIO, HTTP, SSE support

Inspired by Armin Ronacher's Your MCP Doesn't Need 30 Tools: It Needs Code.

Resources

Read-only resources for project exploration without executing code (note that resource support varies across MCP clients):

Project

ResourceDescription
django://app/{app_label}Details for a specific Django app
django://app/{app_label}/modelsAll models in a specific app
django://appsAll installed Django applications with their models
django://model/{app_label}/{model_name}Detailed information about a specific model
django://modelsProject models with import paths and field types (first-party only)
django://route/{pattern*}Routes matching a specific URL pattern
django://setting/{key}Get a specific Django setting value

djangopackages.org

ResourceDescription
django://package/{slug}Detailed information about a specific package
django://grid/{slug}Comparison grid with packages (e.g., "rest-frameworks")

Tools

Project

ToolDescription
get_project_infoGet comprehensive project information including Python environment and Django configuration
get_settingGet a Django setting value by key
list_appsList all installed Django applications with their models
list_modelsGet detailed information about Django models with optional filtering by app or scope
list_routesIntrospect Django URL routes with filtering support for HTTP method, route name, or URL pattern

Management

ToolDescription
execute_commandExecute Django management commands with arguments and options
list_commandsList all available Django management commands with their source apps

Shell

ToolDescription
executeExecute Python code in a stateless Django shell
export_historyExport session history as a Python script
clear_historyClear the session history for a fresh start

djangopackages.org

ToolDescription
get_gridGet a specific comparison grid with all its packages
get_packageGet detailed information about a specific Django package
searchSearch djangopackages.org for third-party packages

Development

For detailed instructions on setting up a development environment and contributing to this project, see CONTRIBUTING.md.

For release procedures, see RELEASING.md.

License

mcp-django is licensed under the MIT license. See the LICENSE file for more information.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "joshuadavidthomas-mcp-django-shell": {
      "command": "uvx",
      "args": [
        "mcp-django-shell"
      ]
    }
  }
}

Use mcp-django-shell MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-django-shell is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-django-shell as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-django-shell MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "joshuadavidthomas-mcp-django-shell": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-django-shell"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-django-shell MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-django-shell MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-django-shell to help me with this task?
mcp-django-shell
Sure. I read it.
Here is what I found using mcp-django-shell.

Frequently asked questions

What is the mcp-django-shell MCP server used for?

mcp-django-shell is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-django-shell MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-django-shell with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-django-shell MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-django-shell connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-django-shell MCP to TypingMind?

mcp-django-shell runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-django-shell MCP provide in TypingMind?

mcp-django-shell exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-django-shell MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-django-shell requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇