Skip to main content

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-03.

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 = {
    'NAME':             'My Site MCP Server',
    'ENDPOINT':         'https://mysite.com/mcp/',
    'DESCRIPTION':      'Natural language description of the server',
    'AUTH':             'none',         # none | apikey | oauth2
    'CAPABILITIES':     ['tools', 'resources'],
    'CATEGORIES':       ['e-commerce', 'fashion'],
    'LANGUAGES':        ['it', 'en'],
    'CONTACT':          'api@mysite.com',
    'DOCS':             'https://mysite.com/mcp/docs/',
    'EXPIRES_DAYS':     90,             # manifest expiry in days
    'CRAWL':            True,           # False to opt out of indexing

    # Optional — primitive previews (draft-03 Section 6.10)
    # Use a list for static tools, or 'dynamic' for dynamic ones
    '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.sites or SITE_NAME setting
  • Endpoint — from SITE_URL or first non-localhost ALLOWED_HOSTS
  • Language — from LANGUAGE_CODE setting

Example output

Minimal (no configuration):

{
  "mcp_version": "2025-06-18",
  "name": "My Shop MCP Server",
  "endpoint": "https://myshop.com/mcp/",
  "transport": "http",
  "auth": { "type": "none" },
  "capabilities": ["tools", "resources"],
  "languages": ["it"],
  "last_updated": "2026-03-25T00:00:00+00:00",
  "expires": "2026-09-23T00:00:00+00:00",
  "crawl": true
}

With tools_preview (draft-03 Section 6.10):

{
  "mcp_version": "2025-06-18",
  "name": "My Shop MCP Server",
  "endpoint": "https://myshop.com/mcp/",
  "transport": "http",
  "auth": { "type": "none" },
  "capabilities": ["tools", "resources"],
  "categories": ["e-commerce"],
  "languages": ["it"],
  "expires": "2026-09-23T00:00:00+00:00",
  "crawl": true,
  "tools_preview": [
    {
      "name": "search_products",
      "description": "Search products by category and material"
    },
    {
      "name": "check_stock",
      "description": "Check real-time warehouse availability"
    }
  ],
  "resources_preview": "dynamic",
  "prompts_preview": "dynamic"
}

Security

  • Endpoint domain validation — custom endpoint MUST be on same domain or subdomain. Invalid endpoints fall back to default. (draft-03 Section 6.8)
  • Expires field — manifest declares its own expiry date. (draft-03 Section 6.9)

Changelog

v0.3.0

  • Added tools_preview, resources_preview, prompts_preview fields (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: expires field with EXPIRES_DAYS setting (Section 6.9)

v0.1.0

  • Initial release

Links

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

django_mcp_discovery-0.4.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

django_mcp_discovery-0.4.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file django_mcp_discovery-0.4.3.tar.gz.

File metadata

  • Download URL: django_mcp_discovery-0.4.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for django_mcp_discovery-0.4.3.tar.gz
Algorithm Hash digest
SHA256 7ad1d1ce84a5f67bca33444c10858e67067cfc58640d6764eb3577e80cf31d0c
MD5 805057988b2728688e487207f85493f2
BLAKE2b-256 ce3a179e61b388128eac490f0fb4a5d273ea47a6108e8f33a3741588f346db1f

See more details on using hashes here.

File details

Details for the file django_mcp_discovery-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_mcp_discovery-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b48236351653bc28b7b48c5ea7950ce68daa3bf6f73fd591c8bd718cf26e51c6
MD5 6358ac0705f4c1e2b5c78a9507ed0c27
BLAKE2b-256 48233582734678b4782c0ebf32b2cbe29e14d1e12efb4dcbf4abe158efe27dd3

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