Skip to main content

面向 GIF 元数据查询与逐帧导出的 MCP 服务器

Project description

GIF MCP 服务器

一个使用 Python + FastMCP 构建的 GIF 工具服务器,提供:

  • 元数据查询:读取 GIF 帧数、帧时长、总时长、循环方式等关键信息。
  • 帧分割导出:将动画拆成多张静态图,可自定义输出目录、文件前缀及图片格式。

环境要求

  • Python 3.10 及以上
  • uv 或 pip(推荐使用 uv 以保持与项目其余部分一致)

安装与运行

cd python/GifMCP
uv sync               # 安装依赖
uv run gif-mcp        # 以 stdio 方式启动 MCP 服务器

若使用其他虚拟环境管理工具,保证安装 mcpPillow 即可。

可用工具

get_gif_metadata

  • file_path:待分析的 GIF 路径。
  • 返回值:帧数、每帧时长、总时长(毫秒/秒)、循环方式、像素尺寸、是否带透明通道等。

split_gif_frames

  • file_path:GIF 路径。
  • output_dir(可选):帧导出目录,默认与 GIF 同级的 <文件名>_frames
  • filename_prefix(可选):导出文件名前缀,默认 frame
  • image_format(可选):输出格式,默认 PNG,支持 PNG/WEBP/JPEG/TIFF/BMP
  • keep_transparency(可选):是否保留透明通道,默认 True
  • 返回值:输出目录、帧数量以及生成的文件清单。

开发提示

  • 所有工具都通过 mcp.server.fastmcp.FastMCP 以 stdio 传输方式暴露。
  • 文件路径参数会自动展开 ~ 并进行存在性检查,错误会以异常形式回传给 MCP 客户端。
  • 若需要扩展更多 GIF 处理能力,可在 gif_mcp/server.py 中新增工具后重新运行 uv run gif-mcp

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

gif_mcp-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

gif_mcp-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gif_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gif_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff435e1c11e1a3fff969f2f3185bda5c9b2c53467d1c793a13a68f3d1a054c32
MD5 64d24ada12622a5a67f7f26fdf19addb
BLAKE2b-256 49c8e2cde176881a01e0854a5a2956f76aa791763837ea82e2f2a11f78ea280d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gif_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gif_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb55ca6b2f4fbd9867c9176185b9d1d95738dff7011dabdd5bc59e07236c1d52
MD5 ea9812a213e7b20cc617000e1de97484
BLAKE2b-256 950b14d89ab04e9749a31469ca57a4df471a78ab95f7cdd5d22ea3c236fc4530

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