Skip to main content
Glama
andyx

Ambient Weather MCP

by andyx
README.md
# Ambient Weather MCP (Vercel)

Same three tools as your local `index.js` server — `list_devices`,
`get_current_conditions`, `get_history` — reimplemented as a Vercel
serverless function instead of a local stdio process. This is the same
pattern as your existing `bambu_mcp` and `linktap_mcp` deployments.

## Deploy

1. **Create a GitHub repo** and push this folder to it (`git init`, `git add .`,
   `git commit -m "init"`, create the repo on github.com, `git push`).
2. **Import into Vercel**: vercel.com -> Add New -> Project -> select the repo.
   Framework preset should auto-detect as Next.js.
3. **Set environment variables** in the Vercel project (Settings ->
   Environment Variables), same names as `.env.example`:
   - `AMBIENT_API_KEY`
   - `AMBIENT_APP_KEY`
   - `MCP_AUTH_TOKEN` (optional but recommended — see note below)
4. **Deploy.** Your endpoint will be:
   `https://<your-project-name>.vercel.app/api/mcp`

## Connect it to Claude

- **claude.ai**: Settings -> Connectors -> Add custom connector -> paste the
  `/api/mcp` URL. If you set `MCP_AUTH_TOKEN`, add an `Authorization` header
  of `Bearer <your token>` in the connector's auth settings.
- **Claude Desktop**: add it as a remote server in
  `claude_desktop_config.json`:
  ```json
  {
    "mcpServers": {
      "ambient-weather": {
        "url": "https://<your-project-name>.vercel.app/api/mcp",
        "headers": { "Authorization": "Bearer <your token>" }
      }
    }
  }
  ```
  (Omit the `headers` block if you didn't set `MCP_AUTH_TOKEN`.)

## Why add `MCP_AUTH_TOKEN`

Unlike the local version, this endpoint is a public URL. Without a token,
anyone who discovers it could call your tools and burn through your
Ambient Weather API rate limit (1 req/sec, 3,600/hr). Set a long random
string as `MCP_AUTH_TOKEN` and only clients sending that bearer token can
use it.

## Notes vs. the local version

- The request queue (1.1s min interval) and 60s response cache are
  preserved, but only help within a single warm Lambda instance — cold
  starts or concurrent calls won't share state the way a long-running
  local process did. In practice this should still absorb the 429s you
  were seeing before, since Claude's tool calls within one session tend to
  land on the same warm instance.
- No more "MCP server disconnected mid-session" issue — that was a local
  stdio process quirk; an HTTP endpoint doesn't have that failure mode.
- `get_history`'s `limit` cap is set to 5000 (rather than the API's
  documented default of 288) since you've successfully pulled 2016 in the
  past for two-week windows.