A Model Context Protocol (MCP) implementation for weather data with natural language processing capabilities, consisting of a server, API client, and web interface.
This is a monorepo containing three packages:
packages/mcp-server/- MCP server implementation for weather data using National Weather Service APIpackages/mcp-client/- REST API bridge with natural language processing using Google Gemini AIpackages/web-client/- React TypeScript web interface for user interactions
- 🌤️ Current Weather Forecasts - Get weather forecasts for any US location
⚠️ Weather Alerts - Retrieve active weather alerts by state- 🤖 Natural Language Processing - Ask questions in plain English
- 🌐 Web Interface - User-friendly React application
- 🔌 MCP Protocol - Compatible with MCP-enabled applications
- Node.js 18+
- Google Gemini API key (for natural language processing)
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory:GEMINI_API_KEY=your_google_gemini_api_key PORT=3001
-
Build all packages:
npm run build
-
Start the system:
# Terminal 1: Start the MCP client API npm start # Terminal 2: Start the web interface npm run dev:web
-
Access the application:
- Web interface:
http://localhost:3000 - API endpoint:
http://localhost:3001
- Web interface:
Open http://localhost:3000 and try these queries:
- "What's the weather forecast for San Francisco?"
- "Are there any weather alerts in California?"
- "Weather forecast for New York City"
- "Alerts in Texas"
# Get weather forecast
curl -X POST http://localhost:3001/api/weather/query \
-H "Content-Type: application/json" \
-d '{"query": "Weather in Miami"}'
# Get weather alerts
curl -X POST http://localhost:3001/api/weather/query \
-H "Content-Type: application/json" \
-d '{"query": "Alerts in Florida"}'# Build specific packages
npm run build:server
npm run build:client
npm run build:web
# Start web development server
npm run dev:web- MCP Server (
mcp-server) - Provides weather tools via MCP protocol - MCP Client (
mcp-client) - REST API that bridges natural language to MCP tools - Web Client (
web-client) - React interface for end users
- Current data only - No historical weather data
- US locations only - Uses National Weather Service API
- Forecast range - Next few days only
- No climate statistics - No averages or long-term trends
Create a .env file in the root directory:
# Required for natural language processing
GEMINI_API_KEY=your_google_gemini_api_key
# Optional - API server port (default: 3001)
PORT=3001ISC