Skip to main content

Yu Terms MCP Server

一个基于Python的MCP (Model Context Protocol) 服务器,用于条款管理功能。这是Java Spring AI实现的Python等价版本。

功能特性

  • 条款更新工具: 提供更新条款要素的接口
  • MCP协议支持: 完全兼容MCP协议规范
  • 异步处理: 基于asyncio的高性能异步处理
  • 易于扩展: 模块化设计,便于添加新的工具和功能
  • 完整日志: 详细的日志记录,便于调试和监控

安装

从PyPI安装

pip install yu-terms-mcp-server

从源码安装

git clone https://github.com/yourusername/yu-terms-mcp-server.git
cd yu-terms-mcp-server
pip install -e .

使用方法

命令行启动

yu-terms-mcp-server

程序化使用

import asyncio
from yu_terms_mcp_server import TermsMcpServer

async def main():
    server = TermsMcpServer()
    await server.run()

if __name__ == "__main__":
    asyncio.run(main())

工具说明

terms_updated

更新条款要素的主要工具。

参数:

  • query (string): 更新参数

返回:

  • 成功时返回: "更新成功!"
  • 失败时返回: 错误信息

示例:

{
  "name": "terms_updated",
  "arguments": {
    "query": "更新条款内容"
  }
}

开发

环境设置

# 克隆仓库
git clone https://github.com/yourusername/yu-terms-mcp-server.git
cd yu-terms-mcp-server

# 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Linux/Mac
# 或
venv\Scripts\activate  # Windows

# 安装开发依赖
pip install -e ".[dev]"

运行测试

pytest

代码格式化

black yu_terms_mcp_server/
isort yu_terms_mcp_server/

类型检查

mypy yu_terms_mcp_server/

项目结构

yu_terms_mcp_server/
├── __init__.py          # 包初始化
├── main.py             # 主入口点
├── server.py           # MCP服务器实现
└── tools.py            # 工具实现

与Java版本的对应关系

Java组件 Python组件 说明
TermsUpdatedTool.java tools.py 条款更新工具实现
YuImageSearchMcpServerApplication.java server.py 主应用程序和服务器配置
@Tool 注解 get_tool_definition() 工具定义和注册
@Service 注解 类实例化 服务组件管理
SpringApplication.run() server.run() 应用程序启动

配置

服务器默认使用stdio进行通信,这是MCP协议的标准方式。如需自定义配置,可以修改server.py中的相关设置。

日志

应用程序使用Python标准logging模块。日志级别默认为INFO,输出到stderr。

许可证

MIT License

贡献

欢迎提交Issue和Pull Request!

更新日志

v1.0.0

  • 初始版本发布
  • 实现基础的条款更新功能
  • 完整的MCP协议支持

Metadata

Release files for yu-terms-mcp-server 1.0.5

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

Source distribution (sdist)

Source distribution for yu-terms-mcp-server 1.0.5
File Size Uploaded Provenance
yu_terms_mcp_server-1.0.5.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yu-terms-mcp-server 1.0.5
File Interpreter ABI Platform
yu_terms_mcp_server-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / yu_terms_mcp_server-1.0.5.tar.gz

Download URL yu_terms_mcp_server-1.0.5.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c9d70487d7759a272baa89fe449698e749950ab8bf279c9711abbcb3a661c649
BLAKE2b-256 checksum
How to use checksums
4579a0fbdac09797e9272689686e8d967342497cb3c216638a1981b0f9d3060d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / yu_terms_mcp_server-1.0.5-py3-none-any.whl

Download URL yu_terms_mcp_server-1.0.5-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
969137b2e383939cc1a4d60e1278b17bdbfa33f2ac0d01b4e8d6fd0fb027c3db
BLAKE2b-256 checksum
How to use checksums
63117e8988840d856c74a1f1416922e425f551f383d39eea78611ef59feb604f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Security for yu-terms-mcp-server 1.0.5

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.

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