MCP Weather Service

Integrations

  • Used to make HTTP requests to the Open-Meteo API for fetching weather information for various cities

  • Provides version control functionality for the weather service project, allowing users to clone, commit, and push changes

  • Enables users to store, share, and collaborate on the weather service project through repositories, pull requests, and issue tracking

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

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

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A simple service using Model Context Protocol (MCP) to provide weather information for multiple cities including Fukuoka, Tokyo, Osaka, Moscow, and New York.

  1. table of contents
    1. Prerequisites
      1. How to install
    2. Project Setup
      1. Creating a New Project
      2. Clone an existing project
    3. How to use
      1. Build and run
      2. Using the Inspector
      3. Get weather information
    4. Development Guide
      1. File Structure
      2. Fixing the code
    5. Upload to GitHub
      1. Creating your first GitHub repository
      2. Initialize and push the local repository
      3. Pushing changes to an existing repository
      4. Creating a pull request
    6. troubleshooting
      1. Common problems and solutions

    Related MCP Servers

    • -
      security
      F
      license
      -
      quality
      This is a Model Context Protocol (MCP) server that provides weather information using the National Weather Service (NWS) API. Features Get weather alerts for a US state Get weather forecast for a specific location (using latitude and longitude)
      Last updated -
      Python
      • Linux
      • Apple
    • -
      security
      A
      license
      -
      quality
      A Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.
      Last updated -
      1
      Python
      Apache 2.0
      • Linux
      • Apple
    • A
      security
      A
      license
      A
      quality
      Model Context Protocol (MCP) server that provides weather forecast, warnings, water level associated with flood, and earthquake reports from Malaysia Government's Open API.
      Last updated -
      4
      Python
      MIT License
    • -
      security
      F
      license
      -
      quality
      An MCP server implementation that allows users to fetch and display weather information for specified cities, including temperature, humidity, wind speed, and weather descriptions.
      Last updated -
      Python
      • Linux
      • Apple

    View all related MCP servers

    ID: c9bqfygh4v