Handles environment configuration for the MCP server, managing settings like API URLs and model selection.
Provides source control integration for cloning and managing the MCP server codebase.
Hosts the MCP server repository for distribution and collaboration.
Uses Node.js as the runtime environment for the MCP server, with v18+ required for operation.
Manages dependencies and provides scripts for running, testing, and diagnosing the MCP server.
Leverages Ollama's LLM capabilities to provide weather information through a 'get-weather' tool that retrieves weather data for any city.
Implements the MCP server using TypeScript for type-safe code organization and structure.
🌦️ Weather MCP Server Demo
A Model Context Protocol (MCP) compatible server that provides weather information using Ollama's LLM capabilities. This server exposes a get-weather
tool that can be used by MCP clients to retrieve weather information for any city.
🛠 Prerequisites
- Node.js v18+
- Ollama installed and running locally
- Ollama model:
llama3
(or configure your preferred model)
🚀 Complete Setup & Installation
✅ Step 1: Clone and Install
⚙️ Step 2: Setup Environment
####Edit the .env file to contain: OLLAMA_API_URL=http://localhost:11434/api/generate OLLAMA_MODEL=llama3
🤖 Step 3: Install and Setup Ollama
Step 4: Test Ollama Connection
Step 5: Run Diagnostics
🎯 Running the MCP Server
Start the Server
Expected output:
🚀 MCP Weather Server starting... 📡 Ollama URL: http://localhost:11434/api/generate 🤖 Model: llama3 ✅ MCP Server connected and ready!
🔍 Testing with MCP Inspector
Method 1: CLI Inspector
⚙️ Configuration
Environment Variables (.env file)
Performance Tuning
The server is optimized for quick responses:
15-second timeout for HTTP requests Aggressive Ollama parameters for faster generation Fallback from HTTP API to CLI if needed
##🔧 Troubleshooting
Quick Diagnosis
Common Issues & Solutions
Issue: "Request timed out" errors
Issue: "Request timed out" errors
Issue: "Model not found" errors
Issue: Connection errors
Issue: MCP Inspector connection fails
Performance Tips
📁 Project Structure
weather-mcp-server/ ├── .env # Environment configuration ├── .env.example # Environment template ├── .gitignore # Git ignore rules ├── main.ts # MCP server implementation ├── ollamaClient.ts # Ollama API client ├── diagnose.ts # Diagnostic tool ├── package.json # Dependencies and scripts ├── tsconfig.json # TypeScript configuration └── README.md # This file
✅ Success Checklist
Complete this checklist to ensure everything is working:
Node.js v18+ installed Ollama installed and running (ollama serve) Model downloaded (ollama pull llama3) Project dependencies installed (npm install) Environment configured (.env file exists) Diagnostic passes (npm run diagnose) MCP server starts successfully (npm start) MCP Inspector connects successfully Weather tool responds to test quer
🚀 Quick Start Commands
🤝 Contributing
- Fork the repository
- Create a feature branch: git checkout -b feature-name
- Make your changes
- Test with MCP Inspector
- Submit a pull request
This server cannot be installed
A Model Context Protocol compatible server that provides weather information for any city using Ollama's LLM capabilities through an exposed get-weather tool.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.Last updated -34PythonApache 2.0
- -securityAlicense-qualityA Model Context Protocol server that provides standardized interfaces for interacting with Ollama API, offering JSON responses, error handling, and intelligent guidance for LLM-based API calls.Last updated -PythonMIT License
- -security-license-qualityA Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.Last updated -Python
- -securityFlicense-qualityA production-ready Model Context Protocol server that provides weather data from OpenWeatherMap API, allowing users to query current weather by city name or coordinates with support for different temperature units.Last updated -Python