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.0.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.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: taobao_title_mcp-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 7cb2e0dae06f30a8098a06faa08ddb5a6265319a20ef014a4fad0de852238ba4
MD5 7aed3063ddb5445f8bd3b68bf8cf2499
BLAKE2b-256 9aade0c6d32e10e56b0be37bd9098d2348f3aa75940ed0f0c5f98230bf9ae2ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for taobao_title_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9cf361def9949432a068100dedcb034e41882463176041606d3f11b5321f35c
MD5 924eb60107da50816af01738721fd5ff
BLAKE2b-256 ccb15ca3d5b27eb044a0fc4c500939eebd3d201d4efdc64404c29419958a9ec2

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