Exemplo de Servidor MCP
@gabrielfroes
Modelo de Servidor MCP baseado na documentação oficial
Overview
What is Exemplo de Servidor MCP?
Exemplo de Servidor MCP is a sample implementation of a Model Context Protocol (MCP) server built with Node.js/TypeScript. It provides two tools for retrieving weather information from the US National Weather Service (NWS) API: get-alerts for active weather alerts by state code, and get-forecast for weather forecasts by geographic coordinates. This project is intended for educational purposes and demonstrates how to build an MCP server with external API integration and data validation.
How to use Exemplo de Servidor MCP?
Install by cloning the repository, running npm install and npm run build. After building, start the server with node build/main.js or, if linked as a binary, with weather. The server listens on stdio and accepts MCP requests.
Key features of Exemplo de Servidor MCP
- Two weather tools:
get-alertsandget-forecast - Input validation using Zod schemas
- Integration with the National Weather Service API
- Layered architecture inspired by Domain-Driven Design (DDD)
- Communication via stdio using the MCP SDK
- Written in TypeScript with compiled JavaScript output
Use cases of Exemplo de Servidor MCP
- A weather‑focused AI assistant retrieving active alerts for a US state
- A chatbot providing a forecast for given latitude/longitude coordinates
- Educational demonstration of building an MCP server with external API integration
- Testing MCP client-server interactions with a simple, functional example
FAQ from Exemplo de Servidor MCP
What does Exemplo de Servidor MCP do?
It is an MCP server that exposes two tools (get-alerts and get-forecast) to fetch weather alert and forecast data from the US National Weather Service API.
What are the dependencies and runtime requirements?
Node.js and npm are required. After installing dependencies with npm install, the server is built with npm run build and runs on Node.js.
How does the server communicate?
It uses stdio transport as defined by the MCP SDK (@modelcontextprotocol/sdk). The server reads requests from standard input and writes responses to standard output.
Does it require authentication?
No authentication is mentioned. The NWS API used does not require an API key for these endpoints.
Where does the weather data come from?
All weather data is fetched live from the public National Weather Service (NWS) API. No local data is stored or cached by the server.