go-temperature-server
0
The Go Temperature Server is a simple server written in Go that provides temperature data for specified locations using a REST API. It leverages OpenWeatherMap API for fetching weather data and allows flexible configuration through environment variables or direct query parameters.
Go Temperature Server
This is a simple Go-based MCP server that provides the current temperature for a given location via a REST API.
Usage
-
Set your OpenWeatherMap API key as an environment variable (see below), or pass it as the
appid
query parameter to the API. -
Run the server:
go run main.go
-
Query the temperature endpoint:
# Using environment variable for API key curl 'http://localhost:8080/temperature?location=London' # OR, pass API key as a query parameter curl 'http://localhost:8080/temperature?location=London&appid=your_api_key_here'
Weather API Key
This server requires an API key for a weather provider (e.g., OpenWeatherMap). You can:
-
Set it as an environment variable:
export WEATHER_API_KEY=your_api_key_here
-
Or provide it as the
appid
query parameter in your request:curl 'http://localhost:8080/temperature?location=London&appid=your_api_key_here'
Configuration
PORT
(optional): The port to run the server on (default: 8080)WEATHER_API_KEY
: Your weather API key (optional if you provideappid
as a query parameter)