manim-mcp-server

alk231/manim-mcp-server

3.1

If you are the rightful owner of manim-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This is an MCP server that executes Manim animation code and returns the generated video.

Manim MCP Server

Overview

A Model Context Protocol (MCP) server that executes Manim animation code and returns generated videos. This server allows AI assistants like Claude to dynamically generate mathematical animations using Manim.

Features

  • ✨ Execute Manim Python scripts via MCP
  • 📁 Automatic media folder management
  • 🧹 Cleanup tools for temporary files
  • ⚙️ Configurable via environment variables
  • 🚀 Compatible with FastMCP Cloud

Quick Start with FastMCP Cloud

This server is optimized for deployment on FastMCP Cloud:

  1. Fork this repository
  2. Deploy to FastMCP Cloud using the repository URL
  3. The server will be automatically configured using pyproject.toml

Local Installation

Prerequisites

  • Python 3.11+
  • Manim (Community Edition)
  • pip or uv package manager

Install Dependencies

pip install -e .

Or using uv (faster):

uv pip install -e .

Run the Server

python src/manim_server.py

Integration with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "manim-server": {
      "command": "python",
      "args": ["/absolute/path/to/manim-mcp-server/src/manim_server.py"],
      "env": {
        "MANIM_EXECUTABLE": "manim"
      }
    }
  }
}

Finding Paths

Windows (PowerShell):

(Get-Command python).Source

Linux/macOS:

which python

Available Tools

execute_manim_code

Executes Manim animation code and generates video output.

Parameters:

  • manim_code (str): Python code containing Manim scene definition

Returns:

  • Dictionary with status, message, and output details

cleanup_manim_temp_dir

Cleans up temporary Manim output directory.

Parameters:

  • directory (str): Path to directory to clean up

Returns:

  • Dictionary with status and message

Example Usage

from manim import *

class SquareToCircle(Scene):
    def construct(self):
        square = Square()
        circle = Circle()
        circle.set_fill(PINK, opacity=0.5)
        self.play(Create(square))
        self.play(Transform(square, circle))
        self.wait()

Project Structure

manim-mcp-server/
├── src/
│   ├── manim_server.py    # Main MCP server
│   └── media/             # Output directory
├── pyproject.toml         # Project configuration
├── README.md              # Documentation
└── LICENSE.txt            # MIT License

Configuration

Environment variables:

  • MANIM_EXECUTABLE: Path to Manim executable (default: "manim")

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m "Add feature"
  4. Push to branch: git push origin feature-name
  5. Open a pull request

License

MIT License - see LICENSE.txt for details

Credits

Connect

Instagram: @aiburner_official