home / mcp / weather mcp server
mcp server and langgraph mcp adapeters
Configuration
View docs{
"mcpServers": {
"haichaozheng-weather-mcp": {
"command": "python",
"args": [
"weather/mcp_third_party.py"
],
"env": {
"ZHIPU_API_KEY": "YOUR_ZHIPU_API_KEY",
"MOONSHOT_API_KEY": "YOUR_MOONSHOT_API_KEY"
}
}
}
}You deploy a multi-source MCP server that unifies local tools, a weather data service, and third-party MCP tools into a single intelligent agent. This setup lets you perform complex tasks such as weather queries, math and string operations, and live web searches through a consistent MCP interface with automatic tool orchestration.
To use the MCP server, start all required local components and then connect your MCP client to the local endpoints. The system exposes three local stdio-based services you run from Python scripts, and a central agent that coordinates all tools. Your queries can combine weather lookups, math calculations, and web search results in a single conversation.
Prerequisites you need before starting are Python 3.11+ and a working Python environment. Ensure you have an active API key setup for Moonshot and Zhīpǔ in your environment.
# Step 1: Create and activate a Python virtual environment
python -m venv weather_venv
# Activate the virtual environment
# Windows
weather_venv\Scripts\activate
# Linux/Mac
source weather_venv/bin/activate
# Step 2: Install dependencies
pip install -r requirements.txtSet up environment variables in a .env file. You need keys for Moonshot and Zhīpǔ API access. The following are required entries.
MOONSHOT_API_KEY=your_actual_api_key
ZHIPU_API_KEY=your_actual_zhipu_api_keyStart the three local services in separate terminals. Each process must run from the project root and use Python to execute the provided scripts.
# Start the weather data server
python weather/weather.py
# Start the comprehensive proxy agent
python weather/agent_with_diverse_tools.py
# Start the Zhīpǔ web search MCP tool tester
python weather/mcp_third_party.pyThe weather server, the main proxy, and the third-party MCP tool rely on environment variables for API access. Ensure your .env file is loaded by the shells running the scripts. The default server runs on localhost, port 8000, and uses the NWS API for weather data. If you modify ports or endpoints, adjust your MCP client configuration accordingly.
If any component fails to start, check the console output for missing dependencies or invalid API keys. Verify that the .env file is loaded in each shell, and confirm that your Python version is 3.11+ and that the virtual environment is active when launching the services.
Fetch US state weather alerts from the weather server's MCP API.
Retrieve weather forecast data by latitude and longitude from the weather server.
Add two numbers using the local math tool.
Subtract the second number from the first using the local math tool.
Multiply two numbers using the local math tool.
Divide the first number by the second using the local math tool.
Compute the square root of a number using the local math tool.
Raise a number to a power using the local math tool.
Join multiple strings with a delimiter using the local string tool.
Convert a string to upper case using the local string tool.
Convert a string to lower case using the local string tool.
Perform real-time web searches via Zhīpǔ MCP tool to fetch up-to-date results.