|
12 | 12 | import time |
13 | 13 | from typing import Optional |
14 | 14 |
|
15 | | -from pydantic import AnyHttpUrl |
16 | 15 | from starlette.routing import Route |
17 | 16 | from fastmcp.server.auth.providers.google import GoogleProvider |
18 | 17 | from fastmcp.server.auth import AccessToken |
@@ -50,8 +49,8 @@ def __init__( |
50 | 49 | # Store credentials as they're not exposed by parent class |
51 | 50 | self._client_id = client_id |
52 | 51 | self._client_secret = client_secret |
53 | | - if self._resource_server_url: |
54 | | - self.resource_server_url = AnyHttpUrl(self._resource_server_url) |
| 52 | + # Store as string - Pydantic validates it when passed to models |
| 53 | + self.resource_server_url = self._resource_server_url |
55 | 54 |
|
56 | 55 | async def verify_token(self, token: str) -> Optional[AccessToken]: |
57 | 56 | """ |
@@ -143,9 +142,10 @@ def get_routes(self, **kwargs) -> list[Route]: |
143 | 142 | return [] |
144 | 143 |
|
145 | 144 | # Create protected resource routes that point to Google as the authorization server |
| 145 | + # Pass strings directly - Pydantic validates them during model construction |
146 | 146 | protected_routes = create_protected_resource_routes( |
147 | 147 | resource_url=self.resource_server_url, |
148 | | - authorization_servers=[AnyHttpUrl(GOOGLE_ISSUER_URL)], |
| 148 | + authorization_servers=[GOOGLE_ISSUER_URL], |
149 | 149 | scopes_supported=self.required_scopes, |
150 | 150 | resource_name="Google Workspace MCP", |
151 | 151 | resource_documentation=None, |
|
0 commit comments