ambient-weather-mcp

ambient-weather-mcp

Enables natural language queries about Ambient Weather personal weather station data, including current conditions and device info.

Category
访问服务器

README

Ambient Weather MCP Server

An MCP (Model Context Protocol) server that connects AI assistants to Ambient Weather personal weather station data. Ask natural language questions about your weather station instead of parsing raw JSON from the API.

What It Does

This server exposes your Ambient Weather station data as MCP tools. Connect it to Claude Desktop, VS Code, or Kiro, and you can ask things like:

  • "List my weather stations"
  • "What's the current temperature at my station?"
  • "What are the conditions at CC:7B:5C:51:EC:52?"

The AI calls the tool, the server fetches live data from the Ambient Weather REST API, and the AI presents the result in natural language.

Architecture

┌──────────────────┐    stdio (JSON-RPC)    ┌────────────────────┐
│   MCP Client     │◄─────────────────────►│   MCP Server       │
│  Claude Desktop  │                        │   (this project)   │
│  VS Code / Kiro  │                        │                    │
└──────────────────┘                        │  src/server.py     │
                                            │    ↓ calls          │
                                            │  src/ambient_client │
                                            │    ↓ HTTPS          │
                                            └────────┬───────────┘
                                                     │
                                            ┌────────▼───────────┐
                                            │  Ambient Weather   │
                                            │  REST API          │
                                            │  rt.ambientweather │
                                            │  .net/v1           │
                                            └────────────────────┘

Available Tools

Tool Description Parameters
ping Health check — confirms server is running and keys are configured None
get_devices Lists all weather stations on the account with latest readings None
get_current_weather Full weather report from a specific station mac_address

Prerequisites

  1. Ambient Weather API keys — generate both at https://dashboard.ambientweather.net/account
    • Application Key: identifies the MCP server app
    • API Key: grants read access to device data
  2. Python 3.13+ installed
  3. uv — modern Python package manager. Install: curl -LsSf https://astral.sh/uv/install.sh | sh
  4. An Ambient Weather station reporting to ambientweather.net (or access to someone's API key who has one)

Setup (Local Development)

# Clone the repo
git clone https://github.com/NanaGyamfiPrempeh30/ambient-weather-mcp.git
cd ambient-weather-mcp

# Install dependencies (uv creates .venv automatically)
uv sync

# Configure API keys
cp .env.example .env
# Edit .env with your actual keys

# Test the server
uv run python -c "from src.server import ping; import asyncio; print(asyncio.run(ping()))"

You should see:

Ambient Weather MCP server is running.
API Key: configured
Application Key: configured
API Client: ready

Connecting to Claude Desktop

Windows (with batch file)

  1. Create run_mcp.bat in the project root:
@echo off
cd /d C:\Users\YourUsername\ambient-weather-mcp
C:\Python313\python.exe -m src
  1. Add to claude_desktop_config.json (found at %APPDATA%\Claude\claude_desktop_config.json):
{
  "mcpServers": {
    "ambient-weather": {
      "command": "cmd.exe",
      "args": ["/c", "C:\\Users\\YourUsername\\ambient-weather-mcp\\run_mcp.bat"],
      "env": {
        "AMBIENT_API_KEY": "your-api-key",
        "AMBIENT_APP_KEY": "your-application-key"
      }
    }
  }
}

macOS / Linux (direct)

Add to Claude Desktop config:

{
  "mcpServers": {
    "ambient-weather": {
      "command": "uv",
      "args": ["run", "python", "-m", "src"],
      "cwd": "/path/to/ambient-weather-mcp",
      "env": {
        "AMBIENT_API_KEY": "your-api-key",
        "AMBIENT_APP_KEY": "your-application-key"
      }
    }
  }
}
  1. Restart Claude Desktop fully (quit from system tray, reopen).
  2. Check Settings → Developer → ambient-weather shows running.
  3. In a new chat, ask: "Use the get_devices tool to list my weather stations"

Running with Docker

# Build
docker build -t ambient-weather-mcp .

# Run
docker run -i --rm \
  -e AMBIENT_API_KEY="your-api-key" \
  -e AMBIENT_APP_KEY="your-app-key" \
  ambient-weather-mcp

The Docker image is also published to GitHub Container Registry on every push to main:

docker pull ghcr.io/nanagyamfiprempeh30/ambient-weather-mcp:latest

CI/CD

Every push to main triggers two GitHub Actions workflows:

  • Build and Push — builds the Docker image, runs a smoke test, and pushes to ghcr.io with latest and commit SHA tags
  • Secret Scanning — runs TruffleHog to detect accidentally committed secrets

A pre-commit hook (TruffleHog) also scans locally before every commit. See .pre-commit-config.yaml for setup instructions.

Project Structure

ambient-weather-mcp/
├── .github/
│   └── workflows/
│       ├── build-and-push.yml   # Docker build + push to ghcr.io
│       └── secret-scan.yml      # TruffleHog secret scanning
├── .kiro/
│   └── specs/
│       ├── requirements.md      # EARS-format requirements
│       ├── design.md            # Technical architecture
│       └── tasks.md             # Implementation tasks
├── kubernetes/
│   ├── namespace.yaml
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── ingress.yaml
│   ├── servicemonitor.yaml
│   └── secret.yaml.example     # Secret template (safe to commit)
├── src/
│   ├── __init__.py              # Package marker
│   ├── __main__.py              # Entry point for python -m src
│   ├── server.py                # MCP server + tool definitions
│   └── ambient_client.py        # Ambient Weather REST API client
├── .env.example                 # API key template (safe to commit)
├── .gitignore                   # Excludes .env, .venv, __pycache__
├── .dockerignore                # Excludes secrets from Docker image
├── .pre-commit-config.yaml      # TruffleHog pre-commit hook
├── Dockerfile                   # Container build recipe (uses uv)
├── pyproject.toml               # Python dependencies (managed by uv)
├── uv.lock                      # Locked dependency versions
├── run_mcp.bat                  # Windows launcher for Claude Desktop
├── DEBUG_LOG.md                 # Error tracking log
└── README.md                    # This file

API Rate Limits

The Ambient Weather API enforces:

  • 1 request/second per API key
  • 3 requests/second per Application key

The server includes a 60-second TTL cache to stay within these limits automatically. Weather stations only report every 5 minutes, so caching loses nothing.

Environment Variables

Variable Required Description
AMBIENT_API_KEY Yes Ambient Weather API key
AMBIENT_APP_KEY Yes Ambient Weather Application key
CACHE_TTL_SECONDS No Cache duration in seconds (default: 60)
LOG_LEVEL No DEBUG, INFO, WARNING, ERROR (default: INFO)

Troubleshooting

"No module named src" — Make sure you're running from the project root directory. On Windows with Claude Desktop, use the cmd.exe + batch file method shown above.

"Server disconnected" in Claude Desktop — On Windows, use the cmd.exe + batch file method. Direct Python execution has working directory issues with Claude Desktop on Windows.

"401 Unauthorized" — API keys are invalid. Regenerate at https://dashboard.ambientweather.net/account

"No weather stations found" — The API key doesn't have any stations attached. You need a physical Ambient Weather station registered to the account.

"429 Too Many Requests" — Rate limit hit. Wait a few seconds. Increase CACHE_TTL_SECONDS if it keeps happening.

See DEBUG_LOG.md for a full history of issues encountered and their resolutions.

What's Next

  • [x] CI/CD pipeline (GitHub Actions → ghcr.io)
  • [x] Kubernetes manifests for ArgoCD deployment
  • [x] Kiro spec-driven workflow (requirements, design, tasks)
  • [x] TruffleHog secret scanning (pre-commit + GitHub Actions)
  • [x] Migrate from pip to uv
  • [ ] get_weather_history tool for historical data queries
  • [ ] Security scanning tools (ruff, bandit, semgrep, safety)
  • [ ] Replace .env with proper secrets management
  • [ ] HTTP transport for network-based deployment
  • [ ] Publish to MCP marketplaces (mcp.so, Smithery, Sevalla)
  • [ ] MCP OAuth authorization for secure multi-user access
  • [ ] Medium article as Claude Partner Network case study

Credits

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选