Skip to main content

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


Download files

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

Source Distribution

rents_mcp_weather-0.1.2.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_mcp_weather-0.1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file rents_mcp_weather-0.1.2.tar.gz.

File metadata

  • Download URL: rents_mcp_weather-0.1.2.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_mcp_weather-0.1.2.tar.gz
Algorithm Hash digest
SHA256 befd5efe33b58882e4092c729d28cea537f7ed99f58a18cbac6a897646fe83f0
MD5 9fef17dfe7b702db3e8f442d3822cc98
BLAKE2b-256 b7e918096c2c3d362289b44e63949a50cb496d7173a179bdaf8b6fc52a38f044

See more details on using hashes here.

File details

Details for the file rents_mcp_weather-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for rents_mcp_weather-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efde94a375c241a508c197b01a12da9d76a38af456ec12642ded4c9196430fa0
MD5 4262ddb7c654a1f114e4b46a20c1a2c7
BLAKE2b-256 3f315b0044b5027b110646879562af51533d2d41f529a84f86077fbb44fc8be8

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