Python (MCP SDK)
அதிகாரப்பூர்வ Python MCP SDK (v1): Authorization ஹெடருடன் Streamable HTTP கிளையண்ட்.
- API விசை (Bearer)
தொகுப்பை நிறுவவும்
pip install "mcp<2"
கிளையண்ட் குறியீடு
பரிந்துரைக்கப்படுகிறதுimport asyncio, os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
headers = {"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"}
async with streamablehttp_client("https://aicharged.io/api/v1/mcp", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
print([tool.name for tool in tools.tools])
print(await session.call_tool("list_runs", {}))
asyncio.run(main())