
Show HN: Minimal MCP server in Go showcasing project architecture by TuanKiri
A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data.
To use your MCP server with Claude Desktop, add it to your Claude configuration:
{ "mcpServers": { "weather-mcp-server": { "command": "/path/to/weather-mcp-server", "args": [], "env": { "WEATHER_API_KEY": "your-api-key" } } } }
You can get your API key in your personal account at weatherapi.
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
-
current_weather – Gets the current weather for a city
city
: The name of the city (string, required)
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 # Templa
6 Comments
timewizard
Go is one of those languages where "good layout" feels more elusive to me than in other languages. I think you accidentally highlight one of the reasons why.
Which makes sense because you're using a lot of things from core but since I have to carry the package name around everywhere I use it, outside of that module, it becomes a bit of a strain.
Would clearly be a better name in the "go style," but the single level package structure always makes me feel like my types are dangling out in space outside of any decent hierarchy.
I love Go as a language but I dislike how often it makes me think of exceptionally tiny things like this. Please don't read this as a criticism of your project just a general criticism of how thin the Go "namespace" ideology actually is.
boyter
Perhaps adding some guide on how to hook this up to… well anything would be good :)
There is a lack of guidance for https://github.com/mark3labs/mcp-go/ which this is using as well so while everything is there, its hard to know how to make it do anything.
RamblingCTO
Good one! A lib I've used a few times now to build go mcp servers quite quickly would be this one: https://github.com/mark3labs/mcp-go
I know, different goals, but still
log101
Thanks to tools like aider and claude code, these scaffold projects are getting more and more helpful. Just clone it and prompt it for your use case.
ivanvanderbyl
You really don’t need this much to build an MCP server in Go. I built one in a single file: https://github.com/Alcova-AI/perplexity-mcp/blob/main/main.g…
maverwa
I may be failing to understand the protocol here, but the thing it returns for a weather request is intented to be ingested by an LLM, which then uses that information to reply to a user, right?
Whats the benefit of adding CSS styling, or even HTML formatting to the output over just a plaintext response? I'd image that adds a lot of unecessary tokens the LM has to grasp?