Mcp Weather Server

by shivam-singhal

253 downloads
Not rated
GitHub

Description

# 天气 MCP Server docs: https://modelcontextprotocol.io/quickstart/server ## 服务运行测试 ```shell uv run weather.py ``` ## 使用 Claude for Desktop 作为客户端测试 ### 配置 打开并编辑文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json,内容如下: ```json { "mcpServers": { "weather": {…

About

# 天气 MCP Server docs: https://modelcontextprotocol.io/quickstart/server ## 服务运行测试 ```shell uv run weather.py ``` ## 使用 Claude for Desktop 作为客户端测试 ### 配置 打开并编辑文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json,内容如下: ```json { "mcpServers": { "weather": { "command": "/ABSOLUTE/PATH/TO/uv", "args": […

Details

Author
shivam-singhal
Downloads
253
Categories
Media

- 通过 MCP 协议提供天气相关工具
- 支持 Claude for Desktop 作为客户端
- 使用 Python 编写,通过 uv 运行
- 提供两个可用 MCP 工具(由锤子图标指示)

使用 uv run weather.py 启动服务。如需通过 Claude for Desktop 使用,则在其配置文件中添加对应的 MCP 服务器条目,指定 uv 命令路径和工作目录,然后重启 Claude。

天气 MCP Server

docs: https://modelcontextprotocol.io/quickstart/server

服务运行测试

    uv run weather.py 

使用 Claude for Desktop 作为客户端测试

配置

打开并编辑文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json,内容如下:

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

重启 Claude for Desktop

重启不报错,且有锤子图标显示两个 Available MCP Tools,即为成功;否则,查看日志排查

Claude for Desktop 日志

日志文件夹:~/Library/Logs/Claude

来自具体 MCP Server 的日志:mcp-server-weather.log

MCP 连接通用日志:mcp.log

工作原理

1. 客户将您的问题发送给 Claude
2. Claude 分析可用的工具并决定使用哪一个
3. 客户端通过 MCP 服务器执行所选工具
4. 结果被发回给 Claude
5. Claude 制定了自然语言响应
6. 答案已经展示给你了!

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.