@@ -361,30 +361,41 @@ async def get_pipedream_apps(
361361 logger .info (f"Fetching Pipedream apps registry, page: { page } " )
362362
363363 try :
364- import httpx
364+ from pipedream .client import get_pipedream_client
365+
366+ # Use the authenticated Pipedream client
367+ client = get_pipedream_client ()
368+ access_token = await client ._obtain_access_token ()
369+
370+ # Use the proper Pipedream API endpoint with authentication
371+ url = f"{ client .base_url } /apps"
372+ headers = {
373+ "Authorization" : f"Bearer { access_token } " ,
374+ "Content-Type" : "application/json"
375+ }
376+
377+ params = {}
378+ if search :
379+ params ["q" ] = search # Pipedream API uses 'q' for search
380+ if page > 1 :
381+ # Pipedream API uses cursor-based pagination, not page numbers
382+ # For now, we'll just return the first page
383+ logger .warning (f"Page { page } requested, but Pipedream API uses cursor-based pagination. Returning first page." )
384+
385+ session = await client ._get_session ()
386+ response = await session .get (url , headers = headers , params = params )
387+ response .raise_for_status ()
388+
389+ data = response .json ()
390+
391+ logger .info (f"Successfully fetched { len (data .get ('data' , []))} apps from Pipedream registry" )
392+ return {
393+ "success" : True ,
394+ "apps" : data .get ("data" , []),
395+ "page_info" : data .get ("page_info" , {}),
396+ "total_count" : data .get ("page_info" , {}).get ("total_count" , 0 )
397+ }
365398
366- async with httpx .AsyncClient () as client :
367- url = f"https://mcp.pipedream.com/api/apps"
368- params = {"page" : page }
369-
370- if search :
371- params ["search" ] = search
372- if category :
373- params ["category" ] = category
374-
375- response = await client .get (url , params = params , timeout = 30.0 )
376- response .raise_for_status ()
377-
378- data = response .json ()
379-
380- logger .info (f"Successfully fetched { len (data .get ('data' , []))} apps from Pipedream registry" )
381- return {
382- "success" : True ,
383- "apps" : data .get ("data" , []),
384- "page_info" : data .get ("page_info" , {}),
385- "total_count" : data .get ("page_info" , {}).get ("total_count" , 0 )
386- }
387-
388399 except Exception as e :
389400 logger .error (f"Failed to fetch Pipedream apps: { str (e )} " )
390401 raise HTTPException (
0 commit comments