Rentaoshu's test MCP weather server.
Project description
MCP服务开发、测试、发布全流程
1、在某个conda环境中(比如llm-mcp),安装好uv:
pip install uv
2、PyCharm项目初始化为uv项目:
uv init .
3、创建、激活虚拟环境
uv venv source .venv/bin/activate
4、安装 MCP SDK
uv add openai dotenv mcp
5、创建项目源代码
创建src/weather 文件夹
添加 server.py 文件
6、本地测试(使用Inspector进行)
安装nodejs
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - sudo apt install -y nodejs
运行Inspector
npx -y @modelcontextprotocol/inspector uv run ./src/weather/server.py --api_key apikey123abc
7、打包
添加__init__.py、main.py
修改pyproject.toml文件
填写内容,注意[project.scripts]中的rents-mcp-weather2名称:
[build-system] requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta"
[project.scripts] rents-mcp-weather2 = "weather:main" [tool.setuptools] package-dir = {"" = "src"} [tool.setuptools.packages.find] where = ["src"]
安装打包/发布(上传)工具包
uv pip install build twine
打包(回到项⽬主⽬录)
cd /Users/rents/PycharmProjects/rents-mcp-weather python -m build
8、发布
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rents_weather_project-0.1.3.tar.gz.
File metadata
- Download URL: rents_weather_project-0.1.3.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0db86272cea1e2315211b26a01431ce7df35c61ecdd8fde7d98274ae0c01a3d4
|
|
| MD5 |
75c5f54a5926164df3015f645ca8f66b
|
|
| BLAKE2b-256 |
536f89eae276f057ad819c1a7065d27714f7236ed48fd6126c41e2d812743d93
|
File details
Details for the file rents_weather_project-0.1.3-py3-none-any.whl.
File metadata
- Download URL: rents_weather_project-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4decda14ae58fe231a7e5fb52b9bb9a7e8ff24174286482c70a081c8b39e64d1
|
|
| MD5 |
5555b0f12aaa42211706c6e6f0ed3df5
|
|
| BLAKE2b-256 |
efcd53722879dfa6895acdfedff14ab753c1b6bcb1f744f04e3757d79bf5663c
|