Skip to main content
Glama
terisuke

MCP Weather Service

by terisuke

MCP Weather Service

This repository is a simple service that uses the Model Context Protocol (MCP) to provide weather information for multiple cities (Fukuoka, Tokyo, Osaka, Moscow, New York, etc.).

table of contents

  1. Prerequisites

  2. Project Setup

  3. How to use

  4. Development Guide

  5. Upload to GitHub

  6. troubleshooting

Related MCP server: Weather MCP

Prerequisites

To complete this project, you need the following software:

  • Node.js (version 18 and above)

  • npm (usually installed with Node.js)

  • Git

How to install

Installing Node.js and npm

  1. Download the installer from the official Node.js website and install it.

  2. Once the installation is complete, verify it by running the following command in Terminal:

node -v
npm -v

Installing Git

  1. Download the installer from the official Git website and install it.

  2. Once the installation is complete, verify it by running the following command in Terminal:

git --version

Project Setup

Creating a New Project

  1. Create a new directory and navigate to it:

mkdir my-weather-mcp
cd my-weather-mcp
  1. Initialize your npm project:

npm init -y
  1. Install the required packages:

npm install @modelcontextprotocol/sdk axios zod typescript @types/node https-proxy-agent
npm install --save-dev ts-node
  1. Create a TypeScript configuration file:

npx tsc --init
  1. Edit your tsconfig.json file as follows:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "outDir": "./build",
    "strict": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}
  1. Edit the scripts section of your package.json file as follows:

"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"
}
  1. Create the project directory structure:

mkdir -p src test

Clone an existing project

If you want to use an existing project, clone it:

git clone https://github.com/terisuke/my-weather-mcp.git
cd my-weather-mcp
npm install

How to use

Build and run

To build and run the project, use the following commands:

npm run build && npm run start

Using the Inspector

To test the weather service using the MCP Inspector, run the following command:

npm run build && npm run inspect

Once the Inspector is running, you can interact with the weather service by visiting http://127.0.0.1:6274 in your browser.

Get weather information

Using the Inspector, you can get weather information for the following cities:

  • Fukuoka

  • Tokyo

  • Osaka

  • Moscow

  • new york

Other cities can be specified, but they must be recognized by the Open-Meteo API.

Development Guide

File Structure

my-weather-mcp/
├── build/              # コンパイルされたJavaScriptファイル
├── src/                # TypeScriptソースコード
│   └── index.ts        # メインのアプリケーションコード
├── test/               # テストファイル
├── package.json        # プロジェクト設定
├── tsconfig.json       # TypeScript設定
└── README.md           # このファイル

Fixing the code

  1. Edit the src/index.ts file to add or modify the functionality.

  2. To test your changes, run the following command:

npm run build && npm run inspect
  1. Once you are satisfied that the changes work, commit the changes.

Upload to GitHub

Creating your first GitHub repository

  1. Go to GitHub and create an account or log in.

  2. Click the "+" button in the top right and select "New repository".

  3. Enter a repository name (for example, my-weather-mcp ) and add an optional description.

  4. Set your repository to public or private and click "Create repository".

Initialize and push the local repository

  1. In your local project directory, initialize a Git repository:

git init
  1. Add your changes to the staging area:

git add .
  1. Commit the changes:

git commit -m "初回コミット:MCP天気サービスの実装"
  1. Add a remote repository (using the repository URL from GitHub):

git remote add origin https://github.com/ユーザー名/my-weather-mcp.git
  1. Push the changes to the remote repository:

git push -u origin main

Pushing changes to an existing repository

  1. Add your changes to the staging area:

git add .
  1. Commit the changes:

git commit -m "変更内容の説明"
  1. Push the changes to the remote repository:

git push

Creating a pull request

  1. Go to the repository page on GitHub.

  2. Click the "Pull requests" tab and then click the "New pull request" button.

  3. Select the base branch and the compare branch.

  4. Click the “Create pull request” button.

  5. Enter a title and description for your pull request and click the "Create pull request" button.

troubleshooting

Common problems and solutions

ERR_PACKAGE_PATH_NOT_EXPORTED Error

This error occurs when the import path of the @modelcontextprotocol/sdk package is incorrect. Please fix it as follows:

// 誤ったインポート
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";

Network connection error

If you get a network error while making an API call, please check your proxy settings. You can use a proxy by setting the environment variables HTTP_PROXY or HTTPS_PROXY :

export HTTP_PROXY=http://プロキシサーバー:ポート
export HTTPS_PROXY=https://プロキシサーバー:ポート

Other issues

If the problem persists, please create an issue with the following information:

  • The error message that occurred

  • The version of Node.js and npm you are using

  • Command executed

  • Expected vs. Actual Behavior

Available Tools

1 tool
get-weatherC

Get weather information for a city

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYesCity name to get weather for

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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. 1 tool update
    • First observedget-weather

TDQS

B3/5.0

Scored across 1 tool

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count2/5

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.

Completeness1/5

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

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.
    8
    362 PyPI
    60
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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

Appeared in Searches