mcp protocol bridge for django applications
Implements the Model Context Protocol specification as a Django extension, translating between standardized MCP protocol messages (tools, resources, prompts) and Django application functionality. Uses a layered architecture with transport abstraction (HTTP/STDIO), session management, and a metaclass-based tool registry that auto-discovers and registers tools during application startup. Enables any MCP-compatible client (Claude AI, Google ADK, custom agents) to invoke Django operations through typed tool interfaces.
Unique: Implements MCP as a first-class Django extension with metaclass-based auto-discovery and multi-transport support (HTTP/STDIO), rather than bolting MCP onto existing REST APIs. Provides four declarative tool definition patterns (MCPToolset, ModelQueryToolset, DRF Integration, Low-Level API) that map directly to Django's ORM and view patterns.
vs alternatives: Tighter Django integration than generic MCP servers; auto-discovers tools from Django models and views without manual registration, and supports both WSGI and ASGI without code changes.
declarative tool registration via mcptoolset pattern
Provides a metaclass-based tool registration system where developers define tools by subclassing MCPToolset and decorating methods with @mcp_tool. The metaclass automatically discovers decorated methods at class definition time, extracts type hints and docstrings to generate MCP-compatible schemas, and registers tools in a central registry. Tools are exposed to MCP clients with full type information, parameter validation, and automatic serialization of return values.
Unique: Uses Python metaclasses to auto-discover and register tools at class definition time, extracting schemas from type hints and docstrings without requiring separate schema files or configuration. Integrates directly with Django's import system for zero-configuration tool discovery.
vs alternatives: Simpler than manual schema definition (vs. Anthropic's tool_use API) and more Pythonic than JSON-based tool registries; leverages Python's type system for automatic validation and serialization.
mcp_inspect command-line tool for local development and testing
Provides a Django management command (mcp_inspect) that introspects the MCP server configuration and registered tools during local development. Displays tool schemas, parameters, descriptions, and authentication requirements in human-readable format. Enables developers to test tool invocation locally without connecting an MCP client, simulating tool calls with custom parameters and inspecting results. Supports schema validation and debugging of tool definitions.
Unique: Provides a Django management command for local inspection and testing of MCP tools without requiring an MCP client, enabling rapid development iteration.
vs alternatives: More convenient than connecting an MCP client for development; integrates with Django's management command system for familiar developer experience.
permission and access control enforcement per tool
Enforces Django permission checks on a per-tool basis, integrating with Django's permission system to restrict tool access based on user roles and permissions. Tools can declare required permissions through configuration or decorators, and the framework validates user permissions before tool execution. Supports both model-level permissions (add, change, delete) and custom permission definitions. Permission checks are enforced at the transport layer (HTTP) and during tool execution, with proper error responses for unauthorized access.
Unique: Integrates Django's permission system with MCP tool execution, enforcing per-tool permission checks based on user roles and custom permissions. Supports both model-level and custom permissions.
vs alternatives: Leverages Django's mature permission system vs. building custom auth; enables fine-grained access control without additional infrastructure.
multiple mcp server instances with isolated tool registries
Supports running multiple independent MCP server instances within a single Django application, each with its own isolated tool registry and configuration. Enables different MCP servers to expose different tool collections to different client groups (e.g., admin tools vs. user tools). Each server instance maintains separate authentication, permission, and session configuration. Multiple servers can coexist in the same Django application through separate URL routes or STDIO processes.
Unique: Supports multiple independent MCP server instances with isolated tool registries and configurations within a single Django application, enabling tool segmentation by client group or access level.
vs alternatives: More flexible than single-server deployments; enables fine-grained tool access control without running separate applications.
orm-aware query tool generation via modelquerytoolset
Automatically generates MCP tools from Django ORM models by subclassing ModelQueryToolset and specifying a model class. The system introspects model fields, relationships, and querysets to generate parameterized query tools (list, filter, get, create, update, delete) with schema validation. Implements a query DSL that translates MCP tool parameters into Django ORM calls, with support for filtering, pagination, ordering, and field selection. Handles serialization of model instances to JSON via Django REST Framework serializers.
Unique: Introspects Django ORM models to auto-generate parameterized query tools with schema validation, supporting filtering, pagination, and ordering through a query DSL that translates to Django ORM calls. Integrates with DRF serializers for automatic model-to-JSON conversion.
vs alternatives: Eliminates manual view/serializer creation for model exposure vs. building custom REST endpoints; schema generation from model fields is more maintainable than hardcoded tool definitions.
django rest framework view publishing as mcp tools
Provides decorators and publishing functions that expose existing Django REST Framework views as MCP tools without modifying view code. Introspects DRF view classes to extract serializer schemas, HTTP methods, and permission classes, then generates MCP tool schemas that map to view endpoints. Handles request/response translation between MCP protocol and DRF's request/response objects, including authentication token injection and permission enforcement.
Unique: Introspects DRF views and serializers to auto-generate MCP tool schemas, enabling existing REST APIs to be exposed as MCP tools without code changes. Handles request/response translation and permission enforcement transparently.
vs alternatives: Avoids code duplication vs. building parallel MCP and REST interfaces; leverages DRF's mature serialization and permission system for tool validation.
multi-transport mcp server deployment (http and stdio)
Supports both HTTP and STDIO transports for MCP protocol communication, allowing deployment in different environments without code changes. HTTP transport runs as a Django view (MCPServerStreamableHttpView) integrated into URL routing, supporting both WSGI and ASGI application servers. STDIO transport enables local/containerized deployments where the MCP server communicates via standard input/output streams. Transport abstraction layer handles protocol message serialization, session management, and error handling uniformly across both transports.
Unique: Provides unified transport abstraction supporting both HTTP (cloud-native) and STDIO (local/containerized) deployments without code changes. HTTP transport integrates as a Django view with full WSGI/ASGI compatibility; STDIO transport enables local development and containerized deployments.
vs alternatives: More flexible than single-transport MCP servers; WSGI/ASGI support enables deployment on any Django-compatible platform without framework-specific code.
+5 more capabilities