AI MCP Integration
The Model Context Protocol (MCP) is an open standard that lets AI agents discover and interact with external tools. The django_mcp module turns your Django-CFG project into an MCP server, giving agents structured access to your models, management commands, and custom tools — all behind a single access key.
Quick Start
Add the MCP module to your config.py:
from django_cfg import DjangoConfig
from django_cfg.modules.django_mcp.__cfg__ import DjangoMCPModuleConfig
class MyConfig(DjangoConfig):
mcp = DjangoMCPModuleConfig(
enabled=True,
access_key="your-secret-key",
)Django-CFG automatically registers the MCP endpoints:
| Endpoint | Description |
|---|---|
POST /cfg/mcp/ | MCP JSON-RPC 2.0 endpoint |
POST /cfg/mcp/agent/ | AI Agent chat endpoint |
The module is disabled by default (enabled=False). Set enabled=True and provide an access_key before using any MCP functionality.
Full Documentation
How the MCP server is structured — endpoints, tool registry, security model.
ConfigurationFull reference for DjangoMCPModuleConfig — introspection, model exposure, rate limiting.
Built-in tools and how to write custom tools with MCPTool.
The POST /cfg/mcp/agent/ endpoint — conversational interface for AI agents.