Weather MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather MCP Serverwhat's the weather in San Francisco?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Exemplo de Servidor MCP
Criado para fins educacionais no canal Código Fonte TV, este projeto demonstra como construir um servidor MCP com integração a APIs externas e validação de dados.
Este repositório contém um exemplo de implementação de um servidor MCP (Model Context Protocol) em Node.js/TypeScript, que fornece duas ferramentas para obter informações meteorológicas usando a API do National Weather Service (NWS) dos EUA.
Funcionalidades
get-alerts: Retorna alertas meteorológicos ativos para um estado (código de duas letras, ex:
CA,NY).get-forecast: Retorna a previsão do tempo para coordenadas geográficas (latitude, longitude).
Validação de entrada usando Zod.
Integração com a API do NWS usando
fetch(camada de infraestrutura).Comunicação via stdio usando o protocolo MCP (
@modelcontextprotocol/sdk).
Related MCP server: Weather MCP Server
Arquitetura
O projeto segue uma arquitetura em camadas inspirada em padrões de Domain-Driven Design (DDD):
Domain (
src/domain): Definição de interfaces e tipos que representam as estruturas de dados (ex:AlertFeature,ForecastPeriod,AlertsResponse).Infrastructure (
src/infrastructure): Implementação de serviços externos, como oNWSApiService, responsável por realizar as chamadas HTTP à API do NWS.Application (
src/application): Contém a lógica de negócio noWeatherService, que processa e formata os dados vindos da infraestrutura.Interface (
src/interface): Inclui controladores (WeatherToolsController) que registram as ferramentas no servidor MCP, definem schemas de validação e retornam os resultados.Entry Point (
src/main.ts): Inicializa oMcpServer, configura o transporte (StdioServerTransport), instancia serviços e controladores, e inicia escuta em stdio.
A estrutura de pastas é a seguinte:
src/
├── domain/
│ └── models/ # Interfaces de domínio
├── infrastructure/
│ └── services/ # Implementações da API externa (NWS)
├── application/
│ └── services/ # Lógica de negócio e formatação de dados
├── interface/
│ └── controllers/ # Registro das ferramentas MCP e validação
└── main.ts # Ponto de entrada do servidor
build/ # Código JavaScript compiladoInstalação
git clone <REPOSITÓRIO_URL>
cd mcp-server-sample
npm install
npm run buildUso
Após o build, você pode executar o servidor diretamente:
node build/main.jsOu, se registrado como binário (weather):
npm link
weatherO servidor iniciará na saída padrão (stdio) e aguardará requisições MCP.
Contribuição
Pull requests são bem-vindos! Sinta-se à vontade para abrir issues e discutir melhorias.
Código Fonte TV
Para mais detalhes sobre a implementação, assista ao vídeo no canal Código Fonte TV.
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
An MCP server for weather information by @kulybaba
An MCP server for weather information by @kulybaba
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.5-
- FlicenseBqualityDmaintenanceAn MCP server that provides weather information and alerts for US locations using the National Weather Service API, enabling retrieval of weather forecasts and active weather alerts.2-
- AlicenseNot gradedqualityDmaintenanceA Python-based MCP server that provides real-time weather information using the National Weather Service API, supporting both synchronous and asynchronous HTTP requests.MIT
- FlicenseBqualityDmaintenanceAn MCP server that provides real-time weather alerts for US states using the National Weather Service (NWS) API. It also includes utility features for message echoing and generating customizable greeting prompts.1-