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:

ModelDescriptionBest For
claude-3-7-sonnet-20250219Latest Claude 3.7 (default)Most advanced reasoning & creativity
claude-3-5-sonnet-20241022Claude 3.5 SonnetBalanced performance & creativity
claude-3-5-sonnet-latestLatest 3.5 SonnetAlways up-to-date 3.5
claude-3-haiku-20240307Claude 3 HaikuFast, efficient generation
claude-3-opus-20240229Claude 3 OpusMaximum 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

ModelSpeedCreativityDetailCost
Claude 3.7 SonnetFastHighestExcellentModerate
Claude 3.5 SonnetFastHighGoodModerate
Claude HaikuFastestGoodBasicLowest
Claude OpusSlowerHighestMaximumHighest

💡 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