Add auth_route parameter to SupabaseProvider (#2760)

Co-authored-by: Eloi Zalczer <eloi@entropia.io>
This commit is contained in:
Jeremiah Lowin 2025-12-26 16:23:41 -05:00 committed by GitHub
commit 6bade1cbd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 8 deletions

View file

@ -40,12 +40,14 @@ class TestSupabaseProvider:
{
"FASTMCP_SERVER_AUTH_SUPABASE_PROJECT_URL": "https://env123.supabase.co",
"FASTMCP_SERVER_AUTH_SUPABASE_BASE_URL": "https://envserver.com",
"FASTMCP_SERVER_AUTH_SUPABASE_AUTH_ROUTE": "/custom/auth/route",
},
):
provider = SupabaseProvider()
assert provider.project_url == "https://env123.supabase.co"
assert str(provider.base_url) == "https://envserver.com/"
assert provider.auth_route == "custom/auth/route"
def test_environment_variable_loading(self):
"""Test that environment variables are loaded correctly."""
@ -150,6 +152,28 @@ class TestSupabaseProvider:
assert provider.token_verifier.algorithm == "RS256" # type: ignore[attr-defined]
def test_custom_auth_route(self):
provider = SupabaseProvider(
project_url="https://abc123.supabase.co",
base_url="https://myserver.com",
auth_route="/custom/auth/route",
)
assert provider.auth_route == "custom/auth/route"
assert (
provider.token_verifier.jwks_uri
== "https://abc123.supabase.co/custom/auth/route/.well-known/jwks.json"
) # type: ignore[attr-defined]
def test_custom_auth_route_trailing_slash(self):
provider = SupabaseProvider(
project_url="https://abc123.supabase.co",
base_url="https://myserver.com",
auth_route="/custom/auth/route/",
)
assert provider.auth_route == "custom/auth/route"
def run_mcp_server(host: str, port: int) -> None:
mcp = FastMCP(