mcp-sample

mcp-sample

3.2

If you are the rightful owner of mcp-sample and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Weather Example Project is a demonstration of a Model Context Protocol server and client for weather data, built using Node.js and TypeScript.

The MCP Weather Example Project showcases a Model Context Protocol (MCP) server and client designed for handling weather data. Built with Node.js and TypeScript, the project emphasizes a clean and modular implementation of the MCP protocol, ensuring robust error handling and type safety. The server provides weather tools via the MCP protocol over standard input/output, integrating with the US National Weather Service (NWS) API for data. The client, implemented in TypeScript, manages the server lifecycle, executes tools with type safety, and supports asynchronous operations. It also features in-memory caching with configurable time-to-live (TTL) support. The project structure is organized into server and client directories, each containing source code and build outputs. The server and client can be run as standalone applications or integrated into other projects as libraries.

Features

  • MCP Server: Provides weather tools via the MCP protocol over stdio, with integration to the US National Weather Service (NWS) API.
  • MCP Client: A robust TypeScript client that manages server lifecycle, provides type-safe tool execution, and supports async/await operations.
  • Input Validation: Utilizes Zod for input validation to ensure data integrity and type safety.
  • In-memory Caching: Supports caching of tool execution results with configurable TTL to improve performance.

Tools

  1. get-alerts

    Retrieves weather alerts for a specified US state.

  2. get-forecast

    Retrieves weather forecast for specified latitude and longitude.