LangChain
LangChain: langchain[mcp] biến các công cụ của aicharged.io thành công cụ LangChain thông qua MCPAdapter.
- Khóa API (Bearer)
Mã client
Khuyên dùngimport 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())
Gói langchain-mcp-adapters cũ không còn được bảo trì; langchain[mcp] được xây dựng trên FastMCP client.
Cài đặt gói
pip install "langchain[mcp]"