Skip to main content

天气MCP SERVER

安装uv

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

重启命令行生效

创建并设置项目

# Create a new directory for our project
uv init weather-didi
cd weather-didi

# Create virtual environment and activate it
uv venv
source .venv/bin/activate

# Install dependencies
uv add "mcp[cli]" httpx

# Create our server file
touch weather.py

Cherry Studio MCP CONFIG

  1. 选择stdio,配置命令 uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/weather-didi run weather.py

提问

What’s the weather in Sacramento? What are the active weather alerts in Texas?

打包发布pypi共享

此方法只能使用stdio方式。

  1. 修改pyproject.toml, 添加版本、依赖、构建配置
  2. uv build构建生成dist目录
dist/目录下生成两个文件:
.whl 文件(构建分发版)
.tar.gz 文件(源代码分发版)
  1. uv push发布
# 发布测试
uv publish --token 你的PyPI令牌
uv add -i https://test.pypi.org/simple/ --no-deps 你的包名
uvx 包名(自动创建虚拟环境,适合单次运行)
# 发布生产
uv publish --token 你的PyPI令牌
uv add 你的包名
uvx 包名(自动创建虚拟环境,适合单次运行)

切换协议

weather.py:main方法:stdio->sse

    mcp.settings.host = '0.0.0.0'
    mcp.settings.port = 8000
    mcp.run(transport='sse')

并启动,获取服务器地址:http://{IP}:{PORT}/sse

Cherry Studio配置:

  1. 选择sse,配置mcp server服务器地址: http://{IP}:{PORT}/sse

Metadata

Release files for weather-didi 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weather-didi 0.1.3
File Size Uploaded
weather_didi-0.1.3.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weather-didi 0.1.3
File Interpreter ABI Platform
weather_didi-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.5 kB

Release files / weather_didi-0.1.3.tar.gz

Download URL weather_didi-0.1.3.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0322dfdbdab6b9fdd2108cb700cd902dbf9e387efbaf32d080fd6edcdfe24165
BLAKE2b-256 checksum
How to use checksums
456edeea06dd1e7e07113cd5c0bb0b2aa7af7966bd8d0783d0e32ac0f4166f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / weather_didi-0.1.3-py3-none-any.whl

Download URL weather_didi-0.1.3-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bafa1e77d5224d32ad024e22ada10026fdddfff8f1cce1fb123dc90f56cdd79c
BLAKE2b-256 checksum
How to use checksums
0c04f999abd19e9296b8f46d4c1a0d3ff6755f33f5a2ceed0c92d71cd9eae20a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page