AI and MCP Integration
Django CFG by CMDOP separates framework documentation, application tools, and development-machine access. Connect only the surface your assistant needs.
| Surface | Purpose | Access |
|---|---|---|
| Documentation | Learn Django CFG configuration and APIs | Public static index and local read-only stdio MCP |
| Application MCP | Work with a particular project’s tools and explicitly exposed data | Credentials accepted by that project’s MCP profile |
| CMDOP | Operate a development machine and its workspace | Separate machine admission and permissions |
The Django Admin Overview is an operational dashboard, not an assistant client. It has no embedded MCP connection tab or chat panel. Removing those panels does not disable MCP for authenticated users of a project.
Documentation assistance
The documentation-only MCP is a local stdio process in the
@djangocfg/nextjs distribution. It reads the public
docs-index.json generated alongside the static docs. The search
runs locally; the server only distributes documentation bytes.
Use a released package version that includes the local documentation MCP. The initial migration requires both the updated package and the published static index. These commands are not available in older releases that used the retired hosted documentation service.
After installing that version, run:
djangocfg-docs search "database configuration"
djangocfg-docs info
djangocfg-docs mcpThe last command prints the local configuration:
{
"mcpServers": {
"djangocfg-docs": {
"command": "djangocfg-docs",
"args": ["serve"]
}
}
}The installed executable must be on the assistant’s PATH; use its
absolute path if needed. The process exposes only search_docs
(excerpts and canonical URLs) and get_docs (indexed documentation
text). It has no shell, project files, databases, credentials or
application permissions. No project MCP token is needed to read
public documentation. The CLI uses the official MCP SDK over stdio,
not an HTTP service listening on the docs domain.
TypeScript applications can use search(), getDocs(),
getInfo() and getLocalMcpConfig() from @djangocfg/nextjs/ai.
Explicit compatible remote documentation providers remain a
separate opt-in. The default hosted documentation MCP was retired;
there is no replacement hosted MCP or dynamic search endpoint.
Application MCP quick start
Use two credential boundaries: a deployment-owned operator profile and a user-facing profile. Keep deployment credentials in your own secret configuration, never in a browser or a shared documentation file.
import os
from django_cfg import DjangoConfig, MCPConfigBuilder
builder = MCPConfigBuilder()
builder.set_access_key(os.environ["MCP__ACCESS_KEY"])
builder.enable_public_profile()
class MyConfig(DjangoConfig):
mcp = builder.build()The builder creates the operator profile at /cfg/mcp/ and a separate
profile at /mcp/ for tools explicitly marked public. With no custom
validator or static public keys supplied, that profile accepts each
active user’s own django-cfg UserAPIKey. An operator key is not a
substitute for a user’s credential on the user-facing profile.
“Public” describes the eligible tools and audience, not anonymous access. A valid credential does not automatically grant every model, field, command or operation. Review the profile and model exposure rules and the authorization logic of each custom tool before enabling access.
Connect signed-in users
The application frontend can expose the MCP connection UI through
@djangocfg/widget-mcp and the Settings dialog. This is independent of
Django Admin. Users connect with their personal keys, or through OAuth
when the project enables it.
See Connect assistants for the frontend setup, OAuth issuer, callback constraints, and key rotation.
Endpoint responsibilities
| Endpoint | Responsibility |
|---|---|
POST /cfg/mcp/ | Deployment operator’s JSON-RPC tools |
POST /mcp/ | User-facing JSON-RPC tools with the public profile’s own credentials |
GET <profile.path>info/ | Credential-protected tool discovery |
POST /cfg/mcp/agent/ | Separate application agent endpoint, when configured |
Bootstrap installer and discovery files are not permission to invoke tools. The agent endpoints are not mounted on each user-facing MCP profile. Application-specific chat clients have their own authorization requirements.
Verify the deployment
Use mcp_doctor to check the configuration and target, then verify the intended user’s allowed tools and one representative denied operation. An unauthenticated tool request must return 401. Never treat a successful sign-in as proof that a tool’s data-access policy is correct.