🌀️ FastMCP Weather Server

by abhilashsahoo

292 downloads Not rated yet

About

A production-ready weather MCP server built with FastMCP and TypeScript for Claude Desktop, VS Code, and Cursor integration.

Explore

- 🌍 Real-time Weather Data - Get current weather for any city worldwide
- πŸ”’ Type-Safe - Built with TypeScript and Zod validation
- πŸ“Š Progress Reporting - Built-in progress tracking for weather requests
- πŸ“ Structured Logging - Comprehensive logging with context
- πŸ› οΈ Easy Testing - Built-in CLI tools for development and debugging
- πŸ”Œ Universal Integration - Works with Claude Desktop, VS Code, and Cursor
- ⚑ Fast Development - 5x faster than traditional MCP SDK

- Node.js 20.18.1 or higher (critical requirement)
- OpenWeatherMap API key (free tier: 1,000 calls/day)

| Variable | Description | Required |
|----------|-------------|----------|
| OPENWEATHER_API_KEY | OpenWeatherMap API key | Yes |
| NODE_ENV | Environment (development/production) | No |

A production-ready weather MCP server built with FastMCP and TypeScript that integrates seamlessly with Claude Desktop, VS Code, and Cursor.

✨ Features

- 🌍 Real-time Weather Data - Get current weather for any city worldwide - πŸ”’ Type-Safe - Built with TypeScript and Zod validation - πŸ“Š Progress Reporting - Built-in progress tracking for weather requests - πŸ“ Structured Logging - Comprehensive logging with context - πŸ› οΈ Easy Testing - Built-in CLI tools for development and debugging - πŸ”Œ Universal Integration - Works with Claude Desktop, VS Code, and Cursor - ⚑ Fast Development - 5x faster than traditional MCP SDK

πŸš€ Quick Start

Prerequisites

- Node.js 20.18.1 or higher (critical requirement) - OpenWeatherMap API key (free tier: 1,000 calls/day)

Installation

``bash git clone https://github.com/abhilashsahoo/fastmcp-weather-server.git cd fastmcp-weather-server npm install `

Setup

1. Get your OpenWeatherMap API key: - Sign up at openweathermap.org/api - Copy your API key from the dashboard 2. Create environment file:
`bash cp .env.example .env ` 3. Add your API key to .env: ` OPENWEATHER_API_KEY=your_api_key_here `

Development

Test your server:
`bash npm run dev ` Try the interactive CLI: ` get_weather {"city": "London"} ` Debug with visual interface: `bash npm run inspect ` Build for production: `bash npm run build `

πŸ”§ MCP Client Integration

Claude Desktop

1. Find your config file: - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows: %APPDATA%\Claude\claude_desktop_config.json 2. Add this configuration: `json { "mcpServers": { "weather": { "command": "npx", "args": ["tsx", "/absolute/path/to/fastmcp-weather-server/src/server.ts"], "env": { "OPENWEATHER_API_KEY": "your_actual_api_key_here" } } } } ` 3. Restart Claude Desktop and test: ` What's the weather like in Tokyo? `

VS Code

1. Install the MCP extension 2. Create
.vscode/settings.json: `json { "mcp.servers": { "weather": { "command": "npx", "args": ["tsx", "./src/server.ts"], "cwd": "${workspaceFolder}", "env": { "OPENWEATHER_API_KEY": "your_actual_api_key_here" } } } } `

Cursor IDE

1. Create
.cursor/mcp.json: `json { "servers": { "weather": { "command": "npx", "args": ["tsx", "./src/server.ts"], "env": { "OPENWEATHER_API_KEY": "your_actual_api_key_here" } } } } `

πŸ“‹ Available Scripts

| Script | Description | |--------|-------------| |
npm run dev | Start FastMCP development server with CLI | | npm run inspect | Open visual debugging interface | | npm run test-direct | Test server directly without CLI | | npm run build | Compile TypeScript to JavaScript | | npm start | Run compiled server |

πŸ› οΈ API Reference

Tools

get_weather
Get current weather information for any city worldwide. Parameters: - city (string, required): City name (e.g., "London", "New York") Returns: - Formatted weather data with temperature, conditions, humidity, and wind speed Example: `json { "city": "London" } ` Response: ` 🌀️ Weather in London: 🌑️ Temperature: 15Β°C (feels like 13Β°C) ☁️ Conditions: partly cloudy πŸ’§ Humidity: 65% πŸ’¨ Wind Speed: 3.2 m/s `

πŸ› Troubleshooting

Common Issues

| Issue | Solution | |-------|----------| | Node.js version error | Update to Node.js 20.18.1+:
winget upgrade OpenJS.NodeJS | | Server not found | Check absolute path in MCP client configuration | | API key errors | Verify API key in .env and MCP client env section | | Module resolution errors | Delete node_modules and run npm install | | FastMCP CLI issues | Try npm run test-direct to test without CLI |

Windows-Specific

Update Node.js via PowerShell:
``powershell
No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.