LangChain
LangChain: langchain[mcp] แปลงเครื่องมือของ aicharged.io เป็นเครื่องมือ LangChain ผ่าน MCPAdapter
- คีย์ 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 client
ติดตั้งแพ็กเกจ
pip install "langchain[mcp]"