Provides storage and retrieval of weather forecasts in Google Cloud SQL PostgreSQL with TTL-based caching, supporting binary storage for text and audio data with internationalization across multiple languages.
Stores weather forecasts with binary text and audio data, automatic expiration management, and storage statistics in a PostgreSQL database with full Unicode and internationalization support.
Forecast Storage MCP Server
A Model Context Protocol (MCP) server for storing weather forecasts in Google Cloud SQL PostgreSQL.
Features
✅ Binary storage for text and audio with unicode support
✅ Full internationalization - supports all languages (English, Spanish, Chinese, Japanese, Arabic, etc.)
✅ TTL-based caching with automatic expiration
✅ Cloud SQL integration with secure connections
✅ Storage statistics and per-city breakdown
✅ Automatic encoding detection (utf-8, utf-16, utf-32)
Setup
1. Create Cloud SQL Instance
2. Apply Database Schema
3. Configure Environment
4. Install Dependencies
5. Run MCP Server
MCP Tools
1. upload_forecast
Upload a complete forecast (text + audio) to Cloud SQL.
Note: audio_data should be base64-encoded WAV audio data, not a file path. This allows the MCP server to work in remote/containerized environments.
2. get_cached_forecast
Retrieve cached forecast if available and not expired.
Returns:
cached: true/falseforecast_text: decoded unicode textaudio_data: base64-encoded audioage_seconds: age of cached forecast
3. cleanup_expired_forecasts
Remove expired forecasts from database.
4. get_storage_stats
Get database storage statistics.
Returns:
Total forecasts
Storage sizes
Encodings used
Languages used
Per-city breakdown
5. list_forecasts
List forecast history.
6. test_connection
Test database connection.
Integration with Weather Agent
The MCP server is designed to integrate with the weather agent system. See the main project README for integration details.
Database Schema
The forecasts table stores:
Binary text (BYTEA) with encoding metadata
Binary audio (BYTEA)
Unicode support (utf-8, utf-16, utf-32)
Internationalization (language, locale)
TTL management (forecast_at, expires_at)
Storage metadata (sizes, encoding, metadata JSONB)
Development
Testing Connection
Running Tests
Troubleshooting
Connection Issues
Verify Cloud SQL instance is running
Check firewall rules allow connections
Verify credentials in .env file
Test with
test_connectiontool
Encoding Issues
Default encoding is utf-8 (works for most languages)
Use utf-16 for heavy CJK (Chinese/Japanese/Korean) text
Encoding is auto-detected if not specified
Cost Estimation
Development (db-f1-micro):
Instance: ~$7/month (with auto-pause: ~$3.50/month)
Storage (10GB): ~$1.70/month
Total: ~$5-9/month
Production (db-custom-2-7680):
Instance: ~$130/month (with auto-pause: ~$65/month)
Storage (50GB): ~$8.50/month
Total: ~$70-140/month
License
Part of the weather-lab project.