Weather MCP Server
Okay, here's the translation of "MCP Server 和风天气API例子" and some context to help you understand what it means and how to use it: **Translation:** * **MCP Server:** MCP服务器 (MCP fúwùqì) * **和风天气API:** 和风天气API (Héfēng Tiānqì API) * **例子:** 例子 (lìzi) **Full Translation:** MCP服务器 和风天气API 例子 **Pinyin:** MCP fúwùqì Héfēng Tiānqì API lìzi **Meaning:** MCP Server HeWeather API Example(s) **Explanation and Context:** This phrase likely refers to examples of how to use the HeWeather API (a popular weather API in China) within the context of an MCP Server. An MCP Server could be a server running a Minecraft mod, or some other type of server. **To provide a more helpful example, I need more information. Specifically, what kind of MCP server are you using? For example:** * **Are you using a Minecraft MCP server?** If so, what modding framework are you using (Forge, Fabric, etc.)? * **What programming language are you using?** (Java, Python, etc.) * **What specific weather data do you want to retrieve?** (Current conditions, forecast, etc.) **However, I can give you a general example of how to use the HeWeather API in Python (which is a common language for server-side scripting):** ```python import requests import json # Replace with your HeWeather API key API_KEY = "YOUR_HEWEATHER_API_KEY" # Replace with the city you want weather data for (e.g., Beijing) CITY = "Beijing" # API endpoint for current weather conditions URL = f"https://devapi.qweather.com/v7/weather/now?location={CITY}&key={API_KEY}" try: response = requests.get(URL) response.raise_for_status() # Raise an exception for bad status codes data = response.json() if data["code"] == "200": current_weather = data["now"] temperature = current_weather["temp"] condition = current_weather["text"] print(f"Current weather in {CITY}:") print(f"Temperature: {temperature}°C") print(f"Condition: {condition}") else: print(f"Error: {data['code']} - {data['status']}") except requests.exceptions.RequestException as e: print(f"Request error: {e}") except json.JSONDecodeError as e: print(f"JSON decode error: {e}") ``` **Explanation of the Python Example:** 1. **Import Libraries:** Imports the `requests` library for making HTTP requests and the `json` library for parsing JSON data. 2. **API Key and City:** You **MUST** replace `"YOUR_HEWEATHER_API_KEY"` with your actual HeWeather API key. You can get one by signing up for a free account on the HeWeather website ([https://www.qweather.com/en/](https://www.qweather.com/en/)). Also, replace `"Beijing"` with the city you want weather data for. 3. **API Endpoint:** Constructs the URL for the HeWeather API endpoint to retrieve current weather conditions. 4. **Make the Request:** Uses `requests.get()` to make a GET request to the API endpoint. 5. **Error Handling:** `response.raise_for_status()` checks for HTTP errors (like 404 Not Found). 6. **Parse JSON:** Parses the JSON response from the API using `response.json()`. 7. **Check Status Code:** Checks the `code` field in the JSON response. `"200"` indicates success. 8. **Extract Data:** Extracts the temperature and weather condition from the `now` object in the JSON data. 9. **Print Results:** Prints the weather information to the console. 10. **Error Handling (Exceptions):** Includes `try...except` blocks to handle potential errors during the request or JSON parsing. **Important Notes:** * **Get an API Key:** You *must* register for a HeWeather API key to use their service. * **API Usage Limits:** Be aware of the API usage limits for your HeWeather account. The free tier has limitations. * **Location Codes:** HeWeather uses specific location codes. You can use their API to find the correct code for a city. * **MCP Server Integration:** To integrate this into your MCP server, you would need to adapt this code to run within your server's environment. This will depend on the specific server framework you are using. For example, if you are using a Minecraft Forge server, you would need to create a Forge mod that uses this code to fetch weather data and then display it in the game. **To get a more specific example, please provide more details about your MCP server and what you are trying to achieve.**
xuezhijian
README
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
</details>
配置Zed
在Zed的settings.json中添加:
<details> <summary>使用uvx</summary>
"context_servers": [
"mcp-server-weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
],
</details>
<details> <summary>使用pip安装</summary>
"context_servers": {
"mcp-server-weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
},
</details>
示例交互
- 获取未来24小时天气:
{
"name": "get_24h_weather",
"arguments": {
"location": "广州 天河"
}
}
响应:
{
"location": "广州 天河",
"forecast": "未来24小时的天气信息..."
}
调试
你可以使用MCP inspector来调试服务器。对于uvx安装:
npx @modelcontextprotocol/inspector uvx mcp-server-weather
或者如果你在特定目录中安装了包或正在开发:
cd path/to/servers/src/weather
npx @modelcontextprotocol/inspector uv run mcp-server-weather
构建
Docker 构建:
docker build -t mcp/weather .
贡献
我们鼓励对mcp-server-weather的贡献,以帮助扩展和改进其功能。无论是添加新的天气相关工具、增强现有功能,还是改进文档,你的输入都很有价值。
有关其他MCP服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers
欢迎提交拉取请求!随时贡献新想法、错误修复或增强功能,以使mcp-server-weather更加强大和实用。
许可证
mcp-server-weather根据MIT许可证授权。这意味着你可以自由使用、修改和分发软件,但需遵守MIT许可证的条款和条件。有关详细信息,请参阅项目存储库中的LICENSE文件。
Weather MCP Server
一个提供天气预报和城市信息查询功能的Model Context Protocol服务器。该服务器允许LLMs获取未来24小时的天气信息,并支持通过城市名称、经纬度等方式查询城市信息。
可用工具
get_24h_weather- 获取未来24小时的天气预报。- 必需参数:
location(string): 城市名称或经纬度(例如,北京或116.41,39.92)
- 必需参数:
安装
使用uv(推荐)
使用uv时无需特定安装。我们将使用uvx直接运行mcp-server-weather。
使用PIP
或者,你可以通过pip安装mcp-server-weather:
pip install mcp-server-weather
安装后,你可以使用以下命令作为脚本运行:
python -m mcp_server_weather
配置
配置Claude.app
在Claude设置中添加:
<details> <summary>使用uvx</summary>
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["mcp-server-weather"]
}
}
</details>
<details> <summary>使用docker</summary>
"mcpServers": {
"weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/weather"]
}
}
</details>
<details> <summary>使用pip安装</summary>
"mcpServers": {
"weather": {
"command": "python",
"args": ["-m", "mcp_server_weather"]
}
}
推荐服务器
Crypto Price & Market Analysis MCP Server
一个模型上下文协议 (MCP) 服务器,它使用 CoinCap API 提供全面的加密货币分析。该服务器通过一个易于使用的界面提供实时价格数据、市场分析和历史趋势。 (Alternative, slightly more formal and technical translation): 一个模型上下文协议 (MCP) 服务器,利用 CoinCap API 提供全面的加密货币分析服务。该服务器通过用户友好的界面,提供实时价格数据、市场分析以及历史趋势数据。
MCP PubMed Search
用于搜索 PubMed 的服务器(PubMed 是一个免费的在线数据库,用户可以在其中搜索生物医学和生命科学文献)。 我是在 MCP 发布当天创建的,但当时正在度假。 我看到有人在您的数据库中发布了类似的服务器,但还是决定发布我的服务器。
mixpanel
连接到您的 Mixpanel 数据。 从 Mixpanel 分析查询事件、留存和漏斗数据。
Sequential Thinking MCP Server
这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。
Nefino MCP Server
为大型语言模型提供访问德国可再生能源项目新闻和信息的能力,允许按地点、主题(太阳能、风能、氢能)和日期范围进行筛选。
Vectorize
将 MCP 服务器向量化以实现高级检索、私有深度研究、Anything-to-Markdown 文件提取和文本分块。
Mathematica Documentation MCP server
一个服务器,通过 FastMCP 提供对 Mathematica 文档的访问,使用户能够从 Wolfram Mathematica 检索函数文档和列出软件包符号。
kb-mcp-server
一个 MCP 服务器,旨在实现便携性、本地化、简易性和便利性,以支持对 txtai “all in one” 嵌入数据库进行基于语义/图的检索。任何 tar.gz 格式的 txtai 嵌入数据库都可以被加载。
Research MCP Server
这个服务器用作 MCP 服务器,与 Notion 交互以检索和创建调查数据,并与 Claude Desktop Client 集成以进行和审查调查。
Cryo MCP Server
一个API服务器,实现了模型补全协议(MCP),用于Cryo区块链数据提取,允许用户通过任何兼容MCP的客户端查询以太坊区块链数据。