Exposes /.well-known/mcp-server on Django projects for MCP agent discovery. Implements draft-serra-mcp-discovery-uri.
Project description
django-mcp-discovery
Exposes /.well-known/mcp-server on your Django project so AI agents
can discover it via mcp://. Implements
draft-serra-mcp-discovery-uri-04.
Installation
pip install django-mcp-discovery
Setup
1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
'mcp_discovery',
]
2. Include URLs:
urlpatterns = [
...
path('', include('mcp_discovery.urls')),
]
3. Done. Visit https://yoursite.com/.well-known/mcp-server.
Configuration (optional)
MCP_DISCOVERY = {
# Required
'NAME': 'My Site MCP Server',
'ENDPOINT': 'https://mysite.com/mcp/',
# SHOULD fields
'DESCRIPTION': 'Natural language description of the server',
# Auth — draft-04 structured format
'AUTH': {
'required': True,
'methods': ['bearer'], # none | bearer | mtls | apikey | oauth2 | x-*
'endpoint': 'https://auth.mysite.com/token',
},
# Retrocompatible shorthand still works: 'AUTH': 'none'
# trust_class — draft-04 new field
# Values: public | sandbox | enterprise | regulated
'TRUST_CLASS': 'public',
# If TRUST_CLASS = 'regulated' — these are REQUIRED
'COMPLIANCE': {
'jurisdiction': 'EU',
'frameworks': ['GDPR', 'ISO27001'],
'certification_url': 'https://mysite.com/compliance',
},
'LOGGING': {
'required': True,
'retention_days': 90,
},
'CACHE_TTL': 300, # seconds — also available for all trust classes
# If TRUST_CLASS = 'sandbox' — expires generated automatically
'EXPIRES_DAYS': 30, # default: 30
# MAY fields — unchanged from v0.3.0
'CAPABILITIES': ['tools', 'resources'],
'CATEGORIES': ['e-commerce', 'fashion'],
'LANGUAGES': ['it', 'en'],
'CONTACT': 'api@mysite.com',
'DOCS': 'https://mysite.com/mcp/docs/',
'CRAWL': True, # False to opt out of indexing
# Primitive previews (draft-04 Section 6.10)
'TOOLS_PREVIEW': [
{'name': 'search_products', 'description': 'Search by category'},
{'name': 'check_stock', 'description': 'Real-time availability'},
],
'RESOURCES_PREVIEW': 'dynamic',
'PROMPTS_PREVIEW': 'dynamic',
}
Auto-detected if not set:
- Name — from
django.contrib.sitesorSITE_NAMEsetting - Endpoint — from
SITE_URLor first non-localhostALLOWED_HOSTS - Language — from
LANGUAGE_CODEsetting
Example output
Minimal (no configuration):
{
"mcp_version": "2025-06-18",
"name": "My Shop MCP Server",
"endpoint": "https://myshop.com/mcp/",
"transport": "http",
"auth": { "required": false, "methods": ["none"] },
"capabilities": ["tools", "resources"],
"languages": ["it"],
"last_updated": "2026-03-26T00:00:00+00:00",
"crawl": true
}
With trust_class = 'enterprise' and bearer auth:
{
"mcp_version": "2025-06-18",
"name": "My Shop MCP Server",
"endpoint": "https://myshop.com/mcp/",
"transport": "http",
"auth": {
"required": true,
"methods": ["bearer"],
"endpoint": "https://auth.myshop.com/token"
},
"capabilities": ["tools", "resources"],
"trust_class": "enterprise",
"categories": ["e-commerce"],
"languages": ["it"],
"last_updated": "2026-03-26T00:00:00+00:00",
"crawl": true
}
Security
- Endpoint domain validation — custom endpoint MUST be on same domain or subdomain. Invalid endpoints fall back to default. (draft-04 Section 6.8)
- trust_class validation —
regulatedrequiresCOMPLIANCE.jurisdiction;sandboxauto-generatesexpiresfield. (draft-04)
Changelog
v0.4.0
- Implements draft-serra-mcp-discovery-uri-04
authfield restructured:{'required': bool, 'methods': [...]}with optionalendpointandscopes- Retrocompatible:
AUTH = 'none'string shorthand still works - New
trust_classfield:public | sandbox | enterprise | regulated sandbox: auto-generatesexpiresfromEXPIRES_DAYSregulated: requiresCOMPLIANCE.jurisdiction, addscompliance,logging,cache_ttl- New
cache_ttlfield (MAY) for all trust classes
v0.3.0
- Added
tools_preview,resources_preview,prompts_previewfields (draft-03 Section 6.10) - Use a list for static previews, or 'dynamic' for dynamic ones
v0.2.0
- Security: endpoint domain validation (Section 6.8)
- Security:
expiresfield withEXPIRES_DAYSsetting (Section 6.9)
v0.1.0
- Initial release
Links
- mcpstandard.dev — specification
- IETF Draft -04
- GitHub Discussion #2462
- WordPress plugin
Author
Mumble Group — Milan, Italy — support@mumble.group
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_mcp_discovery-0.4.0.tar.gz.
File metadata
- Download URL: django_mcp_discovery-0.4.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3c5f7d53af0557bfcf0881b22befcbd7b3f7b71b7b24451fc28bd65e88945fc
|
|
| MD5 |
47ce40d9ca9476654be40066a6036479
|
|
| BLAKE2b-256 |
e56b9f7b882751861fda8cb6964798e8cd6141261d8d840615930999466c919c
|
File details
Details for the file django_mcp_discovery-0.4.0-py3-none-any.whl.
File metadata
- Download URL: django_mcp_discovery-0.4.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d7218bb48e97f63866361efd283b7b98788599dadf3b7f32a71a843aece1a9
|
|
| MD5 |
63e2a81f00533499fd49527698fe5309
|
|
| BLAKE2b-256 |
fc42654fb412f7379415531eb6bdd4c168f5fd01a00c26f58da4aad651126c47
|