A Model Context Protocol (MCP) server that demonstrates all three core MCP primitives: Tools, Resources, and Prompts. Provides weather information and clothing recommendations using the Open-Meteo API.
get_current_weather- Get current weather conditions for any locationget_forecast- Get multi-day weather forecast (1-16 days)
weather://clothing/{condition}- Clothing recommendations for different weather conditions:- hot, cold, mild, rainy, snowy, windy
what-to-wear- Combines current weather with clothing recommendations for personalized advice
npm installBuild the TypeScript project and set executable permissions:
npm run buildThe compiled output will be in the ./build directory, with build/index.js as the entry point.
The server communicates via stdio and is designed to be run by an MCP client (like Claude Desktop):
node build/index.jsAdd to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/absolute/path/to/test-mcp-server/build/index.js"]
}
}
}The MCP Inspector provides a web interface for testing your server's tools, resources, and prompts.
# 1. Build your server
npm run build
# 2. Launch the Inspector
npx @modelcontextprotocol/inspector node build/index.jsThis will:
- Start the Inspector web interface (typically at
http://localhost:5173) - Connect to your server via stdio
- Open your browser automatically
Once the Inspector is running, you can test:
-
Tools Tab:
- Test
get_current_weatherwith locations like "San Francisco, CA" - Test
get_forecastwith different day counts (1-16)
- Test
-
Resources Tab:
- Browse clothing resources:
weather://clothing/hot,weather://clothing/cold, etc. - View resource metadata and contents
- Browse clothing resources:
-
Prompts Tab:
- Try the
what-to-wearprompt with different locations - See how prompts combine tools and resources
- Try the
-
Notifications Pane:
- Monitor server logs and debug messages
- Watch for errors or API issues
- Make changes to your code
- Rebuild:
npm run build - Refresh the Inspector page to reconnect
- Test your changes
The project follows a feature-modular architecture:
src/
├── index.ts # Entry point - transport setup
├── server.ts # MCP server configuration
├── api/
│ └── open-meteo-client.ts # Open-Meteo API client
├── tools/
│ ├── types.ts # Tool types & schemas
│ └── weather.ts # Weather tool implementations
├── resources/
│ ├── types.ts # Resource types
│ ├── clothing.ts # Clothing data
│ └── clothing-resources.ts # Resource implementations
└── prompts/
├── types.ts # Prompt types & schemas
└── what-to-wear.ts # Prompt implementations
Uses the free and open-source Open-Meteo API:
- No authentication required
- Global coverage from 20+ national weather services
- Current conditions and forecasts up to 16 days
See CLAUDE.md for detailed development guidance, including how to add new tools, resources, and prompts.
MIT