Athena Agent
Athena Agent — 实时地震数据流
一个由 MCP 服务器支撑的 Athena AI 代理。它从 USGS 公共数据流中拉取真实地震读数,并在聊天中将其渲染到交互式小部件中。
运行
npm install
npm start # http://localhost:8787/mcp在使用 Athena 之前,请先验证:
npx @modelcontextprotocol/inspector@latest --server-url http://localhost:8787/mcp --transport http你应该会看到一个工具 get_recent_earthquakes 和一个资源 ui://widget/quakes.html,其 mimeType 为 text/html+skybridge。
Related MCP server: usgs-earthquakes
通过 HTTPS 暴露
Athena 需要 HTTPS。开发时:
ngrok http 8787在 https://athenachat.bot/chatbot/mybots/create 注册该代理,并将 MCP URL 设置为 https://<your-subdomain>.ngrok.app/mcp — /mcp 路径是必需的。
若需要一个在演示结束后依然有效的 URL,请推送此仓库并部署到 Render 或 Railway。构建命令为 npm install,启动命令为 npm start。两者都会注入 PORT,服务器会读取该变量。
触发该工具的提示词
"显示最近的地震"
"今天有地震活动吗?"
"过去一周有大地震吗?"
是什么让小部件具有交互性
控件 | 行为 |
震级滑块 | 在浏览器中即时筛选,不调用服务器 |
点击行 | 展开深度、坐标、海啸标志 |
时间窗口按钮 | 通过 |
重新渲染后,状态通过 window.openai.setWidgetState 得以保留。
将此适配到其他数据源
有两处需要修改,代码中均已标记。
server.js—fetchData函数。返回{ items: [...], meta: {...} }。 同时更新工具名称、描述和inputSchema,以匹配新的领域。public/widget.html—render函数,以及两个控件处理程序。
其余一切(传输、资源注册、CORS、元数据)均与领域无关。
会浪费你时间的事情
window.openai未定义 → 资源的 mimeType 不完全是text/html+skybridge。callTool无任何效果 → 该工具缺少_meta["openai/widgetAccessible"]: true。小部件无法直接获取 API 数据 → iframe 的 CSP 会阻止该操作。请在服务端获取。
Athena 仍然显示旧工具 → Settings → Connectors → Refresh。
Athena 的文档导入的是
@modelcontextprotocol/sdk/server/streamable-http.js。 该路径不存在。正确的是streamableHttp.js。
Related MCP Connectors
Live USGS earthquake data: latest quakes, quakes near a US place, and was that an earthquake?
Real-time earthquake events from the US Geological Survey
Recent earthquakes worldwide or near a place, from USGS. Free, no key.
Search USGS and EMSC seismic data — real-time feeds, event queries, and earthquake counts.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides access to the USGS Quakes API within Claude Desktop, enabling users to retrieve earthquake data and details through natural language queries.318 npm1MIT
- AlicenseNot gradedqualityBmaintenanceProvides access to the USGS Earthquake Catalog for querying earthquake events via the FDSNWS API, enabling natural language questions about earthquake data.198 npmMIT
- AlicenseAqualityDmaintenanceReal-time earthquake data and seismic monitoring for AI agents via the USGS Earthquake Catalog API.8MIT
- FlicenseNot gradedqualityCmaintenanceEnables users to explore live earthquake data from USGS, with an interactive widget for filtering and visualizing seismic events worldwide.-