// save as sample.mjs; run: node --env-file=.env sample.mjs (Node 20.6+, ESM top-level await)
const res = await fetch(
"https://api.smarterweather.com/v1/weather?lat=42.3601&lon=-71.0589",
{ headers: { Authorization: `Bearer ${process.env.SMARTERWEATHER_API_KEY}` } },
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json();
console.log(JSON.stringify(data, null, 2));
# pip install requests python-dotenv
import os, sys, requests
from dotenv import load_dotenv
load_dotenv(".env") # ./.env in the current directory; variables already set are kept
r = requests.get(
"https://api.smarterweather.com/v1/weather",
params={"lat":"42.3601","lon":"-71.0589"},
headers={"Authorization": f"Bearer {os.environ['SMARTERWEATHER_API_KEY']}"},
)
if not r.ok:
sys.exit(f"{r.status_code} {r.text}")
data = r.json()
print(data)
Then use the onboarding skill to sign up, create an API key, and set up the Weather MCP. SKILL.md
Beyond the forecast
What the data adds to the forecast. A trial key reaches only routes under /v1/weather, /v1/geocode, and /v1/alerts; the others need an API key from a free account.
Experimental
Forecast uncertainty, hourly and daily
Add include=uncertainty to /v1/weather for ensemble spread and threshold probabilities from the National Blend of Models (NBM).
Your agent can sign you up, create an API key, and set up the Weather MCP. You approve once in the browser. With no one present, it can get a trial key instead.