날씨 쿼리 MCP 서버/클라이언트 예제
이 프로젝트는 MCP(모델-클라이언트-프로토콜) 서버와 상호 작용하여 지정된 도시의 날씨 정보를 가져와 표시하는 날씨 쿼리 클라이언트입니다.
특징
MCP 서버에 연결하여 사용 가능한 도구를 나열합니다.
지정된 도시의 날씨 정보를 쿼리합니다.
온도, 습도, 풍속, 날씨 설명을 포함한 형식화된 날씨 정보를 표시합니다.
요구 사항
파이썬 3.8 이상
openai
라이브러리dotenv
라이브러리mcp
라이브러리
설정
저장소를 복제합니다.
지엑스피1
가상 환경을 만들고 활성화하세요.
python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`필요한 종속성을 설치하세요:
pip install -r requirements.txt루트 디렉토리에
.env
파일을 만들고 OpenAI API 키와 기타 구성을 추가합니다.OPENAI_API_KEY=<your_openai_api_key> BASE_URL=<your_base_url> MODEL=<your_model>
용법
MCP 서버를 시작합니다.
python server.py클라이언트를 실행하고 서버에 연결합니다.
python client.py <path_to_server_script>고객과 상호 작용:
날씨 정보를 얻으려면 도시 이름을 영어로 입력하세요.
quit
입력하여 클라이언트를 종료합니다.
프로젝트 구조
server.py
: MCP 서버 구현과 날씨 쿼리 도구가 포함되어 있습니다.client.py
: 서버와 상호작용하는 MCP 클라이언트 구현이 포함되어 있습니다..env
: API 키 및 구성을 위한 환경 변수..gitignore
: git에서 무시할 파일과 디렉토리를 지정합니다.README.md
: 프로젝트 설명서.
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다.
This server cannot be installed
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.
사용자가 특정 도시의 온도, 습도, 풍속, 날씨 설명을 포함한 날씨 정보를 가져와서 표시할 수 있도록 하는 MCP 서버 구현입니다.
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server that provides real-time weather information including temperature, humidity, wind speed, and sunrise/sunset times through the OpenWeatherMap API.Last updated -12MIT License
- -securityAlicense-qualityAn MCP server that connects to OpenWeatherMap's API to provide current weather data and multi-day forecasts for locations worldwide in different measurement units.
- AsecurityFlicenseAqualityA simple MCP server that provides a tool to fetch current weather information for cities using the Open-Meteo API, communicating through stdin/stdout.Last updated -12
- -securityFlicense-qualityAn MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.Last updated -4