Skip to main content
Glama

Weather MCP Server

by steelhead99x

AI-Powered Weather Voice Agent with Configurable Claude Models & Deepgram

A sophisticated Mastra agent that creates uniquely generated weather reports using configurable Claude models for creative prompt generation and Deepgram for high-quality text-to-speech. Each weather report is crafted with AI creativity, ensuring no two reports sound exactly the same.

๐ŸŒŸ Key Features

  • ๐Ÿ”ง Configurable AI Models: Switch between different Claude models via environment variables

  • ๐Ÿค– AI-Generated Content: Uses Claude AI to create unique, natural weather narratives

  • ๐ŸŽญ 4 Dynamic Voice Personalities: Each with distinct characteristics and voice matching

  • ๐ŸŽต High-Quality TTS: Deepgram's Aura voices with personality-matched speakers

  • ๐ŸŒ Real Weather Data: US National Weather Service API integration

  • ๐ŸŽจ Creative Variety: High temperature setting ensures unique outputs every time

  • ๐Ÿ—ฃ๏ธ Natural Speech: Optimized for spoken delivery, no robotic text reading

๐Ÿ”ง Supported Claude Models

Configure via ANTHROPIC_MODEL environment variable:

Model

Description

Best For

claude-3-7-sonnet-20250219

Latest Claude 3.7

(default)

Most advanced reasoning & creativity

claude-3-5-sonnet-20241022

Claude 3.5 Sonnet

Balanced performance & creativity

claude-3-5-sonnet-latest

Latest 3.5 Sonnet

Always up-to-date 3.5

claude-3-haiku-20240307

Claude 3 Haiku

Fast, efficient generation

claude-3-opus-20240229

Claude 3 Opus

Maximum creativity & detail

๐ŸŽญ Available Voice Personalities

1. Professional Weather Forecaster

  • Personality: Authoritative TV weather presenter

  • Voice: Asteria (clear, professional female)

  • Style: "Good morning, this is your weather update for..."

2. Groovy Musician

  • Personality: Laid-back artist giving weather between songs

  • Voice: Luna (warm, friendly tone)

  • Style: "Hey there weather cats, the vibe today is..."

3. Gentle Librarian

  • Personality: Soft-spoken knowledge keeper

  • Voice: Stella (gentle, informative)

  • Style: "According to today's meteorological records..."

4. Sports Broadcaster

  • Personality: High-energy game announcer

  • Voice: Orion (energetic male voice)

  • Style: "Coming to you live with today's weather lineup..."

๐Ÿš€ Quick Start

Development

# Start Mastra development environment with hot reload npm run dev # Run the standalone weather agent npm run start:agent # Test the agent npm run test-agent

The npm run dev command (runs Mastra dev environment on port 4111):

  • ๐Ÿ”„ Loads the full Mastra environment with hot reload

  • ๐Ÿค– Makes the weather agent available via Mastra APIs

  • ๐Ÿ”ง Includes MCP server setup for external clients

  • ๐ŸŒ Serves the Mastra dev UI on http://localhost:4111

  • ๐Ÿ“Š Shows available agents and servers on startup

Installation

pnpm install @mastra/core@latest @mastra/voice-deepgram@latest @ai-sdk/anthropic@latest

Environment Setup

  1. Copy environment template:

cp .env.example .env
  1. Configure your API keys and model:

ANTHROPIC_API_KEY=your_anthropic_api_key_here ANTHROPIC_MODEL=claude-3-7-sonnet-20250219 DEEPGRAM_API_KEY=your_deepgram_api_key_here

Get API Keys:

Run the Agent

npm run start

The agent will show which model it's using and interactively:

  1. ๐Ÿ  Ask for your ZIP code

  2. ๐ŸŒค๏ธ Fetch real weather data

  3. ๐ŸŽญ Let you choose a personality

  4. ๐Ÿค– Generate unique content with your chosen Claude model

  5. ๐ŸŽต Create MP3 with matched voice

  6. ๐Ÿ“ Save file with descriptive name

๐Ÿงช Testing

npm run test-agent

Test both professional and groovy styles with different ZIP codes.

Test Different Models

# Test with Claude 3.7 Sonnet (default) ANTHROPIC_MODEL=claude-3-7-sonnet-20250219 tsx src/claude-weather-generator.ts # Test with Claude 3.5 Sonnet ANTHROPIC_MODEL=claude-3-5-sonnet-20241022 tsx src/claude-weather-generator.ts # Test with Claude Haiku (fast) ANTHROPIC_MODEL=claude-3-haiku-20240307 tsx src/claude-weather-generator.ts

๐ŸŽฏ How It Works

1. Weather Data Collection

// Uses existing weather tool const weatherData = await getWeatherByZip({ zipCode: "90210" });

2. Configurable AI Generation

// Get model from environment const ANTHROPIC_MODEL = process.env.ANTHROPIC_MODEL || 'claude-3-7-sonnet-20250219'; // Claude creates unique narrative with chosen model const result = await generateText({ model: anthropic(ANTHROPIC_MODEL), temperature: 0.8, // High creativity messages: [{ role: 'user', content: personalityPrompt }] });

3. Voice-Matched TTS

// Different Deepgram voices for each personality const voice = new DeepgramVoice({ speaker: tone === 'sports' ? 'orion-en' : 'asteria-en' });

๐Ÿ”„ Model Switching Examples

Development vs Production

# Development - Fast responses ANTHROPIC_MODEL=claude-3-haiku-20240307 # Production - Best quality ANTHROPIC_MODEL=claude-3-7-sonnet-20250219

Cost Optimization

# Budget-conscious ANTHROPIC_MODEL=claude-3-haiku-20240307 # Premium experience ANTHROPIC_MODEL=claude-3-opus-20240229

๐Ÿ“ File Structure

src/ โ”œโ”€โ”€ mastra/ โ”‚ โ”œโ”€โ”€ agents/ โ”‚ โ”‚ โ””โ”€โ”€ weather-agent.ts # Main agent with configurable Claude โ”‚ โ”œโ”€โ”€ scripts/ โ”‚ โ”‚ โ””โ”€โ”€ test-weather-agent.ts # Testing with model display โ”‚ โ””โ”€โ”€ tools/weather.ts # Weather API integration โ”œโ”€โ”€ claude-weather-generator.ts # Standalone Claude testing โ””โ”€โ”€ ... files/ # Generated MP3s โ”œโ”€โ”€ weather-professional-20240115T143045-a1b2c3d4.mp3 โ””โ”€โ”€ weather-groovy-20240115T143210-e5f6g7h8.mp3

๐ŸŽจ Model Comparison Examples

Claude 3.7 Sonnet (Most Advanced)

"Good morning, I'm bringing you the latest atmospheric developments for Los Angeles. We're currently experiencing a delightful partly cloudy tapestry with comfortable temperatures maintaining a steady 72 degrees. Gentle southwest breezes at 10 miles per hour are creating perfect conditions, while precipitation chances remain minimal at just 20 percent. It's shaping up to be an absolutely gorgeous day for any outdoor adventures you might have planned."

Claude Haiku (Fast & Efficient)

"Good morning with your Los Angeles weather update. Partly cloudy skies are dominating today with pleasant 72 degree temperatures. Southwest winds at 10 miles per hour keep things comfortable. There's a slight 20 percent chance of rain, but overall conditions look great. Perfect weather for getting outside and enjoying your day."

๐Ÿ”ง Technical Details

AI Model Integration

  • Configurable Models: Set via ANTHROPIC_MODEL environment variable

  • Default: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219)

  • Temperature: 0.8 (high creativity)

  • Max Tokens: 300 (optimal for weather reports)

  • Runtime Display: Shows current model in use

Voice Synthesis

  • Provider: Deepgram Aura

  • Format: MP3 output

  • Quality: High-fidelity neural voices

  • Voice Matching: Different speakers per personality

Weather Data

  • Source: US National Weather Service API

  • Coverage: All US ZIP codes

  • Data: Temperature, conditions, wind, precipitation, humidity

๐Ÿ› ๏ธ Customization

Switch Models for Different Use Cases

// For development/testing (fast) process.env.ANTHROPIC_MODEL = 'claude-3-haiku-20240307'; // For production (best quality) process.env.ANTHROPIC_MODEL = 'claude-3-7-sonnet-20250219'; // For creative writing (most creative) process.env.ANTHROPIC_MODEL = 'claude-3-opus-20240229';

Add New Personalities

const toneStyles = { // Add your custom personality pirate: { personality: "seafaring pirate captain giving weather from the ship deck", examples: ["Ahoy mateys, the weather be"], characteristics: ["Nautical terminology", "Adventurous spirit"] } };

๐Ÿšจ Error Handling

The agent handles:

  • โŒ Missing API keys (clear guidance provided)

  • โŒ Invalid models (falls back to default)

  • โŒ Invalid ZIP codes (user-friendly error messages)

  • โŒ Network issues (retry mechanisms)

  • โŒ TTS generation failures (fallback options)

  • โŒ File system errors (directory auto-creation)

๐Ÿ“Š Performance by Model

Model

Speed

Creativity

Detail

Cost

Claude 3.7 Sonnet

Fast

Highest

Excellent

Moderate

Claude 3.5 Sonnet

Fast

High

Good

Moderate

Claude Haiku

Fastest

Good

Basic

Lowest

Claude Opus

Slower

Highest

Maximum

Highest

๐Ÿ’ก Use Cases

  • Development: Use Haiku for rapid testing

  • Production: Use 3.7 Sonnet for best quality

  • Creative Content: Use Opus for maximum creativity

  • Cost Optimization: Switch based on usage patterns

  • A/B Testing: Compare different models easily

๐Ÿ”„ Original MCP Server

This extends the original Weather MCP Server. The MCP functionality remains available for Claude Desktop and other MCP clients.

๐Ÿ“œ License

Follows Mastra framework licensing terms.


Powered by configurable Claude models for creative generation and Deepgram Aura for natural speech synthesis ๐Ÿค–๐ŸŽต

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/steelhead99x/mcp-weather-kd'

If you have feedback or need assistance with the MCP directory API, please join our Discord server