npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iflow-mcp/gabrielfroes-mcp-server-sample

v1.0.0

Published

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.

Readme

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).

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 o NWSApiService, responsável por realizar as chamadas HTTP à API do NWS.

  • Application (src/application): Contém a lógica de negócio no WeatherService, 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 o McpServer, 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 compilado

Instalação

git clone <REPOSITÓRIO_URL>
cd mcp-server-sample
npm install
npm run build

Uso

Após o build, você pode executar o servidor diretamente:

node build/main.js

Ou, se registrado como binário (weather):

npm link
weather

O 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.