@@ -78,6 +78,9 @@ class Settings(BaseSettings, Generic[LifespanResultT]):
7878 For example, FASTMCP_DEBUG=true will set debug=True.
7979 """
8080
81+ # TODO: Multi-tenancy - Settings are loaded from environment variables without tenant scoping.
82+ # For multi-tenant deployments, need to support tenant-specific configuration overrides,
83+ # potentially loading from tenant-scoped config sources (e.g., database, per-tenant env files).
8184 model_config = SettingsConfigDict (
8285 env_prefix = "FASTMCP_" ,
8386 env_file = ".env" ,
@@ -198,6 +201,10 @@ def __init__( # noqa: PLR0913
198201 # We need to create a Lifespan type that is a generic on the server type, like Starlette does.
199202 lifespan = (lifespan_wrapper (self , self .settings .lifespan ) if self .settings .lifespan else default_lifespan ), # type: ignore
200203 )
204+ # TODO: Multi-tenancy - These managers maintain shared state across all tenants.
205+ # Need to either: (1) make managers tenant-aware by accepting tenant_id in all operations,
206+ # or (2) create separate manager instances per tenant with tenant-scoped storage.
207+ # Tools, resources, and prompts registered should be scoped to tenant context.
201208 self ._tool_manager = ToolManager (tools = tools , warn_on_duplicate_tools = self .settings .warn_on_duplicate_tools )
202209 self ._resource_manager = ResourceManager (warn_on_duplicate_resources = self .settings .warn_on_duplicate_resources )
203210 self ._prompt_manager = PromptManager (warn_on_duplicate_prompts = self .settings .warn_on_duplicate_prompts )
@@ -210,15 +217,23 @@ def __init__( # noqa: PLR0913
210217 elif auth_server_provider or token_verifier :
211218 raise ValueError ("Cannot specify auth_server_provider or token_verifier without auth settings" )
212219
220+ # TODO: Multi-tenancy - Auth providers and token verifiers are shared across all tenants.
221+ # Need to support tenant-specific auth configurations, or at minimum ensure tokens
222+ # include tenant_id claims that are validated. AccessToken should include tenant_id field.
213223 self ._auth_server_provider = auth_server_provider
214224 self ._token_verifier = token_verifier
215225
216226 # Create token verifier from provider if needed (backwards compatibility)
217227 if auth_server_provider and not token_verifier :
218228 self ._token_verifier = ProviderTokenVerifier (auth_server_provider )
229+ # TODO: Multi-tenancy - Event store is shared across tenants. Events should be
230+ # scoped by tenant_id to prevent cross-tenant data leakage in resumable sessions.
219231 self ._event_store = event_store
220232 self ._custom_starlette_routes : list [Route ] = []
221233 self .dependencies = self .settings .dependencies
234+ # TODO: Multi-tenancy - Session manager tracks sessions globally without tenant scoping.
235+ # Sessions should be partitioned by tenant_id to isolate tenant data and prevent
236+ # cross-tenant session access. Consider tenant_id as part of session key.
222237 self ._session_manager : StreamableHTTPSessionManager | None = None
223238
224239 # Set up MCP protocol handlers
0 commit comments