fix mcp connection error for tools

This commit is contained in:
Saumya 2025-07-31 09:18:31 +05:30
parent 1f73aa25ef
commit 1701eb421c
2 changed files with 6 additions and 10 deletions

View File

@ -65,9 +65,7 @@ class CustomMCPHandler:
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
http_client = connection_service._http_client
access_token = await http_client._ensure_access_token()
access_token = await connection_service._ensure_access_token()
project_id = os.getenv("PIPEDREAM_PROJECT_ID")
environment = os.getenv("PIPEDREAM_X_PD_ENVIRONMENT", "development")
@ -80,8 +78,8 @@ class CustomMCPHandler:
"x-pd-app-slug": app_slug,
}
if http_client.rate_limit_token:
headers["x-pd-rate-limit"] = http_client.rate_limit_token
if hasattr(connection_service, 'rate_limit_token') and connection_service.rate_limit_token:
headers["x-pd-rate-limit"] = connection_service.rate_limit_token
if oauth_app_id:
headers["x-pd-oauth-app-id"] = oauth_app_id

View File

@ -69,9 +69,7 @@ class MCPToolExecutor:
import os
from pipedream import connection_service
http_client = connection_service._http_client
access_token = await http_client._ensure_access_token()
access_token = await connection_service._ensure_access_token()
project_id = os.getenv("PIPEDREAM_PROJECT_ID")
environment = os.getenv("PIPEDREAM_X_PD_ENVIRONMENT", "development")
@ -84,8 +82,8 @@ class MCPToolExecutor:
"x-pd-app-slug": app_slug,
}
if http_client.rate_limit_token:
headers["x-pd-rate-limit"] = http_client.rate_limit_token
if hasattr(connection_service, 'rate_limit_token') and connection_service.rate_limit_token:
headers["x-pd-rate-limit"] = connection_service.rate_limit_token
if oauth_app_id:
headers["x-pd-oauth-app-id"] = oauth_app_id