smolagents
Hugging Face smolagents: MCPClient qua streamable-http; tài liệu của nó không nêu trường headers.
- Khóa API (Bearer)
Mã client
Khuyên dùngimport os
from smolagents import MCPClient
server = {
"url": "https://aicharged.io/api/v1/mcp",
"transport": "streamable-http",
"headers": {"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"},
}
with MCPClient(server) as tools:
print([tool.name for tool in tools])
Chưa xác minh: smolagents truyền dict này cho streamablehttp_client của MCP SDK, nên headers hẳn sẽ hoạt động, nhưng tài liệu của nó không nêu trường này.
Cài đặt gói
pip install "smolagents[mcp]"