Go-based MCP weather server

Go-based MCP weather server

weather-mcp-server-x-shuffle•byx-shuffle

A Model Context Protocol server written in Go that provides weather lookup by city name or coordinates through OpenWeatherMap.

License: Not specified•Runtime: Awaiting documentation review•Category: search web

WHAT IT DOES

  • •Exposes a get_weather MCP tool that returns current weather or an hourly forecast for a location.
  • •Accepts a city name or a latitude/longitude coordinate pair as the location, including Chinese city and district names.
  • •Supports an optional hours parameter from 1 to 12 for forecast queries, with 3-hour interval forecast data.
  • •Requires an OpenWeatherMap API key supplied through the OPENWEATHER_API_KEY environment variable.

BEST FOR

  • •Asking an MCP-capable assistant for current weather or short-term forecasts in Chinese cities or specific coordinates.
  • •Checking upcoming weather for the next few hours at a location.

ABOUT WEATHER-MCP-SERVER-X-SHUFFLE

Go-based MCP weather server is cataloged as an MCP server attributed to x-shuffle. A Model Context Protocol server written in Go that provides weather lookup by city name or coordinates through OpenWeatherMap. It is categorized under search web. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Go-based MCP weather server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How far ahead can the weather forecast go?

The hours parameter accepts 1 to 12, and OpenWeatherMap forecast data is returned at 3-hour intervals.

What credentials are needed to run the server?

An OpenWeatherMap API key is required and is set through the OPENWEATHER_API_KEY environment variable.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 8da26a66d7ee · 采集于 2026-11-13 13:34:53 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Weather MCP Server

一个基于Go语言开发的天气查询MCP(Model Context Protocol)服务器,提供实时天气信息查询功能。

功能特性

  • 🌤️ 实时天气查询
  • 📍 支持城市名和坐标查询
  • 🌍 多语言支持(中文)
  • 🇨🇳 支持中文城市名和区级地名查询
  • 🔧 基于MCP协议,易于集成
  • 🏗️ 遵循领域驱动设计(DDD)原则

技术栈

  • 语言: Go 1.21+
  • MCP库: github.com/mark3labs/mcp-go
  • 天气API: OpenWeatherMap
  • 架构: 领域驱动设计(DDD)

快速开始

1. 获取OpenWeatherMap API密钥

  1. 访问 OpenWeatherMap
  2. 注册免费账户
  3. 获取API密钥

2. 克隆项目

git clone <repository-url>
cd weather-mcp-server

3. 设置环境变量

export OPENWEATHER_API_KEY=your_api_key_here

4. 运行服务器

方式一:直接运行(推荐开发使用)

go run cmd/server/main.go

方式二:构建后运行

# 构建项目
go build -o bin/weather-mcp-server cmd/server/main.go

# 运行服务器
./bin/weather-mcp-server

5. 测试功能

# 运行测试脚本
go run test_weather.go

项目结构

weather-mcp-server/
├── cmd/server/              # 应用入口
│   └── main.go
├── internal/                # 内部包
│   ├── domain/weather/      # 天气领域模型
│   ├── application/services/ # 应用服务
│   ├── infrastructure/      # 基础设施
│   │   ├── weather/         # 天气API客户端
│   │   └── mcp/             # MCP协议实现
│   └── interfaces/          # 接口层
├── configs/                 # MCP配置文件
├── test_weather.go          # 测试脚本
└── README.md

MCP工具

get_weather

获取指定位置的天气信息,支持实时天气和未来小时预报。

参数:

  • location (string, 必需): 位置信息,可以是城市名(如:北京、Beijing)或坐标(如:39.9042,116.4074)
  • hours (integer, 可选): 需要查询的小时数,0或不传表示查询实时天气,1-12表示查询未来小时预报

注意: OpenWeatherMap 的预报 API 返回的是3小时间隔的数据。例如:

  • 请求3小时会返回 [当前+3h, 当前+6h, 当前+9h] 的数据
  • 请求6小时会返回 [当前+3h, 当前+6h] 的数据
  • 请求9小时会返回 [当前+3h, 当前+6h, 当前+9h] 的数据

示例:

// 查询实时天气
{
  "location": "北京"
}

// 查询未来3小时预报
{
  "location": "北京",
  "hours": 3
}

// 查询未来6小时预报
{
  "location": "39.9600,116.3000",
  "hours": 6
}

支持的城市名格式:

  • 中文城市名:北京、上海、广州、深圳等
  • 英文城市名:Beijing、Shanghai、Guangzhou、Shenzhen等
  • 区级地名:北京海淀、上海浦东、广州天河等
  • 坐标格式:39.9042,116.4074

响应示例:

📍 北京, CN
🌡️  温度: 25.3°C (体感: 26.1°C)
💧 湿度: 65%
🌪️  风速: 3.2 m/s (东北)
🌡️  气压: 1013 hPa
☁️  天气: 多云
🕐 更新时间: 2024-01-15 14:30:00

开发

运行测试

go test ./...

代码格式化

go fmt ./...

代码检查

golangci-lint run

清理构建文件

rm -rf bin/

配置

服务器配置

通过环境变量进行配置:

环境变量

  • OPENWEATHER_API_KEY: OpenWeatherMap API密钥(必需)

MCP客户端配置

要使用天气MCP服务器,需要在MCP客户端中配置 mcp_settings.json 文件。

1. 使用go run命令(开发模式)

{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "go",
      "args": [
        "run",
        "cmd/server/main.go"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "your_openweather_api_key_here"
      },
      "cwd": "/path/to/weather-mcp-server"
    }
  }
}

2. 使用构建的二进制文件

{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "./bin/weather-mcp-server",
      "args": [],
      "env": {
        "OPENWEATHER_API_KEY": "your_openweather_api_key_here"
      },
      "cwd": "/path/to/weather-mcp-server"
    }
  }
}

3. 使用绝对路径的二进制文件

{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "/absolute/path/to/weather-mcp-server/bin/weather-mcp-server",
      "args": [],
      "env": {
        "OPENWEATHER_API_KEY": "your_openweather_api_key_here"
      }
    }
  }
}

配置说明

  • command: 要执行的命令
  • args: 命令行参数数组
  • env: 环境变量对象
  • cwd: 工作目录路径(可选)

配置文件位置

根据不同的MCP客户端,配置文件位置可能不同:

  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Cursor: ~/.cursor/mcp_settings.json
  • 其他客户端: 请参考客户端文档

示例配置文件

项目提供了配置文件示例:

  • configs/mcp_settings.json.example - 基本配置
  • configs/mcp_settings_relative.json.example - 相对路径配置
  • configs/mcp_settings_go_run.json.example - Go run开发模式配置

许可证

LICENSE

贡献

欢迎提交Issue和Pull Request!

相关链接

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Go-based MCP weather server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/weather-mcp-server-x-shuffle)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related search web MCP Servers

Alternative and complementary servers in the same category

View all in search web →

An MCP server that merges Google Search Console history with a live first-party crawl of your site to produce a prioritised, evidence-backed technical SEO audit inside Claude, complete with paste-ready fixes.

Repository stats unavailable
Search & Web Research

An MCP server that offers intelligent web search using OpenAI reasoning models, with support for fast iterations and deep research.

94
Search & Web Research