A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. Discuss on Hacker News:
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add weather-api --env WEATHER_API_KEY='<WEATHER_API_KEY>' -- docker build -t weather-mcp-server .~/.codex/config.toml
[mcp_servers.weather-api]
command = "docker"
args = ["build", "-t", "weather-mcp-server", "."]
env = { WEATHER_API_KEY = "<WEATHER_API_KEY>" }
# codex mcp add weather-api --env WEATHER_API_KEY='<WEATHER_API_KEY>' -- docker build -t weather-mcp-server .~/.cursor/mcp.json
{
"mcpServers": {
"weather-api": {
"command": "docker",
"args": [
"build",
"-t",
"weather-mcp-server",
"."
],
"env": {
"WEATHER_API_KEY": "<WEATHER_API_KEY>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"weather-api": {
"type": "stdio",
"command": "docker",
"args": [
"build",
"-t",
"weather-mcp-server",
"."
],
"env": {
"WEATHER_API_KEY": "<WEATHER_API_KEY>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"weather-api": {
"command": "docker",
"args": [
"build",
"-t",
"weather-mcp-server",
"."
],
"env": {
"WEATHER_API_KEY": "<WEATHER_API_KEY>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"weather-api": {
"command": "docker",
"args": [
"build",
"-t",
"weather-mcp-server",
"."
],
"env": {
"WEATHER_API_KEY": "<WEATHER_API_KEY>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"weather-api": {
"command": "docker",
"args": [
"build",
"-t",
"weather-mcp-server",
"."
],
"env": {
"WEATHER_API_KEY": "<WEATHER_API_KEY>"
}
}
}
}Environment variables
WEATHER_API_KEY
Replace the placeholders with your own credentials and keep them out of version control.