使用说明
195个国家的MCP天气服务器
模型上下文协议(MCP)服务器的集合,使用Open-Meteo API获取195个国家的当前天气数据。
什么是MCP?
模型上下文协议(MCP) 是一个开放协议,规范了应用程序如何向大型语言模型(LLM)提供上下文。它实现了LLM应用程序(如Claude Desktop、IDE或AI工具)与外部数据源或工具之间的无缝集成。
部署
渲染->shayanrais.gt
关键概念
- MCP服务器:向MCP客户端公开特定功能(工具、资源、提示)的程序
- MCP客户端:连接到MCP服务器以访问其功能的应用程序(如Claude Desktop)
- 运输类型:
- stdio(基于命令):服务器作为子进程运行,通过标准输入/输出进行通信
- 流式HTTP:服务器作为HTTP服务运行,使用现代MCP协议进行通信
可用实现
此存储库提供了两种MCP服务器实现:
1. HTTP服务器(Python)
类型:流式HTTP(FastMCP 2.3+) 语言python 端口: 8003
{
"mcpServers": {
"weather-mcp-shayan": {
"serverUrl": "http://localhost:8003/mcp",
"description": "Weather data for 195 countries from Open-Meteo API"
}
}
}
2. 命令服务器(Python)
类型:stdio(基于命令) 语言python
{
"mcpServers": {
"weather-mcp-shayan-command": {
"command": "python3",
"args": ["/absolute/path/to/command/server-command.py"]
}
}
}
可用工具
这两台服务器都公开了195个天气工具(每个国家一个):
get_{country}_weather_shayan:获取指定国家首都的当前天气(例如。,get_india_weather_shayan,get_france_weather_shayan)
快速开始
选择最适合您需求的实施方式:
HTTP服务器(Python):
cd http
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip3 install -r requirements.txt
python3 server.py
命令服务器(Python):
cd command
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip3 install -r requirements.txt
python3 server-command.py