# NOAA and National Weather Service API: keys, forecasts, climate data and MCP servers

The National Weather Service API at `https://api.weather.gov` is free and needs no API key: every request must carry a `User-Agent` header, and a request without one gets HTTP 403. To get a forecast you call `/points/{lat},{lon}`, which returns the forecast office and grid cell, then call the `forecast` URL it gives you for 7 days of 12-hour periods. Historical weather is not there (station observations are kept for 7 days), so for daily highs and lows going back decades you use NOAA's National Centers for Environmental Information (NCEI): the Access Data Service needs no key, and the older Climate Data Online API needs a free token sent to your email.

Everything below was read from NOAA's own documentation and tested against the live APIs on November 15, 2026.

## Which NOAA APIs need a key

Only one of the three common NOAA APIs needs a key. People searching for a "NOAA API key" usually mean the Climate Data Online token.

| API | Base URL | Key or token | Data | Published limits |
|---|---|---|---|---|
| NWS API (weather.gov) | `https://api.weather.gov` | None. `User-Agent` header required | Forecasts, alerts, the last 7 days of station observations, zones, products | Not published; retry after about 5 seconds when limited |
| NCEI Access Data Service | `https://www.ncei.noaa.gov/access/services/data/v1` | None | Daily summaries (GHCN-Daily), monthly and annual summaries, normals, other datasets | None published |
| NCEI Climate Data Online (CDO) v2 | `https://www.ncei.noaa.gov/cdo-web/api/v2/` | Free token by email, sent in a `token` header | GHCND, GSOM, GSOY, PRECIP_15 and other datasets, plus station and location search | 5 requests per second and 10,000 per day per token |

The NWS has said for years that a key is coming. Its documentation says the User-Agent "will be replaced with an API key in the future," and the [API 3.3 release notes](https://github.com/weather-gov/api/discussions/846) (November 27, 2025) added an API key to the OpenAPI security schemes while saying "We are not ready to flip that switch yet." As of November 15, 2026 no key is enforced; the live spec at `https://api.weather.gov/openapi.json` reports version 3.12.2.

## Getting access, step by step

The NWS API needs only a header, and the CDO token takes one email.

**National Weather Service API.** Set a `User-Agent` that names your application. The [API documentation](https://www.weather.gov/documentation/services-web-api) says it "can be anything," gives the example `(myweatherapp.com, contact@myweatherapp.com)`, and asks for a website or email so NWS can contact you if your traffic is tied to a security event. The docs add that the more unique the string, the less likely your application is caught up in a security block, so send your own rather than a library default.

**Climate Data Online token.**

1. Open the [token request page](https://www.ncei.noaa.gov/cdo-web/token).
2. Enter your email address and click **Submit**.
3. Check your inbox. NCEI emails a token; if the address already has one, it sends a reminder with the same token.
4. Send it in a header named `token` on every request, not as a query parameter: `curl -H "token: YOUR_TOKEN" "https://www.ncei.noaa.gov/cdo-web/api/v2/datasets"`.

**NCEI Access Data Service.** Nothing to request. Call the URL.

## Getting a 7-day forecast from api.weather.gov

A forecast takes two requests: one to turn coordinates into a grid cell, one for the forecast itself. NWS forecasts are made by each Weather Forecast Office on its own grid of about 2.5 km cells.

1. `GET https://api.weather.gov/points/39.7456,-97.0892` returns the office (`gridId` "TOP"), the cell (`gridX` 32, `gridY` 81) and ready-made URLs: `forecast` (12-hour periods for 7 days), `forecastHourly`, `forecastGridData` (raw numeric grids) and `observationStations`.
2. `GET` the `forecast` URL, here `https://api.weather.gov/gridpoints/TOP/32,81/forecast`. On November 15, 2026 it returned 14 periods, each with `name` ("This Afternoon", "Monday Night"), `temperature`, `temperatureUnit`, `probabilityOfPrecipitation`, `windSpeed`, `windDirection`, `shortForecast` and `detailedForecast`.

Round coordinates to 4 decimal places. A point with more precision gets a 301 redirect to the rounded point, which `requests` follows but some clients do not. Add `?units=si` to the forecast URL for metric text. The NWS also notes that the grid for a location "may occasionally change," so cache the `/points` answer but refresh it from time to time.

## Alerts, observations and caching

Alerts and observations sit under their own endpoints, and every response tells you how long to cache it.

- **Active alerts** for a point: `/alerts/active?point=39.7456,-97.0892`; for a state: `/alerts/active?area=KS`. `/alerts` holds alerts issued over the past 7 days; NCEI keeps the official archive.
- **Observations:** `/stations/{stationId}/observations/latest` returns the newest reading (for example `KMHK`, near the point above). Find nearby stations from the `observationStations` URL in the points response. Only 7 days of observations are kept, and the docs warn they can lag up to 20 minutes behind the upstream quality-control pipeline.
- **Format:** GeoJSON (`application/geo+json`) by default; JSON-LD, DWML XML for forecasts, CAP and ATOM for alerts through the `Accept` header.

The `Cache-Control` headers we saw on November 15, 2026:

| Endpoint | `Cache-Control` |
|---|---|
| `/points/{lat},{lon}` | `public, max-age=25869, s-maxage=86400` |
| `/gridpoints/{wfo}/{x},{y}/forecast` | `public, max-age=3600, s-maxage=3600` |
| `/stations/{id}/observations/latest` | `public, max-age=300, s-maxage=300` |
| `/alerts/active?point=...` | `public, max-age=5, s-maxage=5` |

Honor them. The NWS [FAQ](https://weather-gov.github.io/api/general-faqs) asks you not to use cache-busting tricks such as random numbers in the query string.

## Rate limits and pricing

Both services are free. The NWS documentation says "we do not charge any fees," that the rate limit "is not public information, but allows a generous amount for typical use," and that a limited request "may be retried after the limit clears (typically within 5 seconds)." It adds that proxies hit the limit more often than direct clients.

The CDO documentation is exact: each token is "limited to five requests per second and 10,000 requests per day." A `/data` request covers at most one year for daily data and ten years for monthly and annual data, and returns at most 1,000 rows per page (`limit`, default 25, with `offset` for the next page). NCEI publishes no limit for the Access Data Service.

## Endpoint reference

The endpoints most programs need, with the key requirement for each:

| Task | Endpoint | Key |
|---|---|---|
| Coordinates to grid, office and station list | `GET https://api.weather.gov/points/{lat},{lon}` | None |
| 7-day forecast, 12-hour periods | `GET https://api.weather.gov/gridpoints/{wfo}/{x},{y}/forecast` | None |
| Hourly forecast | `GET https://api.weather.gov/gridpoints/{wfo}/{x},{y}/forecast/hourly` | None |
| Raw forecast grids (temperature, dewpoint, sky cover and more) | `GET https://api.weather.gov/gridpoints/{wfo}/{x},{y}` | None |
| Active alerts by point, state or zone | `GET https://api.weather.gov/alerts/active?point=` / `?area=` / `?zone=` | None |
| Latest observation at a station | `GET https://api.weather.gov/stations/{stationId}/observations/latest` | None |
| Station observations, last 7 days | `GET https://api.weather.gov/stations/{stationId}/observations` | None |
| Daily highs, lows, precipitation by station and date | `GET https://www.ncei.noaa.gov/access/services/data/v1?dataset=daily-summaries&stations=...&startDate=...&endDate=...` | None |
| CDO dataset list | `GET https://www.ncei.noaa.gov/cdo-web/api/v2/datasets` | Token |
| CDO station search | `GET https://www.ncei.noaa.gov/cdo-web/api/v2/stations?locationid=FIPS:37` | Token |
| CDO data | `GET https://www.ncei.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&stationid=GHCND:...&startdate=...&enddate=...` | Token |

The full NWS list (69 paths, including aviation SIGMETs, office headlines, products and radar status) is in `https://api.weather.gov/openapi.json`. The API's radar endpoints carry status data, not radar imagery.

## Python: a 7-day forecast

This program needs only `requests`. It rounds the coordinates, follows the points response to the forecast and turns NWS error bodies into readable exceptions. Replace the User-Agent with your own application name and contact.

```python
import requests

HEADERS = {
    "User-Agent": "(myweatherapp.example, you@example.com)",  # required; use your own
    "Accept": "application/geo+json",
}
API = "https://api.weather.gov"


def nws_get(url, **params):
    """GET an api.weather.gov URL and raise with the problem detail on errors."""
    resp = requests.get(url, headers=HEADERS, params=params, timeout=30)
    if resp.status_code != 200:
        try:
            problem = resp.json()
            msg = f"{problem.get('title')}: {problem.get('detail')}"
        except ValueError:  # the 403 for a missing User-Agent is HTML, not JSON
            msg = resp.text[:200]
        raise RuntimeError(f"NWS {resp.status_code} for {resp.url}: {msg}")
    return resp.json()


def seven_day_forecast(lat, lon):
    # Step 1: point -> forecast office and grid cell. Round to 4 decimals,
    # or the API answers 301 "Adjusting Precision Of Point Coordinate".
    point = nws_get(f"{API}/points/{lat:.4f},{lon:.4f}")["properties"]
    # Step 2: follow the forecast URL the point gave you (cache the point; the grid rarely changes).
    forecast = nws_get(point["forecast"])["properties"]
    return point, forecast["periods"]


if __name__ == "__main__":
    point, periods = seven_day_forecast(39.7456, -97.0892)
    where = point["relativeLocation"]["properties"]
    print(f"{where['city']}, {where['state']}  office {point['gridId']} grid {point['gridX']},{point['gridY']}")
    for p in periods:  # up to 14 periods: day and night for 7 days
        pop = p["probabilityOfPrecipitation"]["value"] or 0
        print(f"{p['name']:<16} {p['temperature']:>3}{p['temperatureUnit']}  {pop:>3}%  {p['shortForecast']}")
```

Run on November 15, 2026, it printed (first lines):

```text
Linn, KS  office TOP grid 32,81
This Afternoon    52F    0%  Sunny
Tonight           34F    1%  Partly Cloudy
Monday            54F    1%  Mostly Sunny
```

## Python: historical daily highs with no token

The Access Data Service returns GHCN-Daily station records with no key. This program fetches daily maximum and minimum temperature (°F) and precipitation (inches) for New York's Central Park station, `USW00094728`.

```python
import requests

ADS = "https://www.ncei.noaa.gov/access/services/data/v1"
HEADERS = {"User-Agent": "myweatherapp/1.0"}


def daily_highs(station, start, end):
    """Daily max/min temperature (F) and precipitation (in) from GHCN-Daily. No token needed."""
    params = {
        "dataset": "daily-summaries",
        "stations": station,          # GHCN-Daily ID, without the "GHCND:" prefix CDO uses
        "startDate": start,
        "endDate": end,
        "dataTypes": "TMAX,TMIN,PRCP",
        "units": "standard",
        "includeStationName": "true",
        "format": "json",
    }
    resp = requests.get(ADS, params=params, headers=HEADERS, timeout=60)
    if resp.status_code != 200:
        raise RuntimeError(f"NCEI {resp.status_code}: {resp.text[:300]}")
    rows = resp.json()
    # Values arrive as strings; a missing day or element is simply absent.
    return [
        {
            "date": r["DATE"],
            "name": r.get("NAME"),
            "tmax": float(r["TMAX"]) if r.get("TMAX") not in (None, "") else None,
            "tmin": float(r["TMIN"]) if r.get("TMIN") not in (None, "") else None,
            "prcp": float(r["PRCP"]) if r.get("PRCP") not in (None, "") else None,
        }
        for r in rows
    ]


if __name__ == "__main__":
    for day in daily_highs("USW00094728", "2026-11-01", "2026-11-07"):
        print(day)
```

Output on November 15, 2026 (first two rows):

```text
{'date': '2026-11-01', 'name': 'NY CITY CENTRAL PARK, NY US', 'tmax': 59.0, 'tmin': 42.0, 'prcp': 0.0}
{'date': '2026-11-02', 'name': 'NY CITY CENTRAL PARK, NY US', 'tmax': 66.0, 'tmin': 43.0, 'prcp': 0.0}
```

`dataTypes` is case-sensitive. Use `format=csv` (the default) to load straight into pandas with `pd.read_csv(resp.url)`. The service also takes `bbox=N,W,S,E` to select stations by area and `includeStationLocation=1` to add coordinates.

## Python: the same data through Climate Data Online

CDO needs the token and uses its own IDs: the dataset is `GHCND` and the station carries a `GHCND:` prefix. Use it when you need its station and location search, which the Access Data Service does not offer.

```python
import os

import requests

CDO = "https://www.ncei.noaa.gov/cdo-web/api/v2"
HEADERS = {"token": os.environ["NOAA_CDO_TOKEN"]}


def cdo_get(path, **params):
    resp = requests.get(f"{CDO}/{path}", headers=HEADERS, params=params, timeout=60)
    if resp.status_code != 200:  # missing or bad tokens come back as 400 with a JSON message
        raise RuntimeError(f"CDO {resp.status_code}: {resp.text[:300]}")
    return resp.json()


data = cdo_get(
    "data",
    datasetid="GHCND",
    stationid="GHCND:USW00094728",
    datatypeid="TMAX",
    startdate="2026-11-01",
    enddate="2026-11-07",  # daily data: at most one year per request
    units="standard",
    limit=1000,
)
print(data.get("metadata"))       # resultset: limit, count, offset
for row in data.get("results", []):
    print(row)
```

Stay under 5 requests a second; a short `time.sleep(0.25)` between pages is enough. NCEI posted a notice on May 5, 2023 moving the online Daily Summaries (GHCNd) service from CDO v2 to its Common Access system, so for new code that only needs daily station values, the Access Data Service above is the safer route.

## Errors and their real bodies

These are the responses we recorded on November 15, 2026, except where the table says the body comes from NOAA's documentation.

| Status | Body (abridged) | Cause | Fix |
|---|---|---|---|
| 403, `text/html` | `<TITLE>Access Denied</TITLE>` ... `You don't have permission to access "http://api.weather.gov/points/..."` | No `User-Agent` header on an api.weather.gov request | Send a User-Agent naming your app |
| 301, `application/problem+json` | `"title": "Adjusting Precision Of Point Coordinate"`, `"type": "https://api.weather.gov/problems/AdjustPointPrecision"`, `Location: /points/39.7456,-97.0892` | More than 4 decimal places in `/points` | Round to 4 decimals or follow the redirect |
| 404, `application/problem+json` | `"title": "Data Unavailable For Requested Point"`, `"type": "https://api.weather.gov/problems/InvalidPoint"`, `"detail": "Unable to provide data for requested point 51.5,-0.12"` | Point outside NWS coverage (here, London) | NWS covers the US and its territories only |
| 500, `application/problem+json` | `"title": "Unexpected Problem"` (documented example in openapi.json; not seen live) | Server-side failure | Retry with backoff |
| Rate limited | Status and body not published | Too many requests, usually through a proxy | Wait about 5 seconds and retry |
| 400 | `{"status" : "400", "message" : "Token parameter is required."}` | CDO request with no `token` header | Add the header |
| 400 | `{"status" : "400", "message" : "The token parameter provided is not valid."}` | Wrong or mistyped token | Copy the token from the email into the header |
| 400 | `{"errorCode":400,"errorMessage":"Bad Request","errors":[{"field":"startDate","message":"The start date can not be after the end date.",...}]}` | Access Data Service dates reversed | Swap the dates |
| 400 | `{"errorCode":400,"errorMessage":"Bad Request","errors":[{"field":"dataset","message":"Unsupported dataset.","value":"daily-summary"}]}` | Wrong dataset name | Use `daily-summaries` |

CDO returns 400, not 401, for token problems, so check the message text. Every api.weather.gov error carries `correlationId` and `instance` fields; quote them if you report a problem to `nco.ops@noaa.gov`, the operations address on the documentation page.

## NOAA and weather MCP servers

NOAA runs no MCP server of its own. A search of the [official MCP registry](https://registry.modelcontextprotocol.io) on November 15, 2026 for "noaa", "nws", "weather.gov" and "ncei" found no entry published by NOAA or the NWS; every listing is a community project or a company's hosted gateway. The closest thing to an official example is the MCP project's own server tutorial: [modelcontextprotocol/quickstart-resources](https://github.com/modelcontextprotocol/quickstart-resources) (1,242 stars) builds a weather server on api.weather.gov with two tools, `get_alerts` (by state) and `get_forecast` (by coordinates), in Python, TypeScript, Go, Rust and Ruby.

The open-source servers worth installing, as of November 15, 2026:

| Repository | Stars | Latest release | NOAA data | Key needed | Tools |
|---|---|---|---|---|---|
| [weather-mcp/weather-mcp](https://github.com/weather-mcp/weather-mcp) | 56 | `@dangahagan/weather-mcp` 1.35.20 on npm, Nov 15, 2026 | NWS forecasts, alerts and observations, plus other free public sources for places outside the US | None | 17, including `get_forecast`, `get_alerts`, `get_historical_weather` |
| [cyanheads/nws-weather-mcp-server](https://github.com/cyanheads/nws-weather-mcp-server) | 2 | 0.12.1 on npm, Nov 11, 2026 | NWS only | None; set `NWS_USER_AGENT` | 10, including `nws_get_forecast`, `nws_search_alerts`, `nws_get_observations`, `nws_get_office_discussion` |
| [cyanheads/noaa-climate-mcp-server](https://github.com/cyanheads/noaa-climate-mcp-server) | 5 | 0.9.0 on npm, Nov 11, 2026 | CDO v2, 1991-2020 climate normals, Storm Events | `NOAA_CDO_TOKEN` for CDO tools; normals and Storm Events need none | 11, including `noaa_climate_find_stations`, `noaa_climate_fetch_data`, `noaa_climate_get_normals` |

weather-mcp is listed in the registry as `io.github.dgahagan/weather-mcp` and the NWS server as `io.github.cyanheads/nws-weather-mcp-server`. The cyanheads author also runs hosted copies at `https://nws.caseyjhand.com/mcp` and `https://noaa-climate.caseyjhand.com/mcp`; those are a private developer's servers, so they see your queries.

### Claude Code

```bash
# NWS forecasts, alerts, observations (no key)
claude mcp add nws-weather -- npx -y @cyanheads/nws-weather-mcp-server

# NOAA climate history (CDO token for the CDO tools)
claude mcp add noaa-climate -e NOAA_CDO_TOKEN=YOUR_TOKEN -- npx -y @cyanheads/noaa-climate-mcp-server

# Or the broad weather server
claude mcp add weather -- npx -y @dangahagan/weather-mcp@latest
```

Add `-s user` to make a server available in every project. To use the hosted NWS server without installing anything: `claude mcp add --transport http nws-weather https://nws.caseyjhand.com/mcp`.

### Claude Desktop and Cursor

Claude Desktop reads `claude_desktop_config.json` (**Settings > Developer > Edit Config**; `%APPDATA%\Claude\` on Windows, `~/Library/Application Support/Claude/` on macOS). Cursor reads `~/.cursor/mcp.json`, or `.cursor/mcp.json` in one project. Both take the same entry:

```json
{
  "mcpServers": {
    "nws-weather": {
      "command": "npx",
      "args": ["-y", "@cyanheads/nws-weather-mcp-server"],
      "env": { "NWS_USER_AGENT": "(myweatherapp.example, you@example.com)" }
    },
    "noaa-climate": {
      "command": "npx",
      "args": ["-y", "@cyanheads/noaa-climate-mcp-server"],
      "env": { "NOAA_CDO_TOKEN": "YOUR_TOKEN" }
    }
  }
}
```

Restart the app after saving. Each server needs Node.js for `npx`.

### ChatGPT

ChatGPT connects only to remote MCP servers, so the `npx` servers above cannot be added directly. OpenAI's page on [connecting custom MCP servers](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt) says full MCP is for Business and Enterprise/Edu workspaces and that Pro users can connect servers with read/fetch permissions. You add one under **Plugins**, the plus button, then **Add custom MCP server**, with a URL such as the hosted `https://nws.caseyjhand.com/mcp`, or your own deployment of a server run in HTTP mode (`MCP_TRANSPORT_TYPE=http` for the cyanheads servers).

## Choosing a route

- **A forecast or alerts in an app:** api.weather.gov with a User-Agent, caching `/points` for a day and forecasts for an hour.
- **Daily highs, lows and precipitation for a station, any year:** the NCEI Access Data Service, `dataset=daily-summaries`, no token.
- **Finding stations by state, county or ZIP, or browsing datasets:** CDO v2 with a free token, within 5 requests a second and 10,000 a day.
- **Weather inside Claude, Cursor or another assistant:** an MCP server; the cyanheads NWS server for official US data only, weather-mcp for broader coverage.
- **Anything outside the US:** not the NWS API, which returns 404 "Data Unavailable For Requested Point".
- **Cited answers that combine weather with other records:** Hyperresearch reads National Weather Service forecasts and alerts and NOAA daily and monthly station records as two of its 120+ [data sources](/sources).

For other public data APIs, see the [Census API](/guides/census-api), [FRED API in Python](/guides/fred-api-python) and [ClinicalTrials.gov API](/guides/clinicaltrials-gov-api) guides, and [MCP servers for research data](/guides/research-data-mcp-servers).

## Sources

- NWS API documentation (Overview, Examples, Updates): https://www.weather.gov/documentation/services-web-api
- NWS API OpenAPI specification, version 3.12.2: https://api.weather.gov/openapi.json
- NWS API general FAQs: https://weather-gov.github.io/api/general-faqs
- API 3.3 release announcement (November 27, 2025): https://github.com/weather-gov/api/discussions/846
- Historical data discussion: https://github.com/weather-gov/api/discussions/270
- Climate Data Online Web Services v2 documentation: https://www.ncei.noaa.gov/cdo-web/webservices/v2
- CDO token request: https://www.ncei.noaa.gov/cdo-web/token
- NCEI Access Data Service API documentation: https://www.ncei.noaa.gov/support/access-data-service-api-user-documentation
- NESDIS notice, Global Historical Climate Network Daily (May 5, 2023): https://www.nesdis.noaa.gov/news/global-historical-climate-network-daily-ghcnd
- Official MCP registry: https://registry.modelcontextprotocol.io
- MCP quickstart weather server: https://github.com/modelcontextprotocol/quickstart-resources
- weather-mcp: https://github.com/weather-mcp/weather-mcp
- nws-weather-mcp-server: https://github.com/cyanheads/nws-weather-mcp-server
- noaa-climate-mcp-server: https://github.com/cyanheads/noaa-climate-mcp-server
- OpenAI, connecting custom MCP servers in ChatGPT: https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt
