mcp -sample
Modelo de Servidor MCP baseado na documentação oficial
claude mcp add --transport stdio gabrielfroes-mcp-server-sample node build/main.js
How to use
This MCP server is a Node.js/TypeScript implementation that exposes two MCP tools for weather information: get-alerts and get-forecast. The get-alerts tool fetches active weather alerts for a state using a two-letter code (for example, CA or NY), while the get-forecast tool returns weather forecasts for geographic coordinates (latitude and longitude). The server communicates over stdio via the MCP protocol, allowing tools to be invoked and results streamed back to MCP clients. The codebase is organized into domain, infrastructure, application, and interface layers, with a main entry point that boots the MCP server and registers the available tools.
To use the server, ensure it is built (npm install followed by npm run build) and then run the generated entry script. Tools are registered via the WeatherToolsController in the interface layer, which also defines Zod-based validation schemas to ensure correct input formats before calling the underlying NWS API service through the infrastructure layer.
How to install
Prerequisites:
- Node.js (LTS version)
- Git
Step-by-step:
-
Clone the repository git clone <REPOSITÓRIO_URL> cd mcp-server-sample
-
Install dependencies npm install
-
Build the project (transpile TypeScript to JavaScript) npm run build
-
Run the server (via Node on the compiled entry point) node build/main.js
Optional: If you want to test the CLI-style MCP interaction, you can register the server as a bin and run the provided weather command after npm link: npm link weather
Notes:
- The server is designed to be run as a standard Node.js process that communicates over stdio using the MCP protocol.
- The two exposed tools (get-alerts and get-forecast) rely on the NWS API via the infrastructure layer.
Additional notes
Tips and considerations:
- The input validation uses Zod to ensure correct parameter formats (e.g., state codes like CA, NY for alerts; latitude/longitude for forecasts).
- If you run into CORS or network issues when accessing the NWS API, verify network egress permissions and check for API rate limits.
- Since the server communicates over stdio, you can integrate it with MCP clients or test harnesses that simulate MCP messages.
- For production, consider pinning Node.js version and ensuring the built output (build/main.js) is included in deployment artifacts.
- If you modify the API integration, maintain the separation between domain models and infrastructure services to preserve a clean DDD-like structure.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud