mcp-sample

mcp-sample

0

The MCP Weather Example Project is a Node.js and TypeScript-based implementation demonstrating a Model Context Protocol (MCP) server and client for retrieving weather data. It integrates with the US National Weather Service API to provide weather alerts and forecasts through a modular and type-safe interface.

MCP Weather Example Project

This project demonstrates a Model Context Protocol (MCP) server and client for weather data, built with Node.js/TypeScript. It provides a modular implementation of the MCP protocol with error handling and type safety.

Features

  • MCP Server: Offers weather tools via MCP protocol.
    • get-alerts: Fetch active weather alerts for US states.
    • get-forecast: Get weather forecast for coordinates.
    • Integrates with US National Weather Service (NWS) API.
  • MCP Client: TypeScript client managing server lifecycle and tool execution with optional in-memory caching.

Usage

Running the Server

Navigate to the server directory and execute start commands.

Using the Client

Run either as a standalone or library in a project, configurable with client options.