Weather MCP Server

Weather MCP Server

Provides weather information through the Model Context Protocol, fetching real-time weather data from OpenWeather API or using simulated data when API key is not configured.

Category
Visit Server

README

weather-mcp

Model Context Protocol (MCP) server untuk layanan cuaca.

Instalasi

bun install

Penggunaan

Development

bun run dev

Production

# Build project
bun run build

# Jalankan hasil build
bun run start

Testing Fungsi Cuaca

bun run test_weather.ts

Contoh output:

Testing weather function...
Weather result: {
  city: "Jakarta",
  temperature: "6°C",
  humidity: "74%",
  windSpeed: "16m/s",
  description: "snow",
  weatherIcon: "01d",
  pressure: "1048 hPa",
  visibility: "2097m",
}

Menjalankan Server dan Client MCP

Menjalankan Server MCP

Untuk menjalankan server MCP secara langsung:

bun run src/index.ts

Menjalankan Client untuk Testing

Untuk menjalankan client MCP (untuk testing koneksi):

bun run src/clients/weather.ts

Catatan: Pastikan server MCP sedang berjalan sebelum menjalankan client.

Menjalankan Server untuk Pengujian (MCP Inspector)

Cara terbaik untuk memastikan server berjalan benar tanpa perlu client kustom adalah menggunakan MCP Inspector. Ini adalah alat debug resmi yang menyediakan antarmuka web.

npx @modelcontextprotocol/inspector node dist/server.js
#atau dengan bun
bunx @modelcontextprotocol/inspector bun src/index.ts

Konfigurasi API

Untuk menggunakan API cuaca sebenarnya, set environment variable berikut:

export OPENWEATHER_API_KEY="your_api_key_here"

Jika environment variable ini tidak diset, maka sistem akan menggunakan simulasi data cuaca.

Integrasi dengan Qwen CLI

Untuk mengintegrasikan MCP ini dengan Qwen CLI atau sistem lain yang mendukung MCP:

  1. Pastikan MCP server dapat dijalankan sebagai executable
  2. Konfigurasi client MCP untuk menjalankan perintah: bun run dist/index.js atau node dist/index.js
  3. MCP akan berkomunikasi melalui STDIO sesuai spesifikasi Model Context Protocol

Implementasi di Gemini CLI

Untuk mengimplementasikan server MCP ini di Gemini CLI, tambahkan konfigurasi berikut ke file konfigurasi MCP Anda:

{
  "theme": "GitHub",
  "selectedAuthType": "oauth-personal",
  "mcpServers": {
    "weather": {
      "command": "bun",
      "args": ["run", "/home/balinux/Documents/code/AI-LLM-dev/mcp/weather-mcp/dist/index.js"], // absolute path
      "env": {
        "OPENWEATHER_API_KEY": "key"
      }
    }
  }
}

Pastikan untuk:

  1. Mengganti path /home/balinux/Documents/code/AI-LLM-dev/mcp/weather-mcp/dist/index.js dengan path absolut ke file hasil build Anda
  2. Mengganti nilai OPENWEATHER_API_KEY dengan API key OpenWeather yang valid
  3. Memastikan bahwa bun telah terinstal di sistem Anda
  4. Menjalankan bun run build sebelum menggunakan server MCP untuk memastikan file dist/index.js tersedia

Struktur Project

  • src/index.ts - Server MCP utama
  • src/tools/weather.ts - Definisi alat cuaca dan skema Zod
  • src/utils/weatherAPI.ts - Logika pengambilan data cuaca dari API
  • src/clients/weather.ts - Contoh client MCP untuk testing
  • dist/index.js - Hasil build untuk deployment

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured