15 lines
674 B
Python
15 lines
674 B
Python
import os
|
|
import logging
|
|
from mcp.client.streamable_http import streamablehttp_client
|
|
from strands.tools.mcp.mcp_client import MCPClient
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
|
|
def get_streamable_http_mcp_client() -> MCPClient:
|
|
"""Returns an MCP Client compatible with Strands"""
|
|
# to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
|
|
return MCPClient(lambda: streamablehttp_client(EXAMPLE_MCP_ENDPOINT))
|