Skip to main content

Python (MCP SDK) を aicharged.io に接続

215個のツール、1つのエンドポイント: 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クライアントを検出し、ブラウザ経由でサインインして、その設定を書き込みます。

1行で接続

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 (新しいタブで開きます)