Skip to main content
Glama

MCP Weather Server

by Rkshobhit

MCP Weather Demo - README

Overview

This demo implements a minimal MCP-style JSON-RPC endpoint exposing a getWeather(city) capability. The server calls OpenWeatherMap (OWM) API and returns a simplified result.

Setup

  1. Install Node.js (>=16).
  2. Copy this folder to your machine.
  3. Create a free OpenWeatherMap API key: https://openweathermap.org/api
  4. Set environment variable:
    • Unix/macOS: export OWM_KEY=your_key_here
    • Windows (PowerShell): $env='your_key_here'

Install & Run

npm install

development (no build)

npx ts-node src/server.ts

or build & run

npm run build npm start

Test

Use the provided client: npx ts-node src/client.ts

Or use curl: curl -X POST http://localhost:3000/json-rpc -H 'Content-Type: application/json' -d '{ "jsonrpc":"2.0", "method":"getWeather", "params": {"city":"London"}, "id":1 }'

Notes

  • This is a minimal example for demo/educational purposes.
  • Add caching, rate-limiting, better error handling, and authentication for production.
-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables users to get current weather information for any city through a simple JSON-RPC interface. Integrates with OpenWeatherMap API to provide real-time weather data including temperature, conditions, and other meteorological information.

  1. Overview
    1. Setup
      1. Install & Run
        1. development (no build)
          1. or build & run
            1. Test
            2. Notes

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/Rkshobhit/mcp-weather-app'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server