mcpField
W
Weather API MCP Server

Weather API MCP Server

Local
news.ycombinator.comMedia & Design246Updated 55w ago

About Weather API MCP Server

Weather API MCP Server is a lightweight MCP server that lets Claude and other AI assistants retrieve real-time weather data. It is written in Go and can run locally or as a remote SSE service.

Key features

  1. 01Current weather lookup by city name
  2. 02Local execution and remote SSE connection
  3. 03Docker image build and run instructions
  4. 04Go implementation with mock services for tests

Use cases

  1. 01Asking Claude Desktop for the current weather in a city
  2. 02Deploying the weather service remotely for several MCP clients

MCP support

This project is an MCP server that exposes a current_weather tool to MCP clients, taking a city name and returning current weather data.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"weather": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"build"
]
}
}
}
Run commanddocker run -i --rm build

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocibuild

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README
example output template

Weather API MCP Server

License Go Version Go Report Card Build Tests

Report Bug | Request Feature

A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data.

demo example

Installing on Claude Desktop

To use your MCP server with Claude Desktop, add it to your Claude configuration:

1. Local mode
{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "/path/to/weather-mcp-server",
      "env": {
        "WEATHER_API_KEY": "your-api-key"
      }
    }
  }
}

You can get an API key from your personal account on WeatherAPI.

2. Remote mode
{
  "mcpServers": {
    "weather-mcp-server": {
      "url": "http://host:port/sse"
    }
  }
}

Build from source

You can use go to build the binary in the cmd/github-mcp-server directory.

go build -o weather-mcp-server ./cmd/weather-mcp-server

Using MCP with Docker Containers

1. Build the Docker Image:
docker build -t weather-mcp-server .
2. Run the Docker Container:
docker run -e WEATHER_API_KEY=your-api-key -d --name weather-mcp-server -p 8000:8000 weather-mcp-server

Replace your-api-key with your actual WeatherAPI API key.

Tools

  • current_weather - Gets the current weather for a city

    • city: The name of the city (string, required)

Project Structure

The project is organized into several key directories:

├── cmd
│   └── weather-mcp-server
├── internal
│   └── server
│       ├── handlers # MCP handlers
│       ├── services # Business logic layer
│       │   ├── core # Core application logic
│       │   └── mock # Mock services for testing
│       ├── tools # MCP tools
│       └── view # Templates for displaying messages
└── pkg

Testing

If you're adding new features, please make sure to include tests for them.

1. Install the mockgen tool:
go install go.uber.org/mock/mockgen@latest

See the installation guide on go.uber.org/mock.

2. Use the following command to generate mock files:
make generate-mocks
3. To run unit tests:
make run-tests

Contributing

Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help!

Please follow the contribution guidelines.

License

This MCP server is licensed under the MIT License.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.