Skip to content

A Model Context Protocol (MCP) server written in Go that provides weather information and forecasts using the free Open-Meteo API.

License

Notifications You must be signed in to change notification settings

raythurman2386/goweathermcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Weather MCP Server

A Model Context Protocol (MCP) server written in Go that provides weather information and forecasts using the free Open-Meteo API.

Features

  • Get Weather by Coordinates: Retrieve current weather and forecasts using latitude and longitude.
  • Get Weather by City: Search for weather by city name using built-in geocoding.
  • Customizable Units: Support for various units for temperature, wind speed, and precipitation.
  • Detailed Forecasts: Includes hourly (24h) and daily forecasts.

Tools

get_weather

Get current weather and forecast for a specific location using coordinates.

  • latitude (required): Latitude of the location.
  • longitude (required): Longitude of the location.
  • location_name (optional): Descriptive name for the location.
  • temperature_unit (optional): celsius or fahrenheit.
  • wind_speed_unit (optional): kmh, ms, mph, kn.
  • precipitation_unit (optional): mm or inch.

get_weather_by_city

Get weather for a city by name using geocoding.

  • city (required): Name of the city.
  • country_code (optional): 2-letter country code to narrow down search.
  • temperature_unit (optional): celsius or fahrenheit.
  • wind_speed_unit (optional): kmh, ms, mph, kn.
  • precipitation_unit (optional): mm or inch.

Installation

Prerequisites

  • Go 1.24.0 or later (based on go.mod).

Build

Clone the repository and build the binary:

go build -o goweathermcp main.go

Configuration

Claude Desktop

To use this server with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "goweather": {
      "command": "/path/to/goweathermcp/goweathermcp",
      "args": ["-temp-unit", "fahrenheit", "-wind-unit", "mph", "-precip-unit", "inch"]
    }
  }
}

Replace /path/to/goweathermcp/goweathermcp with the actual absolute path to your built binary. You can omit args if you prefer the defaults (celsius, kmh, mm).

Development

To run the server in development mode:

go run main.go

The server uses stdio for communication, so running it directly will wait for MCP JSON-RPC commands.

Releasing

To create a new release:

  1. Tag the commit: git tag -a v1.0.0 -m "First release"
  2. Push the tag: git push origin v1.0.0 The GitHub Action will automatically build and publish the release using GoReleaser.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

About

A Model Context Protocol (MCP) server written in Go that provides weather information and forecasts using the free Open-Meteo API.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages