Skip to main content
Glama
mcp-example
by Leklyus

mcp-example

Локальный MCP-сервер на Python (MCP SDK + FastMCP, транспорт stdio) с инструментами погоды и времени на базе Open-Meteo. Предназначен для Агента SourceCraft Code Assistant.

Инструменты

Инструмент

Входные параметры

Результат

get_current_weather

city: str

{city, temp_c, wind_kmh, condition}

get_forecast

city: str, days: int

{city, days: [{date, temp_min, temp_max}]}

get_current_time

timezone: str

{timezone, datetime, utc_offset}

Related MCP server: MCP Weather Server

Структура

src/mcp_example/       # код сервера
tests/                 # тесты и JSON-фикстуры
scripts/               # smoke-тест stdio
docs/                  # архитектура, контракты, пример конфигурации

Установка

Через uv:

uv sync --extra dev

Или через venv и pip:

python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"

Запуск

uv run python -m mcp_example

Без uv:

PYTHONPATH=src .venv/bin/python -m mcp_example

Проверка

.venv/bin/python -m pytest -q
.venv/bin/python scripts/smoke_stdio.py

Логирование

Каждый вызов MCP-инструмента пишется в stderr: имя инструмента, аргументы, успешное завершение или ошибка. stdout занят JSON-RPC, поэтому логи туда не попадают.

2026-12-02 07:23:00,123 INFO mcp_example.tools: tool get_current_weather called with city='Moscow'
2026-12-02 07:23:00,456 INFO mcp_example.tools: tool get_current_weather completed, response size 74 chars

Уровень задаётся переменной LOG_LEVEL (DEBUG, INFO, WARNING, ERROR). По умолчанию INFO. При запуске сервера вручную логи видны прямо в терминале.

Подключение к SourceCraft

См. docs/mcp-settings.example.json.

Документация

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides tools to retrieve current weather conditions and daily forecasts for cities worldwide using the Open-Meteo API. This Python-based server enables MCP-compatible clients to access real-time meteorological data through a standardized interface.
      2
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Lightweight MCP server that exposes tools for system information and weather lookup, designed for agent integration via stdio.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that provides current weather for any city using Open-Meteo APIs. It exposes a single tool 'get_weather' returning temperature, humidity, wind, and other weather data.
      1
      9 npm
      MIT