π The fast, Pythonic way to build MCP servers and clients.
Lazy import DiskStore to avoid sqlite3 dependency on import (#2784)
Jeremiah Lowinad50f73bdcad
diff --git a/src/fastmcp/server/auth/oauth_proxy.py b/src/fastmcp/server/auth/oauth_proxy.pyindex 21b2d09cd..3617d9d7d 100644--- a/src/fastmcp/server/auth/oauth_proxy.py+++ b/src/fastmcp/server/auth/oauth_proxy.py@@ -34,7 +34,6 @@ from authlib.integrations.httpx_client import AsyncOAuth2Clientfrom cryptography.fernet import Fernetfrom key_value.aio.adapters.pydantic import PydanticAdapterfrom key_value.aio.protocols import AsyncKeyValue-from key_value.aio.stores.disk import DiskStorefrom key_value.aio.wrappers.encryption import FernetEncryptionWrapperfrom mcp.server.auth.provider import (AccessToken,@@ -812,6 +811,9 @@ class OAuthProxy(OAuthProvider):# If the user does not provide a store, we will provide an encrypted disk storeif client_storage is None:+ # Import lazily to avoid sqlite3 dependency when not using OAuthProxy+ from key_value.aio.stores.disk import DiskStore+storage_encryption_key = derive_jwt_key(high_entropy_material=jwt_signing_key.decode(),salt="fastmcp-storage-encryption-key",