Skip to main content

將 Python (MCP SDK) 連接到 aicharged.io

215 個工具,單一端點:https://aicharged.io/api/v1/mcp

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())

或讓 CLI 進行設定

aicharged setup 會尋找此電腦上的 AI 用戶端,引導您透過瀏覽器登入,並寫入其設定檔。

一行指令輕鬆連接

安裝 CLI · macOS / Linux
curl -fsSL https://aicharged.io/install.sh | sh && aicharged setup
安裝 CLI · Windows
irm https://aicharged.io/install.ps1 | iex; aicharged setup
MCP 端點
https://aicharged.io/api/v1/mcp

可串流的 HTTP。傳送標頭 Authorization: Bearer <API_KEY>,或在您的用戶端支援時使用 OAuth 登入。

或告訴您的代理
閱讀 https://aicharged.io/agent.md,並幫我設定 aicharged.io

使用此提示詞開啟於 Claude (在新分頁中開啟) ChatGPT (在新分頁中開啟) Perplexity (在新分頁中開啟)