Weather MCP

Weather MCP Server Config Generator

Configure a weather MCP server for Claude Desktop, Claude Code, or Cursor, compare public/free weather server options, handle API keys safely, and troubleshoot common connection errors.

最后更新: 2026年7月1日

功能对比

ClientConfig shapeBest use
Claude DesktopmcpServers entry in desktop configManual local demos and non-repo weather tool tests.
Claude CodeProject or user MCP config with env varsRepo workflows that need weather data while coding demos or agents.
CursorCursor MCP JSON with absolute commands when neededEditor-first weather tool tests and API integration examples.
Public/free weather MCP serverHosted URL or package-specific commandQuick evaluation only after checking maintenance and data policy.
OpenAPI-to-MCP adapterGenerated local adapter from a weather REST APICustom weather APIs or internal forecast services.

Config Generator Inputs

Pick a client, package command, and weather API provider, then keep the API key in environment variables. Last updated July 1, 2026; package names and config locations may change.

  • Client: Claude Desktop, Claude Code, Cursor, or another MCP-compatible tool.
  • Provider: public demo endpoint, OpenWeather-style API, WeatherAPI-style API, or internal forecast API.
  • Credential: API key or bearer token stored outside committed config.
  • Scope: read-only current weather, forecast, alerts, or geocoding.

Claude Desktop Config Example

Use a local server command and environment variables. Replace package names and keys with the server you actually reviewed.

{
  "mcpServers": {
    "weather": {
      "command": "npx",
      "args": ["-y", "weather-mcp-server"],
      "env": { "WEATHER_API_KEY": "${WEATHER_API_KEY}" }
    }
  }
}

Claude Code And Cursor Examples

For GUI-launched apps such as Cursor, absolute paths can avoid PATH issues. For Claude Code, document the expected command in repo instructions.

Claude Code:
{
  "mcpServers": { "weather": { "command": "node", "args": ["dist/weather-server.js"] } }
}

Cursor:
{
  "mcpServers": { "weather": { "command": "/absolute/path/to/node", "args": ["/repo/dist/weather-server.js"] } }
}

API Key Notes

Weather APIs can have rate limits, paid tiers, and location data considerations. A free weather MCP server is only safe after you understand what provider it calls and where the key is stored.

  • Use read-only keys with the smallest useful quota.
  • Do not commit keys to mcp.json, Cursor config, or examples.
  • Avoid sending precise private locations unless the user explicitly approves that workflow.
  • Document quota errors and fallback behavior.

Common Errors

Most weather MCP failures are command, package, credential, or network issues rather than model issues.

  • spawn npx ENOENT: Cursor cannot find npx; use an absolute path.
  • 401 or invalid key: the weather API key is missing, expired, or in the wrong env var.
  • 429 or quota exceeded: reduce agent calls or use a provider limit.
  • No tools listed: the server started but did not register MCP tools correctly.
  • Wrong location: require city, latitude/longitude, or units explicitly in tool schema.

常见问题

Is there a free weather MCP server?

There are community and demo weather MCP servers, but free usually refers to the package or trial API tier. Verify the provider, quota, and data policy before relying on it.

Where should the weather API key go?

Use environment variables or a managed secret store. Do not hard-code real keys in MCP config or examples.

Can I build a weather MCP server from OpenAPI?

Yes. A weather REST API with an OpenAPI spec is a good candidate for an OpenAPI-to-MCP adapter after schema pruning.

Which client should I test first?

Test locally with Claude Desktop or Claude Code first, then add Cursor or a hosted adapter after the command and API key behavior are stable.