Skip to main content

Django integration for Model Context Protocol (MCP).

Project description

Django-MCP

Django-MCP

Seamlessly integrate your Django application with the Model Context Protocol (MCP) using the official Python SDK.

Django Python Versions MCP Version License

Overview

django-mcp allows you to easily expose parts of your Django application (views, functions) as Tools, Resources, and Prompts compatible with the Model Context Protocol (MCP) specification (v1.6.0).

This enables AI agents and LLMs (like Gemini, Claude, etc.) that understand MCP to interact with your Django application in a standardized way.

Note: This project was significantly developed with the assistance of an AI pair programmer (Gemini, Claude and Cursor Agent). While thoroughly tested, this collaborative approach shaped its implementation.

This library acts as a thin wrapper around the official mcp Python SDK, providing:

  • Simplified Setup: An easy way to initialize and integrate the MCP server within your Django project (FastMCP class).
  • Auto-Discovery: Automatically discover Django views and register them as MCP tools.
  • SSE Transport: Exposes the MCP server via a Server-Sent Events (SSE) endpoint compatible with MCP clients.

Key Features

  • Uses Official MCP SDK: Leverages the standard mcp package for core protocol logic.
  • FastMCP-style API: Provides a familiar decorator-based API (@mcp.tool, @mcp.resource, @mcp.prompt).
  • Django View Auto-Discovery: Automatically exposes Django views as MCP tools (configurable).
  • SSE Endpoint Integration: Easily integrates the MCP SSE transport into your Django urls.py.

Installation

# Make sure you have Python 3.10+
pip install django-mcp

This will also install the required mcp SDK and Django if you don't have them.

Add django_mcp to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    # ... other apps
    'django_mcp',
    # ...
]

Quick Start & Documentation

For detailed setup instructions, usage examples (registering tools, resources, prompts), auto-discovery configuration, and more, please refer to the detailed documentation:

➡️ README_MCP.md

Contributing

Contributions are welcome! Please check the contribution guidelines (if available) or open an issue/pull request.

License

Django-MCP is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulse_django_mcp-0.2.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pulse_django_mcp-0.2.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file pulse_django_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: pulse_django_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.7 Windows/10

File hashes

Hashes for pulse_django_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 413bef2604895a192159da11fcd54b31b57d04233f96c634a9dba700b16129fc
MD5 af1a04f79ca60dd1b8d699f2cc8f0924
BLAKE2b-256 5e5de5ed1446b7bb1655c5dde603e2d4962179fb3ea226746e7fb50a4fe0e7e7

See more details on using hashes here.

File details

Details for the file pulse_django_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pulse_django_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.7 Windows/10

File hashes

Hashes for pulse_django_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b30551bdaf03296788a225ed79b7d168855523b85e4582581740057e61498a4d
MD5 9d3b3b41bc9fd83febd9878e37826499
BLAKE2b-256 e84afeea82fcf4f1740025a8a2b9d55a662bc298659e6cc7990e84781ddc2dd9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page