MCP Weather Service
MCP 날씨 서비스
이 리포지토리는 Model Context Protocol (MCP)을 사용하여 날씨 정보를 제공하는 간단한 서비스입니다.
목차
Related MCP server: Weather MCP
전제 조건
이 프로젝트를 실행하려면 다음 소프트웨어가 필요합니다.
Node.js (버전 18 이상)
npm (일반적으로 Node.js와 함께 설치됩니다)
Git
설치 방법
Node.js 및 npm 설치
Node.js 공식 사이트 에서 설치 프로그램을 다운로드하여 설치합니다.
설치가 완료되면 터미널에서 다음 명령을 실행하여 확인합니다.
node -v
npm -vGit 설치
Git 공식 사이트 에서 설치 프로그램을 다운로드하여 설치합니다.
설치가 완료되면 터미널에서 다음 명령을 실행하여 확인합니다.
git --version프로젝트 설정
새 프로젝트 만들기
새 디렉토리를 만들고 해당 디렉토리로 이동합니다.
mkdir my-weather-mcp
cd my-weather-mcpnpm 프로젝트를 초기화합니다.
npm init -y필요한 패키지를 설치합니다.
npm install @modelcontextprotocol/sdk axios zod typescript @types/node https-proxy-agent
npm install --save-dev ts-nodeTypeScript 구성 파일을 만듭니다.
npx tsc --inittsconfig.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 inspectInspector가 시작되면 브라우저에서 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 # このファイル코드 수정
src/index.ts파일을 편집하여 기능을 추가하거나 수정합니다.변경사항을 테스트하려면 다음 명령을 실행하십시오.
npm run build && npm run inspect변경사항이 제대로 작동하는지 확인한 후 변경사항을 커밋하십시오.
GitHub에 업로드
처음 GitHub 리포지토리 생성
GitHub 로 이동하여 계정을 만들거나 로그인합니다.
오른쪽 상단의 + 버튼을 클릭하고 새 리포지토리를 선택합니다.
리포지토리 이름(예:
my-weather-mcp)을 입력하고 필요에 따라 설명을 추가합니다.리포지토리를 게시 또는 비공개로 설정하고 Create repository를 클릭합니다.
로컬 리포지토리 초기화 및 푸시
로컬 프로젝트 디렉토리에서 Git 리포지토리를 초기화합니다.
git init변경 사항을 준비 영역에 추가합니다.
git add .변경 사항을 커밋합니다.
git commit -m "初回コミット:MCP天気サービスの実装"원격 리포지토리 추가(GitHub 리포지토리 URL 사용):
git remote add origin https://github.com/ユーザー名/my-weather-mcp.git변경 사항을 원격 리포지토리로 푸시합니다.
git push -u origin main기존 리포지토리로 변경 푸시
변경 사항을 준비 영역에 추가합니다.
git add .변경 사항을 커밋합니다.
git commit -m "変更内容の説明"변경 사항을 원격 리포지토리로 푸시합니다.
git push끌어오기 요청 만들기
GitHub의 리포지토리 페이지로 이동합니다.
풀 요청 탭을 클릭하고 새 풀 요청 버튼을 클릭합니다.
베이스 브랜치와 비교 브랜치를 선택합니다.
Create pull request 버튼을 클릭합니다.
끌어오기 요청의 제목과 설명을 입력하고 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 버전
실행한 명령
예상되는 동작과 실제 동작
Available Tools
1 toolget-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
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
- AlicenseAqualityCmaintenanceA Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.82,287 PyPI61Apache 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.1ISC
- 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