mcp-manimgl
Exposes manimgl mathematical animation functionality as MCP tools, enabling LLMs to create animated scenes with narration and background music, and render to video.
README
mcp-manimgl — MCP server exposing manimgl (Manim OpenGL) mathematical animation functionality as tools for LLMs.
mcp-name: io.github.daedalus/mcp-manimgl
Install
pip install mcp-manimgl
Optional extras:
# For rendering (requires manimgl + system deps)
pip install "mcp-manimgl[render]"
# For audio narration + MIDI music support
pip install "mcp-manimgl[audio]"
System Dependencies
| Dependency | Required for | Install |
|---|---|---|
ffmpeg + ffprobe |
Audio mixing, narration sync, music ducking | apt install ffmpeg |
libfluidsynth3 |
MIDI file rendering to audio | apt install libfluidsynth3 |
SoundFont (.sf2/.sf3) |
MIDI instrument sounds | apt install fluidr3mono-gm-soundfont |
| pangocairo, OpenGL | Manim rendering engine | See manimgl docs |
The server checks for non-Python dependencies at startup and reports any missing ones to stderr and via the mcp-manimgl://info resource.
Usage
MCP Server
# Run with stdio transport (default for MCP)
mcp-manimgl
In Claude Desktop / Cursor / MCP clients
Add to your mcp.json:
{
"mcpServers": {
"mcp-manimgl": {
"command": "mcp-manimgl"
}
}
}
Tools
The server exposes these tool categories:
Scene Management
create_scene— Create/configure a new sceneclear_scene— Remove all elementsadd_wait— Add wait/pauseset_camera— Configure cameraset_config— Set global rendering configsave_state/restore_state— State managementgenerate_scene_script— Get the generated Python script
Mobject Creation
add_circle,add_square,add_rectangle,add_polygonadd_line,add_arrow,add_dotadd_text,add_tex(LaTeX)add_function_graph,add_parametric_curveadd_coordinate_system,add_vectoradd_labeled_point,add_brace,add_number_lineadd_decimal_number,add_matrixadd_3d_object(sphere, cube, torus, cone, cylinder)
Mobject Manipulation
move_to,shift,scale,rotateset_color,set_opacitynext_to,align_to
Animations
animate_transform,animate_fade_in/out,animate_growanimate_rotate,animate_scale,animate_shiftanimate_indicate,animate_write,animate_set_coloranimate_move_along_path,animate_group
Audio
add_narration— Generate TTS (gTTS) narration that plays at the current timeline positionadd_background_music— Add background music from audio files or MIDI files (auto-rendered via FluidSynth). Supports volume control, looping, and sidechain ducking during narration.
Rendering
render_scene— Render to video (auto-mixes background music + narration with ducking)save_frame— Save single frameget_render_status— Check environment
Audio Features
Narration
# TTS narration at current timeline position
add_narration("Shor's algorithm factors large numbers in polynomial time.")
Background Music
Accepts audio files (.mp3, .wav, .ogg) or MIDI files (.mid, .midi). MIDI files are rendered to audio using FluidSynth and the system SoundFont.
# From an audio file
add_background_music("/path/to/music.mp3", volume=0.3, loop=True)
# From a MIDI file (auto-rendered)
add_background_music("/path/to/classical.mid", volume=0.2)
# With ducking configuration
add_background_music(
"bach_chorale.mid",
volume=0.25,
loop=True,
duck_threshold="-20dB",
duck_ratio=6,
duck_attack=0.05,
duck_release=0.3,
)
When both background music and narration are present, render_scene automatically:
- Renders the video without audio via manimgl
- Places the music track (looped if needed) at the configured volume
- Places each narration track at its timeline position
- Applies sidechain compression so music volume ducks during narration
- Composites everything into the final MP4 via ffmpeg
Example: Shor's Algorithm
A narrated animation explaining Shor's algorithm with LaTeX, 5 TTS narration tracks, and classical MIDI background music.
MCP tool call sequence:
# 1. Configure scene
create_scene(background_color="#0a0a2e", resolution="1920x1080", fps=30)
# 2. Background music (auto-loops to fill video duration)
add_background_music("classical.mid", volume=0.25, loop=True)
# 3. Create mobjects + animate (5 sections)
add_tex("Shor's Algorithm", font_size=72, color="#FFD700")
add_tex("Integer Factorization on Quantum Computers", font_size=36, color="#88CCFF")
animate_fade_in("m_...", run_time=1.5)
# ... more shapes, LaTeX formulas, fade-ins, fade-outs ...
# 4. Narration at specific timeline positions
add_narration("Shor's algorithm factors large numbers...") # ~3.5s
add_narration("The factoring problem...") # ~18.5s
add_narration("Key insight: reduce factoring to period...") # ~36.1s
add_narration("Quantum period finding uses superposition...") # ~55.4s
add_narration("Summary of Shor's algorithm...") # ~76.3s
# 5. Render (auto-mixes video + narrations + ducked BGM)
render_scene(output_path="data/Shors_Algorithm.mp4")
See the full scene script at shor_mcp.py in the repository root.
MIDI Rendering
MIDI files are rendered using pyfluidsynth with a system SoundFont. On Debian/Ubuntu:
sudo apt install fluidr3mono-gm-soundfont libfluidsynth3
pip install "mcp-manimgl[audio]"
Auto-discovered SoundFont paths:
/usr/share/sounds/sf3/(.sf3)/usr/share/sounds/sf2/(.sf2)/usr/share/fluidr3mono-gm-soundfont/
Development
git clone https://github.com/dclavijo/mcp-manimgl.git
cd mcp-manimgl
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint + type check
prospector --with-tool ruff --with-tool mypy src/
# security scan
semgrep --config=auto --severity=ERROR src/
# find unused code
vulture --min-confidence 90 src/
MCP
mcp-name: io.github.dclavijo/mcp-manimgl
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
