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.2.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.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_mcp_discovery-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8c09a958b0b2768c281b5fa1044d99085d0ab5ff82c7dd9e214f374de76ff23b
MD5 a901a85dced4b19196c21917472ced33
BLAKE2b-256 3a679498030173cdcf89e6d9883a5b777385b04c954aa5c869123212e8dbde00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_mcp_discovery-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8f89f5455ef38748f9d75c1bc6bb6ae8049e46d9288cd6d7e3bfded2ea2cf92b
MD5 73122ff41f4727859be1dbc2fcf832b6
BLAKE2b-256 938f981fe190e897f66c70e51a37cfe1d0fc0065080b065432b11b3a0f81597a

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