Skip to main content

加法 MCP 服务

这是一个简单的 Model Context Protocol (MCP) 服务示例,提供基本的加法计算功能和问候语生成功能。

功能介绍

本服务提供以下功能:

  1. 加法计算工具:计算两个整数的和
  2. 问候语资源:根据提供的名称生成个性化问候语
  3. 问候语提示词模板:根据不同风格生成问候语提示词

安装与配置

前提条件

  • Python 3.6 或更高版本
  • MCP 库

配置步骤

  1. 将服务配置添加到 CodeBuddy 的 MCP 设置文件中:

    "加法服务": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "python",
      "args": [
        "d:/mcp_ts/main.py"
      ]
    }
    
  2. 配置文件位置:c:\Users\93467\AppData\Roaming\CodeBuddy\User\globalStorage\tencent.planning-genie\settings\codebuddy_mcp_settings.json

使用方法

启动服务

python d:/mcp_ts/main.py

使用加法工具

通过 CodeBuddy 调用加法工具:

<use_mcp_tool>
<server_name>加法服务</server_name>
<tool_name>add</tool_name>
<arguments>
{
  "a": 5,
  "b": 3
}
</arguments>
</use_mcp_tool>

访问问候语资源

<access_mcp_resource>
<server_name>加法服务</server_name>
<uri>greeting://World</uri>
</access_mcp_resource>

代码结构

  • main.py: 主程序文件,包含 MCP 服务的所有功能实现

扩展开发

您可以通过以下方式扩展此服务:

  1. 添加更多数学运算工具(如减法、乘法、除法等)
  2. 增加更多资源类型
  3. 开发更复杂的提示词模板

许可证

MIT

Metadata

Release files for mcp-ts 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 mcp-ts 0.1.0
File Size Uploaded Provenance
mcp_ts-0.1.0.tar.gz 3.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-ts 0.1.0
File Interpreter ABI Platform
mcp_ts-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / mcp_ts-0.1.0.tar.gz

Download URL mcp_ts-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
82353051818032ade2811150790a491619e09dfe3ef232cad2662195fca65aaf
BLAKE2b-256 checksum
How to use checksums
19d44c4a5f17aeeb8e0f5624d0fb3f4e2add74acc9bdc8f5281e2f819ff1176c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

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

Download URL mcp_ts-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac2b76a5adf6ac20e4be2b070e7566796e406f0342c4a158973f0b0b88459f13
BLAKE2b-256 checksum
How to use checksums
9d0898fb27e921f9330e1d34e729348280beaf7407528e180b856fae340462eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Security for mcp-ts 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