Skip to main content
Glama

mcp-weather-ts

Servidor TypeScript MCP que expone el tiempo de EE. UU. desde la National Weather Service API a hosts como Cursor.

El host inicia node build/index.js y se comunica mediante JSON-RPC a través de stdio. El modelo nunca llama a NWS por sí mismo; llama a las herramientas de este servidor (y puede leer un recurso o usar un prompt).

Cómo funciona MCP (herramientas, recursos, prompts, transporte): docs/create-mcp.readme.md.


Requisitos

  • Node.js 22+ (este repositorio usa ESM y fetch)

  • npm

  • Acceso por red a https://api.weather.gov (solo ubicaciones de EE. UU.)


Related MCP server: weather

Configuración

npm install
npm run build

tsc escribe JavaScript en build/. Cursor debe ejecutar el archivo compilado, no src/index.ts.

Scripts

Comando

Qué hace

npm run build

Compila src/build/

npm test

Prueba de humo de NWS: /points y luego las URLs de forecast + hourly


Montar en Cursor

  1. Compila (npm run build).

  2. Añade .cursor/mcp.json en este proyecto:

{
  "mcpServers": {
    "weather": {
      "type": "stdio",
      "command": "node",
      "args": ["${workspaceFolder}/build/index.js"]
    }
  }
}

Para todos los proyectos de Cursor, usa %USERPROFILE%\.cursor\mcp.json y una ruta completa a build\index.js en lugar de ${workspaceFolder}.

  1. Abre Customize → MCP (o Cursor Settings → MCP) y activa weather.

  2. Después de cambiar src/, vuelve a ejecutar npm run build y desactiva/activa el servidor para que Cursor reinicie el proceso.

No uses console.log después de que el servidor se conecte: stdout es el canal de MCP. Usa console.error para los logs.


Qué puedes invocar

Herramientas

El modelo (o tú, preguntándole en el chat de Agent) invoca estas herramientas con tools/call.

Nombre

Entradas

Qué hace

get_alerts

state — código de 2 letras de EE. UU. (CA, NY)

Alertas activas para ese estado

get_forecast

latitude, longitude

Pronóstico de 12 horas (NWS /points y luego properties.forecast)

test_tool

name

Práctica: Hello, {name}!

Ejemplo de chat:

  • «¿Hay alertas meteorológicas para CA?»

  • «Pronóstico para 39.7456, -97.0892»

Ejemplos de argumentos:

{ "state": "CA" }
{ "latitude": 39.7456, "longitude": -97.0892 }

Recurso

Nombre

URI

Qué hace

nws_guide

weather://nws-guide

Nota estática breve sobre las herramientas y el flujo de consulta de NWS

Pídele al agente que lea weather://nws-guide, o usa resources/read en un cliente.

Prompt

Nombre

Argumentos

Qué hace

check_weather

place — p. ej. Boston MA o CA

Plantilla de mensaje de usuario que indica al modelo que use get_forecast / get_alerts

En Cursor, elige el prompt Check weather y rellena place.


Estructura del proyecto

src/index.ts              Create McpServer, register, connect stdio
src/tools.ts              get_alerts, get_forecast, test_tool
src/resources.ts          weather://nws-guide
src/prompts.ts            check_weather
src/weather-api-call.ts   NWS fetch + types + alert formatting
src/createTransport.ts    StdioServerTransport + connect
tests/weather-api-call.test.ts
docs/create-mcp.readme.md How to design MCP servers

Orden de inicio en src/index.ts:

  1. new McpServer({ name: "weather", version: "1.0.0" })

  2. registerWeatherTools / registerWeatherResources / registerWeatherPrompts

  3. connectStdioTransport(server)


Notas sobre NWS

  • Los pronósticos no están en /points/{lat},{lon}/forecast. Carga /points/{lat},{lon} (cuatro decimales) y luego sigue properties.forecast o properties.forecastHourly.

  • NWS requiere una cabecera User-Agent (configurada en weather-api-call.ts).

  • La cobertura es de EE. UU. (y algunos territorios). Otras coordenadas suelen fallar.


Solución de problemas

Síntoma

Qué probar

Servidor en rojo / sin herramientas

Recompila, confirma que build/index.js existe, desactiva/activa MCP

El handshake falla

Asegúrate de hacer connect con stdio y de no escribir logs en stdout

Pronóstico vacío o fallido

Solo lat/lon de EE. UU.; consulta MCP Logs

npm test falla

Red / caída de NWS

Cursor: Output → MCP Logs.


Licencia

ISC

Install Server
A
license - permissive license
C
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    C
    quality
    C
    maintenance
    Exposes US weather data as MCP tools, resources, and prompts via the National Weather Service API, enabling clients like Claude Desktop to get alerts, forecasts, and weather briefings.
    2
    1
  • F
    license
    Not graded
    quality
    C
    maintenance
    This MCP server provides tools to get current weather, forecasts, and weather alerts from the US National Weather Service via REST APIs, enabling AI agents to query live weather data.
    1
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables natural-language weather queries for U.S. states and coordinates, returning real-time alerts and forecasts from the National Weather Service API via MCP tools.

View all related MCP servers

Related MCP Connectors

  • US weather, alerts, earthquakes and elevation for AI agents, from NWS/NOAA and USGS. No API keys.

  • US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.

  • Get US weather forecasts, active alerts, and current observations.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kingshuknandy2016/weather-mcp-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server