Weather Query MCP Server
天气查询 MCP 服务器/客户端示例
该项目是一个天气查询客户端,它与 MCP(模型客户端协议)服务器交互以获取并显示指定城市的天气信息。
特征
连接到 MCP 服务器以列出可用的工具。
查询指定城市的天气信息。
显示格式化的天气信息,包括温度、湿度、风速和天气描述。
Related MCP server: Open Weather13 MCP Server
要求
Python 3.8+
openai库dotenv库mcp库
设置
克隆存储库:
git clone <repository_url> cd <repository_directory>创建虚拟环境并激活它:
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 许可。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
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.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides access to the Interzoid GetWeatherCity API, allowing users to retrieve weather information for specified cities through natural language interactions.-
- FlicenseCqualityDmaintenanceAn MCP server that provides access to current weather data and 5-day forecasts via the Open Weather13 API. It enables users to retrieve weather information using city names or geographic coordinates across various languages.3-
- AlicenseNot gradedqualityDmaintenance基于OpenWeatherMap API的天气查询MCP服务器,支持全球城市天气信息查询,包括温度、湿度和天气描述,并支持摄氏度和华氏度单位切换。MIT
- FlicenseAqualityDmaintenanceMCP server that integrates OpenWeatherMap API to fetch current weather for a specified city.1-