home / mcp / weather mcp server

Weather MCP Server

Provides weather data via MCP using real API or simulated data with an OpenWeather key.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "balinux-weather-mcp": {
      "command": "bun",
      "args": [
        "run",
        "/home/balinux/Documents/code/AI-LLM-dev/mcp/weather-mcp/dist/index.js"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "key"
      }
    }
  }
}

This Weather MCP Server provides a dedicated Model Context Protocol (MCP) implementation for weather data. It lets you fetch real-time weather information or simulated data, integrate with clients, and test connectivity through an MCP inspector or sample clients.

How to use

Run the MCP server locally, then use a client to request weather data. You can test the connection with a sample weather client and verify responses from the server.

Typical usage flow you will follow: - Start the server so it is ready to accept MCP requests. - Use the provided sample client to verify connectivity and basic responses. - If you want to inspect how the server behaves, use an MCP Inspector tool to view the web interface and runtime status.

How to install

Prerequisites: you need Bun installed to run the MCP server and its tooling.

bun install

Build the project before running the server in production mode.

bun run build

# Jalankan hasil build
bun run start

Additional steps and notes

To test the weather function directly, you can run the weather test and observe the output. If you want to verify that the server and client communicate correctly, follow the server startup steps and then run the client script.

bun run test_weather.ts

Available tools

weather

Weather tool that defines the weather data schema and interfaces used by the MCP server.

weatherAPI

Logic to fetch weather data from the actual API or generate simulated data when the API key is missing.