Skip to main content

A minimal MCP server demo with a single hello tool.

Project description

demo5566-hello-mcp-server

一个最小可发布的 Python MCP Server 示例项目。

它只暴露 1 个 tool:

  • hello: 被调用时直接返回字符串 "hello"

功能说明

  • 基于官方 Python MCP SDK (mcp) 实现
  • 使用 src/ 布局,便于打包和发布
  • 提供命令行入口,可直接作为 MCP Server 启动
  • 提供基础测试
  • 支持构建 wheel 和 sdist,并发布到 PyPI

本地开发

1. 创建虚拟环境

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e '.[dev]'

2. 启动 MCP Server

python -m demo5566_hello_mcp_server

或者使用安装后的命令:

demo5566-hello-mcp-server

默认使用 stdio 传输,适合 MCP Client 直接拉起。

Tool 定义

hello

无参数,直接返回:

hello

在 MCP Client 中接入

如果你的客户端支持通过命令拉起 server,可以使用类似配置:

{
  "mcpServers": {
    "demo5566-hello": {
      "command": "/path/to/python",
      "args": ["-m", "demo5566_hello_mcp_server"]
    }
  }
}

如果你已经通过 pip install 安装,也可以改为直接使用脚本命令:

{
  "mcpServers": {
    "demo5566-hello": {
      "command": "demo5566-hello-mcp-server",
      "args": []
    }
  }
}

运行测试

pytest

构建发布包

python -m build

构建结果会出现在 dist/ 目录。

发布到 PyPI

先检查包:

python -m twine check dist/*

上传到正式 PyPI:

python -m twine upload dist/*

上传到 TestPyPI:

python -m twine upload --repository testpypi dist/*

发布前建议

  • pyproject.toml 中的 name 改成你最终确认未被占用的 PyPI 包名
  • HomepageRepositoryIssues 改成你的真实仓库地址
  • 根据你的实际身份调整作者信息和许可证

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

vundify_poison_mcp_server-0.1.0.tar.gz (74.4 kB view details)

Uploaded Source

Built Distribution

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

vundify_poison_mcp_server-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file vundify_poison_mcp_server-0.1.0.tar.gz.

File metadata

File hashes

Hashes for vundify_poison_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22329851349afb0f64f70f08db46759882133b76821fee61b55d244618c7cf1a
MD5 4cc45ba3f729c728e2488c7164fdffc0
BLAKE2b-256 9f3ca0161cd50f112f1e846032151f455b396da27de06134ac3b025ffb2ea58e

See more details on using hashes here.

File details

Details for the file vundify_poison_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vundify_poison_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df3f925a12168ce58a2f4916a9a47c112cf2570cee1753f31043bd1c4abdc7de
MD5 21c4cbb12bf2fdd0783dcf4c89ed0e09
BLAKE2b-256 778b47717e76c9d46e5425eb03bdcd113d8d634d6d643f4e2f54eb58ada4b2a2

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