Weather MCP Server

by Annihilater

253 downloads
Not rated
GitHub

Description

# Weather MCP Server [中文文档](./README_CN.md) | English A simple weather information service built with Model Context Protocol (MCP). ## Overview Weather MCP Server provides weather information for cities around the world through a simple API interface. It uses the Model Context…

About

# Weather MCP Server [中文文档](./README_CN.md) | English A simple weather information service built with Model Context Protocol (MCP). ## Overview Weather MCP Server provides weather information for cities around the world through a simple API interface. It uses the Model Context Protocol (MCP) to communicate with…

Details

Author
Annihilater
Downloads
253
Categories
Media

- Retrieves current weather by city name
- Returns temperature, weather description, humidity, and wind speed
- Falls back to generated data when external API is unavailable
- Lightweight and simple implementation built with TypeScript
- Communicates via stdio transport using MCP protocol

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Weather MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, run npm install, then npm run build. Start the server with npx @modelcontextprotocol/inspector node dist/index.js. To use in Cursor, add the configuration "mcp-server-get-weather" to ~/.cursor/mcp.json, specifying the command node and the full path to dist/index.js.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "weather mcp server": {
            "mcp-server-get-weather": {
                "command": "npx",
                "args": [
                    "@modelcontextprotocol/inspector",
                    "node",
                    "dist/index.js"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-get-weather": {
        "command": "npx",
        "args": [
            "@modelcontextprotocol/inspector",
            "node",
            "dist/index.js"
        ]
    }
}

Weather MCP Server

中文文档 | English

A simple weather information service built with Model Context Protocol (MCP).

Overview

Weather MCP Server provides weather information for cities around the world through a simple API interface. It uses the Model Context Protocol (MCP) to communicate with clients, allowing easy integration with AI assistants and other MCP-compatible applications.

Features

- Get current weather conditions by city name
- Returns temperature, weather description, humidity, and wind speed
- Fallback to generated data if external API is unavailable
- Simple and lightweight implementation

Tech Stack

- TypeScript
- Node.js
- MCP SDK (@modelcontextprotocol/sdk)
- Zod for validation

Installation

1. Clone the repository

git clone https://github.com/Annihilater/mcp-server-get-weather

2. Install dependencies:

npm install

3. Build the project:

npm run build

Usage

Start the server:

npx @modelcontextprotocol/inspector node dist/index.js

MCP Configuration

要在Cursor中使用此天气服务,需要在~/.cursor/mcp.json文件中添加以下配置:

"mcp-server-get-weather": {
  "command": "node",
  "args": [
    "<path-to-your-project>/dist/index.js"
  ]
}

<path-to-your-project>替换为实际项目路径。配置完成后,可以通过MCP工具调用mcp_mcp_server_get_weather_get_weather函数来获取天气信息。

Example

MCP Config
MCP Usage

API Reference

get_weather

Gets weather information for a specified city.

Parameters

| Name | Type | Description |
|------|------|-------------|
| cityName | string | The name of the city to get weather for |

Response

Returns a JSON object with the following structure:

{
  "city": "London",
  "current_condition": {
    "temperature": "15",
    "weatherDesc": "Partly cloudy",
    "humidity": "71",
    "windSpeed": "11",
    "observation_time": "06:53 PM"
  },
  "forecast": {
    "maxTemp": "16",
    "minTemp": "9",
    "sunHour": "7.4",
    "date": "2023-04-12"
  }
}

Development

Available Scripts

- npm run build - Builds the project and makes the entry point executable
- npm run watch - Watches for changes and rebuilds automatically
- npx @modelcontextprotocol/inspector node dist/index.js - Starts the server

Project Structure

- src/index.ts - Entry point, sets up the MCP server with stdio transport
- src/server.ts - Server implementation, defines the weather tool

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.