Skip to main content

淘宝商品标题生成MCP服务器

Project description

淘宝标题生成 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

作者

三少科技

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

taobao_title_mcp-0.1.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

taobao_title_mcp-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file taobao_title_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: taobao_title_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for taobao_title_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cb9f1d43d7357eff1caa16800e541e3fe6c1f5c08f20bb6aec883de93e14a257
MD5 7073f358017342db48e27fcc1ee2e087
BLAKE2b-256 a735e9b6ae0d06f318d31ccb2bee15e354ff67bb26d45093d9355c25efffb661

See more details on using hashes here.

File details

Details for the file taobao_title_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for taobao_title_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a048cc924e66a8f456753c91fb66180837c3805e5115311c20c873a6bd763b94
MD5 e2bd97c09d8048b88ef15eac76c468d6
BLAKE2b-256 24314eba8f91f0dc412896e27c3bb63aa232261662513df25c7d5fde6f1d9a6c

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