Config API¶
This module contains the configuration classes for the Litestar MCP Plugin.
MCPConfig¶
- class litestar_mcp.config.MCPConfig[source]¶
Bases:
objectConfiguration for the Litestar MCP Plugin.
The plugin uses Litestar's opt attribute to discover routes marked for MCP exposure. Server name and version are derived from the Litestar app's OpenAPI configuration.
- base_path¶
Base path for MCP API endpoints.
- include_in_schema¶
Whether to include MCP routes in OpenAPI schema generation.
- name¶
Optional override for server name. If not set, uses OpenAPI title.
- guards¶
Optional list of guards to protect MCP endpoints.
- allowed_origins¶
List of allowed Origin header values. If empty/None, all origins are accepted. When set, requests with a non-matching Origin are rejected with 403.
- auth¶
Optional OAuth 2.1 auth configuration. When set, bearer token validation is enforced on MCP endpoints.
- tasks¶
Optional task configuration or
Trueto enable the default experimental in-memory task implementation.
- property task_config: MCPTaskConfig | None¶
Return the normalized task configuration, if task support is enabled.
- __init__(base_path='/mcp', include_in_schema=False, name=None, guards=None, allowed_origins=None, include_operations=None, exclude_operations=None, include_tags=None, exclude_tags=None, auth=None, tasks=False, opt_keys=<factory>, session_store=None, session_max_idle_seconds=3600.0, sse_max_streams=10000, sse_max_idle_seconds=3600.0, _session_manager=None)¶