MCP Server
MCP-сервер
Расширяемый сервер Model Context Protocol (MCP) с инструментами для получения погоды и времени. Создан для обучения — подключите его к Claude Desktop и начните общение.
Начало работы
1. Клонирование и установка
git clone <repo-url> && cd mcp-server
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux / WSL
pip install -e .Или с помощью uv:
git clone <repo-url> && cd mcp-server
uv venv
source .venv/bin/activate
uv pip install -e .2. Подключение к Claude Desktop
Запустите скрипт настройки, чтобы автоматически записать файл конфигурации Claude Desktop:
macOS:
python setup_claude_agent.pyЭто запишет файл ~/Library/Application Support/Claude/claude_desktop_config.json, указывающий на .venv/bin/python вашего проекта.
Если ваш проект находится в нестандартном месте, укажите его явно:
python setup_claude_agent.py --project-path /path/to/mcp-serverWindows (через WSL):
python3 setup_claude_agent.py --windows --win-user <YourWindowsUser> --wsl-user <YourWSLUser>Например:
python3 setup_claude_agent.py --windows --win-user Cam --wsl-user camЭто запишет файл %APPDATA%\Claude\claude_desktop_config.json и настроит Claude Desktop на запуск сервера через WSL.
3. Перезапуск Claude Desktop
Закройте и снова откройте Claude Desktop. Чтобы убедиться, что сервер подключен, перейдите в Settings → Developer — вы должны увидеть mcp-server с зеленым значком running.
4. Попробуйте в действии
Спросите у Claude что-нибудь из следующего:
"What time is it?" — использует инструмент
get_current_time"Get weather alerts for California" — использует ресурс
weather://alerts/CA"What's the forecast for latitude 40.7128, longitude -74.0060?" — использует ресурс прогноза
Вам не нужно запускать сервер вручную — Claude Desktop запускает его автоматически.
Related MCP server: mcp-weather
Доступные инструменты и ресурсы
Тип | Название | Что делает |
Инструмент |
| Возвращает текущее время с автоматическим определением часового пояса |
Ресурс |
| Оповещения о погоде для штата США (например, |
Ресурс |
| Прогноз на 5 периодов для координат |
Промпт |
| Помогает Claude выполнить полный анализ погоды |
Промпт |
| Помогает с проверкой, преобразованием и сравнением часовых поясов |
Добавление собственных инструментов
Откройте src/mcp_server/server.py и добавьте функцию с декоратором @mcp.tool():
@mcp.tool()
async def my_tool(param: str) -> str:
"""Description of what this tool does."""
return f"Result for {param}"Перезапустите Claude Desktop, чтобы изменения вступили в силу.
Информацию о ресурсах и промптах см. в CONTRIBUTING.md.
Запуск тестов
pip install -e ".[dev]" # or: uv pip install -e ".[dev]"
pytestСтруктура проекта
src/mcp_server/
├── server.py # MCP server entry point — register tools here
└── tools/
├── weather/ # Weather alerts & forecasts (NWS API)
├── time/ # IP-based timezone & current time
└── conversation/ # Conversation toolsЛицензия
MIT
Ресурсы
Available Tools
4 toolsclear_old_cacheA
Clear expired weather cache entries.
Args: max_age_minutes: Maximum age in minutes before considering expired
Returns: Status message with number of entries removed
Inputs: max_age_minutes. Returns: result
get_alertsA
Get active weather alerts for a US state.
Provides current weather alerts and warnings for the specified state. Checks cache first (30 min expiry), fetches fresh if needed.
Args: state: Two-letter US state code (e.g. CA, NY)
Inputs: state (required). Returns: result
get_current_timeA
Get the current time based on the user's IP address.
This tool determines the user's timezone from their IP address using geolocation and returns the current local time in that timezone.
Args: ip_address: Optional IP address to determine timezone. If not provided or empty string, attempts to detect automatically or defaults to UTC.
Returns: Formatted string with current time, timezone, day, and ISO timestamp
Inputs: ip_address. Returns: result
get_forecastA
Get weather forecast for geographic coordinates.
Provides a 5-day forecast for the specified location. Checks cache first (60 min expiry), fetches fresh if needed.
Args: latitude: Latitude of the location (-90 to 90) longitude: Longitude of the location (-180 to 180)
Inputs: latitude (required), longitude (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct function: cache management, alerts, current time, and forecast. No overlap or ambiguity.
All names follow a consistent verb_noun snake_case pattern (clear_old_cache, get_alerts, get_current_time, get_forecast).
With 4 tools, the set is slightly sparse but well-scoped for a combined weather/time server. Each tool serves a clear purpose.
Missing current weather conditions and location-based time input; only alerts and forecast for weather, time only via IP. Notable gaps exist.
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
An MCP server for weather information by @kulybaba
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides real-time weather data from Open-Meteo API, mathematical calculations, and time zone information through MCP protocol. Works with both Claude Desktop and Gemini AI CLI for natural language interactions.MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server built with the mcp-framework to provide weather-related tools and data to AI clients. It enables integration of weather capabilities and custom tools into the MCP ecosystem for use with platforms like Claude Desktop.-
- AlicenseAqualityDmaintenanceAn MCP server that provides weather and time tools, enabling users to get current time, weather alerts, and forecasts through natural language with Claude Desktop.4MIT
- FlicenseBqualityDmaintenanceA Python MCP server providing weather and date tools for travel planning, compatible with Google ADK and Claude Desktop.2-