Skip to main content

Rents'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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rents_weather_project-0.1.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rents_weather_project-0.1.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file rents_weather_project-0.1.4.tar.gz.

File metadata

  • Download URL: rents_weather_project-0.1.4.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

Hashes for rents_weather_project-0.1.4.tar.gz
Algorithm Hash digest
SHA256 072f8d9eefa880888a30ddc8366ce0e6dc95d69388919e256ba8c428a90446c2
MD5 5b281ddacfe8845ed827cc54a06cb500
BLAKE2b-256 a84d4a7b26b6f9f98bbef008acbb8539c3cbf61c95b20c2881c8faed9ffa4429

See more details on using hashes here.

File details

Details for the file rents_weather_project-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for rents_weather_project-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1bce0d5e64de89d072f209a8eba7dcc84ec639edeb34c7f0086ba2dbdbced6b2
MD5 ad0df47e5c2a48e63b82e486d51b160a
BLAKE2b-256 09cf6f1baaef09962714a9220b38fbe88916087bbf9820529ed55dbeb84dc623

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page