Skip to main content
Glama
solarstorm.today MCP server

solarstorm.today MCP server

by newminya

solarstorm.today MCP server

MCP Registry Registry version tests Python License: MIT Hosted

面向 AI 助手的实时空间天气。此 MCP 服务器将 NOAA SWPC 数据——行星 Kp 指数、官方 3 天地磁预报、GOES 太阳耀斑活动,以及任意纬度的极光可见度——作为四个工具暴露给你的智能体直接调用。

它运行与 solarstorm.today 相同的逻辑,因此回答与网站显示的内容一致。无需 API 密钥,无需账户,无状态。

问问你的助手: “今晚在维也纳能看到极光吗?” → 它会调用 get_aurora_visibility(48.2) 并根据 NOAA 实时数据回答。

工具

工具

返回内容

get_current_kp()

最新的行星 Kp、等级(low/moderate/high/severe)、观测到的 24 小时最大值

get_kp_forecast_3day()

未来 3 天每个日历日的最大预报 Kp(Europe/Berlin 时区的日期)

get_solar_flares_24h()

当前 GOES X 射线耀斑等级和 24 小时峰值,以及峰值时间

get_aurora_visibility(latitude)

该纬度所需的 Kp、未来 24 小时预报最大 Kp,以及通俗易懂的结论

// get_current_kp()
{
  "kp": 4.33,
  "level": "moderate",
  "time_utc": "2026-08-27T18:00:00+00:00",
  "max_24h": 5.67,
  "source": "NOAA SWPC"
}

// get_kp_forecast_3day()
{
  "days": [
    { "date": "2026-08-27", "max_kp": 5.67, "level": "high" },
    { "date": "2026-08-28", "max_kp": 4.0,  "level": "moderate" },
    { "date": "2026-08-29", "max_kp": 2.33, "level": "low" }
  ],
  "timezone": "Europe/Berlin",
  "source": "NOAA SWPC",
  "note": "Kp>=5 is a G1 geomagnetic storm on the NOAA scale."
}

// get_solar_flares_24h()
{
  "current_class": "C2.1",
  "peak_24h_class": "M6.9",
  "peak_time_utc": "2026-08-27T04:12:00Z",
  "source": "NOAA GOES (0.1-0.8 nm)"
}

// get_aurora_visibility(48.2)
{
  "latitude": 48.2,
  "kp_needed_naked_eye": 8,
  "forecast_max_kp_24h": 5.67,
  "visible_tonight": false,
  "verdict": "Unlikely: forecast max Kp 5.7 is 2.3 below the ~Kp 8 needed at 48.2°. A camera picks aurora up roughly one Kp level earlier.",
  "details": "https://solarstorm.today/aurora-tonight/"
}

来自 NOAA 的网络或格式错误会以 error 字段返回。服务器绝不会因上游响应异常而崩溃。

Related MCP server: spaceweather-mcp

使用托管服务器(无需安装)

公共实例运行在 https://mcp.solarstorm.today/mcp。

Claude Code

claude mcp add --transport http solarstorm https://mcp.solarstorm.today/mcp

Claude Desktop / claude.ai — 添加一个指向 https://mcp.solarstorm.today/mcp 的自定义连接器。

任何其他 MCP 客户端 — 可流式 HTTP 传输,相同 URL,无需认证。

本地运行(stdio)

需要 Python 3.10+ — 这是 mcp SDK 设定的最低版本。

git clone https://github.com/newminya/solarstorm-mcp.git
cd solarstorm-mcp
pip install -r requirements.txt
python server.py          # waits for a stdio client; Ctrl+C to quit

claude_desktop_config.json:

{
  "mcpServers": {
    "solarstorm": {
      "command": "python",
      "args": ["/absolute/path/to/solarstorm-mcp/server.py"]
    }
  }
}

Claude Code:

claude mcp add solarstorm -- python /absolute/path/to/solarstorm-mcp/server.py

自托管(streamable HTTP)

三个环境变量控制传输方式:

Variable

Default

Purpose

MCP_TRANSPORT

stdio

设置为 streamable-http 以启用网络服务器

MCP_HOST

0.0.0.0

绑定地址 — 在反向代理后使用 127.0.0.1

MCP_PORT

8765

监听端口

mkdir -p /opt/solarstorm-mcp && cd /opt/solarstorm-mcp
# copy server.py and requirements.txt here
python3 -m venv venv && venv/bin/pip install -r requirements.txt

/etc/systemd/system/solarstorm-mcp.service:

[Unit]
Description=solarstorm.today MCP server
After=network.target

[Service]
WorkingDirectory=/opt/solarstorm-mcp
Environment=MCP_TRANSPORT=streamable-http
Environment=MCP_HOST=127.0.0.1
Environment=MCP_PORT=8765
ExecStart=/opt/solarstorm-mcp/venv/bin/python server.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl enable --now solarstorm-mcp
systemctl status solarstorm-mcp

前面使用 nginx,在带有 TLS 证书的子域名上:

server {
    server_name mcp.example.com;
    location /mcp {
        proxy_pass http://127.0.0.1:8765/mcp;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_buffering off;
        proxy_read_timeout 3600s;
    }
    # + certbot TLS lines
}

有一个常见坑:MCP SDK 会拒绝 Host 头与其预期不匹配的请求(DNS 重绑定保护)。如果服务本身健康但握手返回 4xx,请检查你的代理转发的 Host 是什么。

数字是如何得出的

  • 数据来源。 services.swpc.noaa.gov — 行星 K 指数及其预报产品,以及 GOES 主 0.1–0.8 nm X 射线通量。10 秒超时,无缓存,无密钥。

  • 每日最大值 按 Europe/Berlin 日历日分桶,与网站面向德语受众的定位一致。只有 observed-blank、estimated 和 predicted 数据点计入预报。

  • 耀斑等级 将 X 射线通量转换为标准的 A/B/C/M/X 等级(X ≥ 1e-4 W/m²,M ≥ 1e-5,依此类推)。

  • 极光阈值 是欧洲区域肉眼可见度的参考值:Kp 1 在 66° 以上,3 在 62° 以上,4.5 在 58° 以上,6 在 55° 以上,7 在 52° 以上,8 在 48° 以上,9 在 44.5° 以上。低于 ~44.5° 时,只有极端历史风暴才符合条件。相机通常比肉眼早大约一个 Kp 等级捕捉到极光。

  • 未建模: 行星际磁场的 Bz 分量。南向 Bz 会使给定的 Kp 产生远更明显的极光,而且它无法提前数天预报——请将结论视为概率,而非承诺。

相关

测试

pip install -r requirements-dev.txt
pytest -m "not live"    # offline: parsing, thresholds, formatting
pytest -m live          # hits NOAA, asserts the live response contract

离线测试套件在每次推送时针对 Python 3.10–3.13 运行。在线测试套件还按计划每天运行,因为曾经进入生产环境的一个 bug 并非逻辑错误:NOAA 的观测数据源将其键拼写为 Kp,而预报数据源则使用 kp,导致有效的 200 响应被解析为零行。只有真实调用才能捕获这种偏差。

许可证

MIT — 参见 LICENSE。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers