loading…
Search for a command to run...
loading…
An SSE-based MCP server for retrieving real-time weather data for a specified location, supporting current conditions and forecasts.
An SSE-based MCP server for retrieving real-time weather data for a specified location, supporting current conditions and forecasts.
This is a tutorial application for setting a Server-Sent Events (SSE) Model Context Protocol (MCP) Server. This server returns weather information for a specified location.
This server demonstrates how to implement a simple MCP SSE server that can be integrated with AI agents.
Clone the repository:
git clone [repository-url]
cd mcp-weather-service
Run the setup script:
scripts/setup.bat
This will:
.venv(Optional) Configure your IDE to use the Python interpreter from .venv
There are several ways to run the server:
python src/mcp_weather_service/weather_server.py
uvicorn mcp_weather_service.weather_server:app --host 127.0.0.1 --port 3001
scripts/launch.bat
Check if the server is running:
http://127.0.0.1:3001/sseevent: endpoint
data: /weather?session_id=f0c33285de5846d79a89f41212acfd75
Using the MCP Inspector:
scripts/inspect.bat
This launches the MCP Protocol Inspector, which allows you to:
http://127.0.0.1:3001/sse (use 127.0.0.1 instead of localhost especially on Windows!)Using with a MCP Client
There is a gradio MCP Client demo that can be used to interact with this server. See that projects' details to set it up
The entry for config.json for THAT project is:
{
"mcpServers": {
"weather": {
"type": "sse",
"url": "http://127.0.0.1"
}
}
}
Gets current weather and forecast for a specified location.
Input Schema:
{
"location_name": {
"type": "string",
"description": "The location to get the weather for"
}
}
Example Response:
{
"currently": {
"current_temperature": 72.5,
"sky": "☀️",
"feels_like": 74.2,
"humidity": 65,
"wind_speed": 8.5,
"wind_direction": "NW↗️",
"visibility": 10,
"uv_index": 5,
"description": "Clear skies",
"forecasts": [
{
"date": "2024-12-05",
"high_temperature": 75.8,
"low_temperature": 62.4
}
]
}
}
The project uses a Python virtual environment located in .venv. To activate it manually:
.venv\Scripts\activate # Windows
source .venv/bin/activate # Unix/MacOS
pyproject.tomlscripts/install_deps.bat to install themServer Won't Start
MCP Inspector Connection Failed
Weather Data Not Returning
MIT License - See LICENSE file for details
Выполни в терминале:
claude mcp add mcp-weather-sse -- npx Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development