Skip to main content
Glama
MCP Weather Service

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

Inputs: city (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    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 recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.
      8
      2,325 PyPI
      61
      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