Skip to main content

GIF MCP 服务器

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

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

环境要求

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

安装与运行

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

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

可用工具

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。

Metadata

Release files for gif-mcp 0.1.0

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

Source distribution (sdist)

Source distribution for gif-mcp 0.1.0
File Size Uploaded
gif_mcp-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gif-mcp 0.1.0
File Interpreter ABI Platform
gif_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / gif_mcp-0.1.0.tar.gz

Download URL gif_mcp-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ff435e1c11e1a3fff969f2f3185bda5c9b2c53467d1c793a13a68f3d1a054c32
BLAKE2b-256 checksum
How to use checksums
49c8e2cde176881a01e0854a5a2956f76aa791763837ea82e2f2a11f78ea280d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / gif_mcp-0.1.0-py3-none-any.whl

Download URL gif_mcp-0.1.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb55ca6b2f4fbd9867c9176185b9d1d95738dff7011dabdd5bc59e07236c1d52
BLAKE2b-256 checksum
How to use checksums
950b14d89ab04e9749a31469ca57a4df471a78ab95f7cdd5d22ea3c236fc4530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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