Skip to content

0.1.0

Choose a tag to compare

@BenA-SA BenA-SA released this 29 Jul 14:07
a384db8

Warning

Yanked on PyPI — broken import on a bare install. import django_stateless_mcp raised ModuleNotFoundError: No module named 'structlog' unless the optional [structlog] extra happened to be installed. Use 0.1.1.

django-stateless-mcp 0.1.0

The first release: a stateless Model Context Protocol server for Django, built
on the 2026-07-28 spec.

uv add django-stateless-mcp

Features

  • mcp_view(server) — serve an MCPServer as a stateless streamable-HTTP
    Django view, under both WSGI and ASGI. Optional OAuth bearer authentication
    via the SDK's TokenVerifier protocol, with required_scopes.
  • mcp.py autodiscovery — adding django_stateless_mcp to INSTALLED_APPS
    imports each app's mcp module at startup, so apps register tools the way
    they register admin models.
  • request_state_security() — keys the SDK's elicitation-resume encryption
    from SECRET_KEY (and SECRET_KEY_FALLBACKS), so elicitation survives a
    multi-worker deployment instead of failing when a retry lands on another
    worker.
  • django_request(ctx) — reach the authenticated Django request and ORM
    from inside a tool, with no request-spanning global state.
  • StructlogRequestLogger — optional flow-logging middleware
    (django-stateless-mcp[structlog]), one structured event per request.

Supported versions

  • Python 3.12, 3.13, 3.14
  • Django 5.2 LTS and 6.0
  • mcp 2.0.x

Verified against the spec

The official MCP conformance suite (modelcontextprotocol/conformance) runs in
CI against a live server; the full stateless-elicitation scenario set passes.

Contributors

@BenA-SA (Ben Atkinson) created django-stateless-mcp.