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.
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:
- Pastikan MCP server dapat dijalankan sebagai executable
- Konfigurasi client MCP untuk menjalankan perintah:
bun run dist/index.jsataunode dist/index.js - 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:
- Mengganti path
/home/balinux/Documents/code/AI-LLM-dev/mcp/weather-mcp/dist/index.jsdengan path absolut ke file hasil build Anda - Mengganti nilai
OPENWEATHER_API_KEYdengan API key OpenWeather yang valid - Memastikan bahwa
buntelah terinstal di sistem Anda - Menjalankan
bun run buildsebelum menggunakan server MCP untuk memastikan filedist/index.jstersedia
Struktur Project
src/index.ts- Server MCP utamasrc/tools/weather.ts- Definisi alat cuaca dan skema Zodsrc/utils/weatherAPI.ts- Logika pengambilan data cuaca dari APIsrc/clients/weather.ts- Contoh client MCP untuk testingdist/index.js- Hasil build untuk deployment
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
E2B
Using MCP to run code via e2b.