go-weather-mcp

Example MCP server in Go to fetch weather data

GitHub Stars

0

User Rating

Not Rated

Forks

0

Issues

0

Views

1

Favorites

0

README
Go Weather MCP Server

This project implements a simple weather forecast server using the mcp-go library. It exposes an MCP tool that fetches weather data from the Open-Meteo API.

The server provides:

  • An MCP tool named "weather" to get forecasts based on latitude, longitude, and time.
  • HTTP endpoints for SSE (/api/sse) and messaging (/api/message).
Running the server

To run the server, execute:

go run main.go

By default, it listens on port :8080. You can change the address using the -addr flag:

go run main.go -addr :your_port
Using the server on a LLM client

To use the server with a LLM client, you first need to configure the client to connect to the server. An example config is:

{
    "servers": {
        "calculator": {
            "type": "sse",
            "url": "http://localhost:8080/api/sse",
        }
    }
}

You can use it in clients like Claude Desktop or VSCode Agent Chat. See the followign video for a demo: Demo

Why this project?

Just wanted to play around with mcp servers and found mcp-go to be a great library for building them. It abstracts away all the jsonrpc protocol stuff and lets you focus on the actual functionality.

Why echo? Because I like it. Very overkill for this project, but I wanted to test it with mcp because I will be building bigger projects with it.

Author Information

0

Followers

7

Repositories

0

Gists

3

Total Contributions

Top Contributors

Threads