Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: oauth prod environment variables
jnjpng60a0a5264de1
diff --git a/letta/server/rest_api/routers/v1/tools.py b/letta/server/rest_api/routers/v1/tools.pyindex d2f8de469..b7c16159d 100644--- a/letta/server/rest_api/routers/v1/tools.py+++ b/letta/server/rest_api/routers/v1/tools.py@@ -1,5 +1,6 @@import asyncioimport json+import osfrom collections.abc import AsyncGeneratorfrom typing import Any, Dict, List, Optional, Union@@ -40,7 +41,7 @@ from letta.server.server import SyncServerfrom letta.services.mcp.oauth_utils import MCPOAuthSession, create_oauth_provider, drill_down_exception, oauth_stream_eventfrom letta.services.mcp.stdio_client import AsyncStdioMCPClientfrom letta.services.mcp.types import OauthStreamEvent-from letta.settings import settings, tool_settings+from letta.settings import tool_settingsrouter = APIRouter(prefix="/tools", tags=["tools"])@@ -754,7 +755,7 @@ async def connect_mcp_server(oauth_session = await server.mcp_manager.create_oauth_session(session_create, actor)session_id = oauth_session.id- # TODO: @jnjpng make this check more robust+ # TODO: @jnjpng make this check more robust and remove direct os.getenv# Check if request is from web frontend to determine redirect URIis_web_request = (http_request@@ -764,8 +765,8 @@ async def connect_mcp_server()logo_uri = None- NEXT_PUBLIC_CURRENT_HOST = settings.next_public_current_host- LETTA_AGENTS_ENDPOINT = settings.letta_agents_endpoint+ NEXT_PUBLIC_CURRENT_HOST = os.getenv("NEXT_PUBLIC_CURRENT_HOST")+ LETTA_AGENTS_ENDPOINT = os.getenv("LETTA_AGENTS_ENDPOINT")if is_web_request and NEXT_PUBLIC_CURRENT_HOST:redirect_uri = f"{NEXT_PUBLIC_CURRENT_HOST}/oauth/callback/{session_id}"@@ -774,6 +775,9 @@ async def connect_mcp_server(# API and SDK usage should call core server directlyredirect_uri = f"{LETTA_AGENTS_ENDPOINT}/v1/tools/mcp/oauth/callback/{session_id}"else:+ logger.error(+ f"No redirect URI found for request and base urls: {http_request} {NEXT_PUBLIC_CURRENT_HOST} {LETTA_AGENTS_ENDPOINT}"+ )raise HTTPException(status_code=400, detail="No redirect URI found")# Create OAuth provider for the instance of the stream connectiondiff --git a/letta/settings.py b/letta/settings.pyindex e34db63f6..df842d7ec 100644--- a/letta/settings.py+++ b/letta/settings.py@@ -271,10 +271,6 @@ class Settings(BaseSettings):# for OCRmistral_api_key: Optional[str] = None- # OAuth redirect URLs- letta_agents_endpoint: Optional[str] = os.getenv("LETTA_AGENTS_ENDPOINT")- next_public_current_host: Optional[str] = os.getenv("NEXT_PUBLIC_CURRENT_HOST")-# LLM request timeout settings (model + embedding model)llm_request_timeout_seconds: float = Field(default=60.0, ge=10.0, le=1800.0, description="Timeout for LLM requests in seconds")llm_stream_timeout_seconds: float = Field(default=60.0, ge=10.0, le=1800.0, description="Timeout for LLM streaming requests in seconds")