连接你的智能体
服务器地址:https://asi.express/mcp。传输方式:Streamable HTTP(POST,JSON 响应)。无需登录,无需密钥。
第一次调用:使用 {"query": "weather", "limit": 3} 调用 search_capabilities。它返回 results(最多 3 个能力的列表)、count(一个数字)和一行状态信息。无需先阅读其他工具。
于 2026-11-22 在生产环境中测试,所用库版本见各节说明。
来自其他提供方的工具属于第三方:在让你的智能体运行某个工具之前,先阅读它会做什么;对于会执行操作的工具,不要设置“始终允许”。
Python, MCP SDK (mcp 1.30.0)
import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
async with streamablehttp_client("https://asi.express/mcp") as (r, w, _):
async with ClientSession(r, w) as s:
await s.initialize()
print([t.name for t in (await s.list_tools()).tools])
res = await s.call_tool("search_capabilities", {"query": "weather", "limit": 3})
print(res.structuredContent["count"], len(res.structuredContent["results"]))
asyncio.run(main())预期结果: 11 个工具名称(包括 search_capabilities),然后是一个计数和最多 3 个结果。
OpenAI Agents SDK (openai-agents 0.25.0)
连接和列出工具不需要 OpenAI 密钥;运行模型则需要。设置密钥后,tracing 会将数据发送给第三方:如果你不希望这样,请设置 OPENAI_AGENTS_DISABLE_TRACING=1。
import asyncio
from agents.mcp import MCPServerStreamableHttp
async def main():
async with MCPServerStreamableHttp(name="asi", params={"url": "https://asi.express/mcp"},
cache_tools_list=True, client_session_timeout_seconds=30) as srv:
print([t.name for t in await srv.list_tools()])
res = await srv.call_tool("search_capabilities", {"query": "weather", "limit": 3})
print(res.structuredContent["count"])
asyncio.run(main())将服务器交给智能体:Agent(name="x", mcp_servers=[srv])。测试未运行模型;已验证的是上述连接、列出和调用。
LangChain / LangGraph (langchain-mcp-adapters 0.3.2)
import asyncio, json
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_mcp_adapters.tools import load_mcp_tools
async def main():
client = MultiServerMCPClient({"asi": {"transport": "streamable_http", "url": "https://asi.express/mcp"}})
async with client.session("asi") as s:
tools = await load_mcp_tools(s)
tool = [t for t in tools if t.name == "search_capabilities"][0]
out = await tool.ainvoke({"query": "weather", "limit": 3})
text = out[0]["text"] if isinstance(out, list) else out # the JSON is the FIRST text item; a status line follows
print(json.loads(text)["count"])
asyncio.run(main())响应包含两个文本项:先是 JSON,然后是一行状态信息。只解析第一个。
LlamaIndex (llama-index-tools-mcp 0.4.8)
import asyncio
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
async def main():
client = BasicMCPClient("https://asi.express/mcp") # a URL ending /mcp = Streamable HTTP
tools = await McpToolSpec(client=client, allowed_tools=["search_capabilities"]).to_tool_list_async()
res = await client.call_tool("search_capabilities", {"query": "weather", "limit": 3})
print(res.structuredContent["count"])
asyncio.run(main())CrewAI (crewai 1.6.1 with mcpadapt 0.1.20)
已通过 CrewAI 自带的 MCPServerAdapter 所封装的 MCP 适配器验证。crewai_tools 本身无法在测试计算机上加载,因此不对该封装类作任何声明。
from mcpadapt.core import MCPAdapt
from mcpadapt.crewai_adapter import CrewAIAdapter
with MCPAdapt({"url": "https://asi.express/mcp", "transport": "streamable-http"}, CrewAIAdapter(), 30) as tools:
print([t.name for t in tools]) # check the list is not empty: a failed server is skipped quietly
search = [t for t in tools if t.name.endswith("search_capabilities")][0]
print(search.run(query="weather", limit=3))请检查工具列表不为空:失败的服务器会被静默跳过。
Plain HTTP (curl)
curl -sS -X POST https://asi.express/mcp \
-H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_capabilities","arguments":{"query":"weather","limit":3}}}'已验证的顺序:initialize, notifications/initialized, tools/list,然后是上面的调用。服务器不保留会话,因此不需要 Mcp-Session-Id 请求头。单独发送该调用也会被接受;添加 -m 30 可限制等待时间。
Claude Code (claude 2.1.330)
将以下内容保存为文件,例如 asi-mcp.json:
{"mcpServers": {"asi": {"type": "http", "url": "https://asi.express/mcp"}}}然后用 claude --mcp-config asi-mcp.json 启动 Claude Code。asi 服务器会显示为已连接,其工具显示为 mcp__asi__search_capabilities 等。
此方式已于 2026-11-22 在生产环境中测试。
在项目的 .mcp.json 文件中写入相同条目,或使用 claude mcp add --transport http asi https://asi.express/mcp 添加,应该也可行(Claude Code 会要求你批准项目服务器)。我们尚未在生产环境中测试这些方式。
其他客户端只有在通过生产环境测试后才会添加到这里。