天气服务MCP服务器

一个使用Python MCP SDK创建的天气服务MCP服务器,提供天气警报和预报功能。

  • by AbeTavarez
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 abetavarez/weather-mcp-server

使用说明

MCP气象服务器

描述

这是一个使用Python MCP SDK创建的天气MCP服务器。

工具

暴露的工具:

  • 获取警报
  • 获取预测

使用UV运行MCP服务器

首先,让我们安装uv并设置我们的Python项目和环境:

Mac/linux: curl -LsSf https://astral.sh/uv/install.sh | sh

窗户:powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

第二,创建虚拟环境并激活它:

  1. uv venv
  2. .venv\Scripts\activate

如果需要手动添加依赖关系: uv add mcp[cli] httpx

运行MCP服务器

运行: uv run weather.py

将MCP服务器与Claude桌面主机连接:

  1. 使用文本编辑器打开配置文件: Mac/Linux: code ~/Library/Application\ Support/Claude/claude_desktop_config.json 窗户: code $env:AppData\Claude\claude_desktop_config.json

  2. 在mcpServers密钥中添加服务器:

{
    "mcpServers": {
        "weather": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
                "run",
                "weather.py"
            ]
        }
    }
}

确保更新天气MCP服务器的绝对路径。

保存文件,然后重新启动Claude for Desktop App,您应该能够在工具列表中看到天气工具。