Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ Refer to this [list of clients](https://modelcontextprotocol.io/clients)

- **DJANGO_MCP_AUTHENTICATION_CLASSES** (default to no authentication) a list of reference to Django Rest Framework authentication classes to enfors in the main MCP view.
- **DJANGO_MCP_GET_SERVER_INSTRUCTIONS_TOOL** (default=True) if true a tool will be offered to obtain global instruction and tools will instruct the agent to use it, as agents do not always have the MCP server global instructions included in their system prompt.
- **DJANGO_MCP_ENDPOINT** (default="mcp") a string indicating the url endpoint used by the server. If you want it to have a trailing slash, for example, set it to "mcp/"

## Roadmap

Expand Down
4 changes: 3 additions & 1 deletion mcp_server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@


# Register MCP Server View and bypass default DRF default permission / authentication classes
base_url = getattr(settings, "DJANGO_MCP_ENDPOINT", "mcp")

urlpatterns = [
path("mcp", MCPServerStreamableHttpView.as_view(
path(base_url, MCPServerStreamableHttpView.as_view(
permission_classes=[IsAuthenticated] if getattr(settings, 'DJANGO_MCP_AUTHENTICATION_CLASSES', None) else [],
authentication_classes=[import_string(cls) for cls in getattr(settings, 'DJANGO_MCP_AUTHENTICATION_CLASSES', [])]
), name="mcp_server_streamable_http_endpoint"),
Expand Down