fix: redirect url change

This commit is contained in:
Novice 2025-05-28 13:55:26 +08:00
parent 1a7242abd4
commit 2e4dfbd60f
2 changed files with 5 additions and 3 deletions

View File

@ -59,6 +59,7 @@ def start_authorization(
metadata: Optional[OAuthMetadata],
client_information: OAuthClientInformation,
redirect_url: str,
provider_id: str,
) -> tuple[str, str]:
"""Begins the authorization flow."""
response_type = "code"
@ -84,7 +85,7 @@ def start_authorization(
"code_challenge": code_challenge,
"code_challenge_method": code_challenge_method,
"redirect_uri": redirect_url,
"state": "/tools?provider_id=" + client_information.client_id,
"state": provider_id,
}
authorization_url = f"{authorization_url}?{urllib.parse.urlencode(params)}"
@ -229,6 +230,7 @@ def auth(
metadata,
client_information,
provider.redirect_url,
provider.provider_id,
)
provider.save_code_verifier(code_verifier)

View File

@ -31,7 +31,7 @@ class MCPToolManageService:
@staticmethod
def create_mcp_provider(
tenant_id: str, name: str, server_url: str, user_id: str, icon: str, icon_type: str, icon_background: str
) -> dict:
) -> ToolProviderApiEntity:
existing_provider = (
db.session.query(MCPToolProvider)
.filter(
@ -58,7 +58,7 @@ class MCPToolManageService:
)
db.session.add(mcp_tool)
db.session.commit()
return {"result": "success"}
return ToolTransformService.mcp_provider_to_user_provider(mcp_tool)
@staticmethod
def retrieve_mcp_tools(tenant_id: str) -> list[ToolProviderApiEntity]: