Skip to main content

淘宝标题生成 MCP 服务器

这是一个基于 MCP (Model Context Protocol) 协议的淘宝商品标题生成服务器,可以根据商品图片自动生成优化的淘宝商品标题。

功能特点

  • 支持多图片输入,提供更全面的商品分析
  • 异步处理请求,支持进度报告
  • 提供资源访问,包括API描述和使用指南
  • 预定义提示,帮助LLM更高效地使用服务
  • 完全兼容MCP协议,可与支持MCP的LLM客户端无缝集成

安装

从PyPI安装

pip install taobao-title-mcp

从源码安装

git clone <repository-url>
cd taobao-title-mcp
pip install -e .

使用方法

作为独立服务器运行

# 如果已安装为包
python -m taobao_title_mcp

# 或者使用uvx(如果已发布到PyPI)
uvx taobao-title-mcp

在代码中使用

from taobao_title_mcp.server import mcp
from taobao_title_mcp import tools, resources, prompts

# 启动服务器
mcp.run()

工具和资源

工具

  • generate_taobao_title: 根据商品图片URL生成淘宝商品标题

资源

  • info://api_description: API描述信息
  • info://usage_guidelines: API使用指南
  • examples://{example_id}: 示例数据,支持的example_id: shoes, clothes, electronics

提示

  • generate_title_from_images: 根据图片URL生成标题的提示
  • analyze_title_quality: 分析标题质量并提供改进建议的提示

示例

使用MCP客户端调用服务:

from mcp.client import Client

async def main():
    async with Client("http://localhost:8000") as client:
        # 获取API描述
        api_info = await client.read_resource("info://api_description")
        print(f"API名称: {api_info['name']}")
        
        # 生成标题
        result = await client.call_tool(
            "generate_taobao_title",
            {
                "image_urls": [
                    "https://gw.alicdn.com/imgextra/i4/215590895/O1CN01wcB8AU1ITxVvVRZyZ_!!215590895.jpg"
                ],
                "temperature": 0.7
            }
        )
        print(f"生成的标题: {result['title']}")
        print(f"处理时间: {result['processing_time']}秒")

开发

依赖

  • Python 3.8+
  • mcp 1.6.0+
  • requests
  • Pillow

测试

pytest tests/

许可证

MIT

作者

三少科技

Metadata

Release files for taobao-title-mcp 0.1.1

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

Source distribution (sdist)

Source distribution for taobao-title-mcp 0.1.1
File Size Uploaded Provenance
taobao_title_mcp-0.1.1.tar.gz 10.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for taobao-title-mcp 0.1.1
File Interpreter ABI Platform
taobao_title_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / taobao_title_mcp-0.1.1.tar.gz

Download URL taobao_title_mcp-0.1.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9f1d43d7357eff1caa16800e541e3fe6c1f5c08f20bb6aec883de93e14a257
BLAKE2b-256 checksum
How to use checksums
a735e9b6ae0d06f318d31ccb2bee15e354ff67bb26d45093d9355c25efffb661
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / taobao_title_mcp-0.1.1-py3-none-any.whl

Download URL taobao_title_mcp-0.1.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a048cc924e66a8f456753c91fb66180837c3805e5115311c20c873a6bd763b94
BLAKE2b-256 checksum
How to use checksums
24314eba8f91f0dc412896e27c3bb63aa232261662513df25c7d5fde6f1d9a6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for taobao-title-mcp 0.1.1

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.1 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