weather-mcp
Exposes weather data from the free Open-Meteo API via decorator-driven MCP tools with Zod schemas, supporting stdio and HTTP transports.
README
weather-mcp
An MCP server built on AgentBack that exposes weather data from the free Open-Meteo API — no API key required. Decorator-driven tools with Zod input/output schemas, served over stdio, Streamable HTTP, or a dev console from one set of DI wiring.
npm install
npm run build && npm start # stdio MCP server (for Claude Desktop / Cursor)
npm run serve:http # remote MCP server over HTTP at /mcp
npm test # in-memory MCP session, no process spawn
npm run console # dev web UI at http://localhost:3000/console
Transports
The same tools and DI wiring (src/wiring.ts) are served three ways:
| Entry | Command | Transport | Use |
|---|---|---|---|
src/main.ts |
npm start |
stdio | Local — wire into Claude Desktop / Cursor. |
src/serve-http.ts |
npm run serve:http |
Streamable HTTP at POST/GET/DELETE /mcp |
Remote clients over the network. |
src/console.ts |
npm run console |
HTTP web UI | Development inspector (see below). |
HTTP transport
npm run serve:http exposes the server at http://localhost:3000/mcp
(PORT=3939 npm run serve:http to change the port). Point any Streamable-HTTP
MCP client at that URL.
Auth: every request needs a valid API key in the x-api-key header (or
?apiKey=). Keys come from MCP_API_KEYS (comma-separated); if unset, a
dev-local-key is generated and printed to stderr so local runs still work.
MCP_API_KEYS=key1,key2 PORT=3939 npm run serve:http
# client must send: x-api-key: key1
Rate limiting: tools/call is throttled per (caller, tool) — 60/min by
default, with get_forecast capped tighter at 20/min. Over the limit returns a
JSON-RPC 429 with Retry-After. Both are configured in src/serve-http.ts.
For public deployment also set
allowedHosts/allowedOriginsoninstallMcpHttp(DNS-rebinding protection), and consider a Redisstorefor the rate limiter so buckets are shared across instances.
Dev console
npm run console starts the AgentBack console — a web
UI that composes the MCP inspector (list and invoke your tools from a form),
the OpenAPI/Swagger explorer, and a DI context explorer. Override the
port with PORT=3737 npm run console.
The console serves over HTTP, so it runs a RestApplication (src/console.ts)
that reuses the exact same tool wiring as the stdio server (src/wiring.ts).
It's a development tool — the stdio entry point (src/main.ts) is what you wire
into Claude Desktop / Cursor.
Tools
| Tool | Purpose |
|---|---|
geocode_location |
Resolve a place name (e.g. "Tokyo") to candidate latitude/longitude. |
get_current_weather |
Current conditions by city name or latitude+longitude. |
get_forecast |
Daily forecast (1–16 days) by city or latitude+longitude. |
Each tool accepts temperature_unit (celsius/fahrenheit) and
wind_speed_unit (kmh/ms/mph/kn). When you pass a city, it is
geocoded automatically; pass coordinates directly to skip that step.
How it's wired
src/schemas.ts— the single source of truth. Each Zod schema is simultaneously the runtime validator, thez.infertype, and the agent-visible MCP input/output schema.src/keys.ts— typed DI keys.WEATHER_SERVICE = BindingKey.create<WeatherService>('services.weather')ties the key to its type, so the binding and every@inject(WEATHER_SERVICE)are type-checked.src/weather-service.ts—WeatherService, a stateless Open-Meteo client.@injectabledeclares its own binding: theWEATHER_SERVICEkey (ContextTags.KEY) and singleton scope — it's pure I/O, so one shared instance is reused.src/tools/weather.tools.ts— the@mcpServer()tool class.@mcpServeris built on@injectable: it makes the class an extension of theMCP_SERVERSextension point (singleton by default). Each@toolcarries its Zod schemas and delegates to the injectedWeatherService.src/component.ts—WeatherComponentpackages the static DI contributions in one manifest:MCPComponentplus bothservices(WeatherTools,WeatherService). A tool class is a plain service — the MCP server discovers it as anMCP_SERVERSextension and resolves it through its binding, so constructor@injectis honored (nocontrollerneeded).src/wiring.ts—registerWeatherMcp(app, stdio)addsWeatherComponentand applies the per-entry transport config (stdio on/off). Shared by all three entry points, so they stay in lockstep.src/serve-http.ts— exportsbuildHttpApp()(builds, doesn't start) so tests can drive the api-key auth + rate-limit gate; the CLI run is guarded byisMain(import.meta).
Claude Desktop / Cursor config
{
"mcpServers": {
"weather-mcp": {
"command": "node",
"args": ["/absolute/path/to/weather-mcp/dist/main.js"]
}
}
}
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。