Skip to main content

gg-mcp-demo

一个最小可用的 MCP(Model Context Protocol)服务器示例,用来演示三件事:

  • 注册一个 tool(add)和一个 resource(greeting://{name});
  • 用 middleware 把每一次入站请求/通知(方法、参数、耗时、结果)写进调用日志;
  • 默认走 stdio 传输,可用环境变量切换成 sse / streamable-http。

安装

pip install gg-mcp-demo-server
# 或
uv add gg-mcp-demo-server

需要 Python 3.13 及以上。发行名是 gg-mcp-demo-server,安装后的命令与导入名仍是 gg-mcp-demo / gg_mcp_demo。

运行

gg-mcp-demo              # 默认 stdio,供客户端拉起
MCP_TRANSPORT=sse gg-mcp-demo

环境变量:

变量 默认值 说明
MCP_TRANSPORT stdio 传输方式:stdio / sse / streamable-http
GG_MCP_DEMO_LOG_DIR 见下 调用日志所在目录

调用日志默认写入当前用户的状态目录:

  • Windows:%LOCALAPPDATA%\gg-mcp-demo\logs\mcp-calls.log
  • Linux/macOS:$XDG_STATE_HOME/gg-mcp-demo/logs/mcp-calls.log(未设置时为 ~/.local/state/...)

在客户端里配置

以 stdio 方式接入 Cherry Studio / Cline / Claude Desktop 等客户端:

{
  "mcpServers": {
    "gg-mcp-demo": {
      "command": "gg-mcp-demo",
      "env": {
        "GG_MCP_DEMO_LOG_DIR": "D:/logs/gg-mcp-demo"
      }
    }
  }
}

提供的 tool 与 resource

  • add(a: int, b: int) -> int:返回两数之和。
  • greeting://{name}:返回 Hello, {name}!。

日志示例

[17:30:14.312] pid=23112 --> tools/call id=2 params={"name": "add", "arguments": {"a": 1, "b": 2}}
[17:30:14.313] pid=23112 <-- tools/call id=2 OK 1.2ms result={"content": [{"type": "text", "text": "3"}]}

许可

未声明许可证(发布前请按需要补充)。

Metadata

Release files for gg-mcp-demo-server 0.1.0

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

Source distribution (sdist)

Source distribution for gg-mcp-demo-server 0.1.0
File Size Uploaded Provenance Actions
gg_mcp_demo_server-0.1.0.tar.gz 3.6 kB Without provenance Details for gg_mcp_demo_server-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gg-mcp-demo-server 0.1.0
File Interpreter ABI Platform Actions
gg_mcp_demo_server-0.1.0-py3-none-any.whl Python 3 none any Details for gg_mcp_demo_server-0.1.0-py3-none-any.whl

Total release size: 8.4 kB

Release files / gg_mcp_demo_server-0.1.0.tar.gz

Download URL gg_mcp_demo_server-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9477bd6c6cfdd424d4bde271cd4cc2cce778046f7341dfc7b88afaf0f1b9c0dd
BLAKE2b-256 checksum
How to use checksums
0d454e4ac0deec224a3187a61b82e24ddc1765bbe0e0495d2a120d175c8c59bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gg_mcp_demo_server-0.1.0-py3-none-any.whl

Download URL gg_mcp_demo_server-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa82317e8ab31cccea4293003fc2dd47c9720cae9d99a31b16a306091dbb26d1
BLAKE2b-256 checksum
How to use checksums
91172f6f472c864aa838dbd37bda063abc626ecff9289ea46d2c37c502b56a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for gg-mcp-demo-server 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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