MCP Weather Service

MIT License
4

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 날씨 서비스

이 리포지토리는 Model Context Protocol (MCP)을 사용하여 날씨 정보를 제공하는 간단한 서비스입니다.

목차

  1. 전제 조건
  2. 프로젝트 설정
  3. 사용법
  4. 개발 가이드
  5. GitHub에 업로드
  6. 문제 해결

전제 조건

이 프로젝트를 실행하려면 다음 소프트웨어가 필요합니다.

  • Node.js (버전 18 이상)
  • npm (일반적으로 Node.js와 함께 설치됩니다)
  • Git

설치 방법

Node.js 및 npm 설치
  1. Node.js 공식 사이트 에서 설치 프로그램을 다운로드하여 설치합니다.
  2. 설치가 완료되면 터미널에서 다음 명령을 실행하여 확인합니다.
node -v npm -v
Git 설치
  1. Git 공식 사이트 에서 설치 프로그램을 다운로드하여 설치합니다.
  2. 설치가 완료되면 터미널에서 다음 명령을 실행하여 확인합니다.
git --version

프로젝트 설정

새 프로젝트 만들기

  1. 새 디렉토리를 만들고 해당 디렉토리로 이동합니다.
mkdir my-weather-mcp cd my-weather-mcp
  1. npm 프로젝트를 초기화합니다.
npm init -y
  1. 필요한 패키지를 설치합니다.
npm install @modelcontextprotocol/sdk axios zod typescript @types/node https-proxy-agent npm install --save-dev ts-node
  1. TypeScript 구성 파일을 만듭니다.
npx tsc --init
  1. tsconfig.json 파일을 다음과 같이 편집합니다.
{ "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "esModuleInterop": true, "outDir": "./build", "strict": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true }, "include": ["src/**/*"], "exclude": ["node_modules"] }
  1. 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" }
  1. 프로젝트의 디렉토리 구조를 만듭니다.
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 로 이동하여 날씨 서비스와 상호 작용할 수 있습니다.

날씨 정보 얻기

Inspector를 사용하여 다음 도시의 날씨 정보를 얻을 수 있습니다.

  • 후쿠오카
  • 도쿄
  • 오사카
  • 모스크바
  • 뉴욕

다른 도시도 지정할 수 있지만 Open-Meteo API에서 인식되는 도시 이름이어야 합니다.

개발 가이드

파일 구조

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

코드 수정

  1. src/index.ts 파일을 편집하여 기능을 추가하거나 수정합니다.
  2. 변경사항을 테스트하려면 다음 명령을 실행하십시오.
npm run build && npm run inspect
  1. 변경사항이 제대로 작동하는지 확인한 후 변경사항을 커밋하십시오.

GitHub에 업로드

처음 GitHub 리포지토리 생성

  1. GitHub 로 이동하여 계정을 만들거나 로그인합니다.
  2. 오른쪽 상단의 + 버튼을 클릭하고 새 리포지토리를 선택합니다.
  3. 리포지토리 이름(예: my-weather-mcp )을 입력하고 필요에 따라 설명을 추가합니다.
  4. 리포지토리를 게시 또는 비공개로 설정하고 Create repository를 클릭합니다.

로컬 리포지토리 초기화 및 푸시

  1. 로컬 프로젝트 디렉토리에서 Git 리포지토리를 초기화합니다.
git init
  1. 변경 사항을 준비 영역에 추가합니다.
git add .
  1. 변경 사항을 커밋합니다.
git commit -m "初回コミット:MCP天気サービスの実装"
  1. 원격 리포지토리 추가(GitHub 리포지토리 URL 사용):
git remote add origin https://github.com/ユーザー名/my-weather-mcp.git
  1. 변경 사항을 원격 리포지토리로 푸시합니다.
git push -u origin main

기존 리포지토리로 변경 푸시

  1. 변경 사항을 준비 영역에 추가합니다.
git add .
  1. 변경 사항을 커밋합니다.
git commit -m "変更内容の説明"
  1. 변경 사항을 원격 리포지토리로 푸시합니다.
git push

끌어오기 요청 만들기

  1. GitHub의 리포지토리 페이지로 이동합니다.
  2. 풀 요청 탭을 클릭하고 새 풀 요청 버튼을 클릭합니다.
  3. 베이스 브랜치와 비교 브랜치를 선택합니다.
  4. Create pull request 버튼을 클릭합니다.
  5. 끌어오기 요청의 제목과 설명을 입력하고 Create pull request 버튼을 클릭합니다.

문제 해결

흔한 문제와 해결책

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 버전
  • 실행한 명령
  • 예상되는 동작과 실제 동작

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
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. 목차
    1. 전제 조건
      1. 설치 방법
    2. 프로젝트 설정
      1. 새 프로젝트 만들기
      2. 기존 프로젝트 복제
    3. 사용법
      1. 빌드 및 실행
      2. 인스펙터 사용
      3. 날씨 정보 얻기
    4. 개발 가이드
      1. 파일 구조
      2. 코드 수정
    5. GitHub에 업로드
      1. 처음 GitHub 리포지토리 생성
      2. 로컬 리포지토리 초기화 및 푸시
      3. 기존 리포지토리로 변경 푸시
      4. 끌어오기 요청 만들기
    6. 문제 해결
      1. 흔한 문제와 해결책

    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