Skip to main content

HTTP MCP Client-Server for video enhancement API

Project description

http-mcp-client-server (Python)

PyPI version Python 3.10+ License: MIT

基于 MCP 协议的视频增强服务,作为 MCP Client-Server 与 FastAPI HTTP Server 交互。

功能

提供以下 MCP Tools:

  • create_task - 创建视频增强任务(支持 URL 或本地文件上传)
  • get_task_status - 查询任务状态
  • enhance_video_sync - 同步增强视频(阻塞等待)

安装

从 PyPI 安装(推荐)

# 使用 pip 安装
pip install http-mcp-client-server

# 或使用 uv 安装
uv pip install http-mcp-client-server

从源码安装

git clone https://github.com/yourusername/http-mcp-client-server.git
cd python_client

# 使用 uv 安装(推荐)
uv pip install -e ".[dev]"

# 或使用 pip 安装
pip install -e ".[dev]"

使用方法

1. 命令行启动

# 直接运行(安装后)
http-mcp-client-server --base-url http://localhost:8000 --api-key your-api-key

# 或使用环境变量
export HTTP_API_BASE_URL=http://localhost:8000
export HTTP_API_KEY=your-api-key
http-mcp-client-server

2. 在 Claude Desktop 中配置

编辑 Claude Desktop 配置文件:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "video-enhancement": {
      "command": "http-mcp-client-server",
      "args": [
        "--base-url",
        "http://localhost:8000",
        "--api-key",
        "your-api-key"
      ]
    }
  }
}

3. 使用 uv run 运行(开发模式)

uv run http-mcp-client-server --base-url http://localhost:8000 --api-key your-api-key

提供的 Tools

create_task

创建视频增强任务(异步)。

参数:

  • video_source (string, required): 视频 URL 或本地文件路径
  • type (string, optional): 上传类型,默认 "url"
    • 可选值: "url" - 网络视频URL, "local" - 本地文件路径
  • resolution (string, optional): 目标分辨率,默认 720p
    • 可选值: 480p, 540p, 720p, 1080p, 2k

使用示例:

# URL 方式
{
  "video_source": "https://example.com/video.mp4",
  "type": "url",
  "resolution": "1080p"
}

# 本地文件方式
{
  "video_source": "/path/to/local/video.mp4",
  "type": "local",
  "resolution": "1080p"
}

返回值:

{
  "success": true,
  "task_id": "xxx",
  "status": "wait"
}

get_task_status

查询任务状态。

参数:

  • task_id (string, required): 任务ID

使用示例:

{
  "task_id": "task-123-abc"
}

返回值:

{
  "success": true,
  "task_id": "xxx",
  "status": "completed",
  "progress": 100,
  "video_url": "https://...",
  "error_message": null,
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:01:00Z"
}

enhance_video_sync

同步增强视频(阻塞等待完成)。

参数:

  • video_source (string, required): 视频 URL 或本地文件路径
  • type (string, optional): 上传类型,默认 "url"
    • 可选值: "url" - 网络视频URL, "local" - 本地文件路径
  • resolution (string, optional): 目标分辨率,默认 720p
  • poll_interval (number, optional): 轮询间隔(秒),默认 5
  • timeout (number, optional): 超时时间(秒),默认 600

使用示例:

{
  "video_source": "https://example.com/video.mp4",
  "type": "url",
  "resolution": "1080p",
  "poll_interval": 5,
  "timeout": 600
}

返回值:

{
  "success": true,
  "task_id": "xxx",
  "status": "completed",
  "progress": 100,
  "video_url": "https://..."
}

文件上传说明

type 设置为 "local" 时,MCP Server 会:

  1. 读取本地文件
  2. 将文件转为 base64 编码
  3. 上传到视频增强服务

限制:

  • 最大文件大小:100MB

环境变量

变量名 说明 默认值
HTTP_API_BASE_URL FastAPI HTTP Server 地址 http://localhost:8000
HTTP_API_KEY API 认证密钥

开发

# 克隆仓库
git clone https://github.com/yourusername/http-mcp-client-server.git
cd python_client

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

# 运行测试
pytest

# 代码格式化
ruff format .
ruff check --fix .

发布到 PyPI

# 安装构建工具
uv pip install build twine

# 构建分发包
python -m build

# 上传到 PyPI(测试)
python -m twine upload --repository testpypi dist/*

# 上传到 PyPI(正式)
python -m twine upload dist/*

License

MIT License - 详见 LICENSE 文件

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

http_mcp_client_server-0.1.1.tar.gz (86.7 kB view details)

Uploaded Source

Built Distribution

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

http_mcp_client_server-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: http_mcp_client_server-0.1.1.tar.gz
  • Upload date:
  • Size: 86.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for http_mcp_client_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db85d8a119c8f60532453f7ad4cad6026bbdc11287a8d4c0350b35f28d57b129
MD5 7c76254a19aaf3b8538b54c91cbbf0a1
BLAKE2b-256 e261f9087ee613b67c243d8bb46b29c4edb142e2d295d1421dae18c440aedef5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for http_mcp_client_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 15dede7cfb05ef98d6f1d8e89e3c46333ddc48b6b5ff4ec18bfabce976d2cd4a
MD5 37a28a3e0b650554aaae8a3b4f93f7c7
BLAKE2b-256 66297f910157022a443c1ab7ffec39b64e019e10a6998a82db17cd7e08aafe00

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