LangChain
LangChain: langchain[mcp] が MCPAdapter を介して aicharged.io のツールを LangChain のツールに変換します。
- API キー (Bearer)
クライアントのコード
推奨import asyncio, os
from fastmcp import Client
from langchain.mcp import MCPAdapter
async def main():
client = Client("https://aicharged.io/api/v1/mcp", auth=os.environ["AICHARGED_API_KEY"])
async with MCPAdapter(client) as adapter:
tools = await adapter.list_tools()
print([tool.name for tool in tools])
asyncio.run(main())
旧 langchain-mcp-adapters パッケージはメンテナンスされていません。langchain[mcp] は FastMCP クライアントをベースにしています。
パッケージをインストール
pip install "langchain[mcp]"