Skip to main content
Glama

mcp-weather-ts

TypeScript MCP 서버로, National Weather Service API의 미국 날씨를 Cursor 같은 호스트에 제공합니다.

호스트가 node build/index.js를 실행하고 stdio를 통해 JSON-RPC로 통신합니다. 모델은 NWS를 직접 호출하지 않습니다. 이 서버의 도구를 호출할 뿐입니다(리소스를 읽거나 프롬프트를 사용할 수도 있습니다).

MCP 작동 방식(도구, 리소스, 프롬프트, 전송): docs/create-mcp.readme.md.


요구 사항

  • Node.js 22+ (이 저장소는 ESM과 fetch를 사용합니다)

  • npm

  • https://api.weather.gov에 대한 네트워크 액세스 (미국 지역만 해당)


Related MCP server: weather

설정

npm install
npm run build

tsc가 JavaScript를 build/에 작성합니다. Cursor는 src/index.ts가 아니라 빌드된 파일을 실행해야 합니다.

스크립트

명령

설명

npm run build

src/build/ 컴파일

npm test

NWS 스모크 테스트: /points 이후 예보 + 시간별 URL


Cursor에 마운트

  1. 빌드합니다(npm run build).

  2. 이 프로젝트에 .cursor/mcp.json을 추가합니다:

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

모든 Cursor 프로젝트에서는 ${workspaceFolder} 대신 %USERPROFILE%\.cursor\mcp.jsonbuild\index.js의 전체 경로를 사용하세요.

  1. Customize → MCP(또는 Cursor Settings → MCP)를 열고 weather를 활성화합니다.

  2. src/를 변경한 후 npm run build를 다시 실행하고 서버를 껐다 켜서 Cursor가 프로세스를 다시 시작하게 하세요.

서버가 연결된 후에는 console.log를 사용하지 마세요. stdout은 MCP 통신 채널입니다. 로그에는 console.error를 사용하세요.


호출할 수 있는 항목

도구

모델(또는 Agent chat에서 요청한 사용자)은 tools/call로 다음을 호출합니다.

이름

입력

설명

get_alerts

state — 미국 2자리 주 코드(CA, NY)

해당 주의 활성 경보

get_forecast

latitude, longitude

12시간 예보(NWS /points 이후 properties.forecast)

test_tool

name

연습용: Hello, {name}!

채팅 예시:

  • “CA에 날씨 경보가 있나요?”

  • “39.7456, -97.0892의 예보”

인수 예시:

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

리소스

이름

URI

설명

nws_guide

weather://nws-guide

도구와 NWS 조회 흐름에 대한 짧은 정적 메모

에이전트에게 weather://nws-guide를 읽도록 요청하거나 클라이언트에서 resources/read를 사용하세요.

프롬프트

이름

인수

설명

check_weather

place — 예: Boston MA 또는 CA

모델에게 get_forecast / get_alerts를 사용하도록 지시하는 사용자 메시지 템플릿

Cursor에서 Check weather 프롬프트를 선택하고 place를 입력하세요.


프로젝트 구조

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

src/index.ts의 시작 순서:

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

  2. registerWeatherTools / registerWeatherResources / registerWeatherPrompts

  3. connectStdioTransport(server)


NWS 참고 사항

  • 예보는 /points/{lat},{lon}/forecast없습니다. /points/{lat},{lon}(소수점 4자리)을 로드한 다음 properties.forecast 또는 properties.forecastHourly를 따라가세요.

  • NWS는 User-Agent 헤더를 요구합니다(weather-api-call.ts에 설정됨).

  • 적용 범위는 미국(및 일부 속령)입니다. 다른 좌표는 종종 실패합니다.


문제 해결

증상

해결 방법

서버가 빨간색 / 도구 없음

다시 빌드하고 build/index.js가 존재하는지 확인한 후 MCP 토글

핸드셰이크 실패

stdio를 connect했는지 확인하고 stdout에 로그를 남기지 마세요

예보가 비어 있거나 실패

미국 위도/경도만 가능; MCP Logs 확인

npm test 실패

네트워크 / NWS 장애

Cursor: Output → MCP Logs.


라이선스

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