MCP Weather Service
Метеорологическая служба MCP
Этот репозиторий представляет собой простую службу, которая предоставляет информацию о погоде с использованием протокола контекста модели (MCP). Вы можете получить информацию о погоде для нескольких городов (Фукуока, Токио, Осака, Москва, Нью-Йорк и т. д.).
оглавление
Related MCP server: Weather MCP
Предпосылки
Для выполнения этого проекта вам понадобится следующее программное обеспечение:
Node.js (версия 18 и выше)
npm (обычно устанавливается вместе с Node.js)
Гит
Как установить
Установка Node.js и npm
Загрузите установщик с официального сайта Node.js и установите его.
После завершения установки проверьте ее, выполнив следующую команду в Терминале:
node -v
npm -vУстановка Git
Загрузите установщик с официального сайта Git и установите его.
После завершения установки проверьте ее, выполнив следующую команду в Терминале:
git --versionНастройка проекта
Создание нового проекта
Создайте новый каталог и перейдите в него:
mkdir my-weather-mcp
cd my-weather-mcpИнициализируйте свой проект npm:
npm init -yУстановите необходимые пакеты:
npm install @modelcontextprotocol/sdk axios zod typescript @types/node https-proxy-agent
npm install --save-dev ts-nodeСоздайте файл конфигурации TypeScript:
npx tsc --initОтредактируйте файл
tsconfig.jsonследующим образом:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"outDir": "./build",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}Отредактируйте раздел скриптов вашего файла
package.jsonследующим образом:
"scripts": {
"build": "tsc && node -e \"import('fs').then(fs => fs.default.chmodSync('build/index.js', '755'))\"",
"start": "node build/index.js",
"inspect": "npx @modelcontextprotocol/inspector build/index.js",
"dev": "ts-node src/index.ts"
}Создайте структуру каталогов проекта:
mkdir -p src testКлонировать существующий проект
Если вы хотите использовать существующий проект, клонируйте его:
git clone https://github.com/terisuke/my-weather-mcp.git
cd my-weather-mcp
npm installКак использовать
Построить и запустить
Для сборки и запуска проекта используйте следующие команды:
npm run build && npm run startИспользование инспектора
Чтобы протестировать службу погоды с помощью MCP Inspector, выполните следующую команду:
npm run build && npm run inspectПосле запуска Inspector вы можете взаимодействовать со службой погоды, перейдя по адресу http://127.0.0.1:6274 в своем браузере.
Получить информацию о погоде
С помощью Инспектора вы можете получить информацию о погоде в следующих городах:
Фукуока
Токио
Осака
Москва
Нью-Йорк
Можно указать и другие города, но они должны распознаваться API Open-Meteo.
Руководство по разработке
Структура файла
my-weather-mcp/
├── build/ # コンパイルされたJavaScriptファイル
├── src/ # TypeScriptソースコード
│ └── index.ts # メインのアプリケーションコード
├── test/ # テストファイル
├── package.json # プロジェクト設定
├── tsconfig.json # TypeScript設定
└── README.md # このファイルИсправление кода
Отредактируйте файл
src/index.tsчтобы добавить или изменить функциональность.Чтобы проверить изменения, выполните следующую команду:
npm run build && npm run inspectКак только вы убедитесь, что изменения работают, зафиксируйте их.
Загрузить на GitHub
Создание вашего первого репозитория GitHub
Перейдите на GitHub и создайте учетную запись или войдите в систему.
Нажмите кнопку «+» в правом верхнем углу и выберите «Новый репозиторий».
Введите имя репозитория (например,
my-weather-mcp) и добавьте необязательное описание.Сделайте свой репозиторий публичным или частным и нажмите «Создать репозиторий».
Инициализируйте и отправьте локальный репозиторий
В локальном каталоге проекта инициализируйте репозиторий Git:
git initДобавьте изменения в область подготовки:
git add .Внесите изменения:
git commit -m "初回コミット:MCP天気サービスの実装"Добавьте удаленный репозиторий (используя URL-адрес репозитория из GitHub):
git remote add origin https://github.com/ユーザー名/my-weather-mcp.gitОтправьте изменения в удаленный репозиторий:
git push -u origin mainПередача изменений в существующий репозиторий
Добавьте изменения в область подготовки:
git add .Внесите изменения:
git commit -m "変更内容の説明"Отправьте изменения в удаленный репозиторий:
git pushСоздание запроса на извлечение
Перейдите на страницу репозитория на GitHub.
Нажмите вкладку «Запросы на извлечение», а затем нажмите кнопку «Новый запрос на извлечение».
Выберите базовую ветвь и ветвь сравнения.
Нажмите кнопку «Создать запрос на извлечение».
Введите название и описание вашего запроса на извлечение и нажмите кнопку «Создать запрос на извлечение».
Поиск неисправностей
Распространенные проблемы и решения
Ошибка ERR_PACKAGE_PATH_NOT_EXPORTED
Эта ошибка возникает, если путь импорта для пакета @modelcontextprotocol/sdk неверен. Пожалуйста, исправьте это следующим образом:
// 誤ったインポート
import { McpServer } from "@modelcontextprotocol/sdk";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/transports";
// 正しいインポート
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";Ошибка сетевого подключения
Если при выполнении вызова API возникает сетевая ошибка, проверьте настройки прокси-сервера. Вы можете использовать прокси, установив переменные среды HTTP_PROXY или HTTPS_PROXY :
export HTTP_PROXY=http://プロキシサーバー:ポート
export HTTPS_PROXY=https://プロキシサーバー:ポートДругие вопросы
Если проблема не устранена, пожалуйста, создайте сообщение о проблеме, указав следующую информацию:
Сообщение об ошибке, которое произошло
Версию Node.js и npm, которую вы используете
Команда выполнена.
Ожидаемое и фактическое поведение
Available Tools
1 toolget-weatherC
Get weather information for a city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | City name to get weather for |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the basic function without mentioning any behavioral traits such as rate limits, error handling, data freshness, or authentication requirements. For a tool with no annotations, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance. Every part of the sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like performance, errors, or return format, which are crucial for a tool that fetches dynamic data like weather. The description alone is insufficient for full contextual understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the single parameter 'city' documented as 'City name to get weather for'. The description adds no additional semantic context beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('weather information') with the target ('for a city'). It's specific about what the tool does, but since there are no sibling tools, it doesn't need to differentiate from alternatives. It avoids tautology by not just restating the name.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives or any contextual prerequisites. It simply states the function without indicating scenarios, limitations, or comparisons to other tools. This leaves usage entirely implicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
get-weather
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool 'get-weather' has a clear, singular purpose that cannot be confused with any other tool in the set.
The single tool name 'get-weather' follows a consistent verb_noun pattern, and with only one tool, there is no inconsistency or deviation to evaluate. The naming is straightforward and predictable.
A single tool for a weather service is too few for the apparent scope, as it lacks basic operations like forecasts, historical data, or multi-location queries. This minimal set feels thin and incomplete for a typical weather domain.
The tool surface is severely incomplete for a weather service. It only provides current weather for a city, missing essential operations such as forecasts, alerts, historical data, or support for multiple locations, which are core to weather-related workflows.
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
An MCP server for weather information by @kulybaba
An MCP server for weather information by @kulybaba
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.81,939 PyPI60Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.1-
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides real-time weather data and forecasts for any city.14 npmISC
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides weather information using the Open-Meteo API, allowing users to get current weather for specific cities and retrieve weather data for date ranges.Apache 2.0