Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ build/
develop-eggs/
dist/
manimlib.egg-info/
*.egg-info/

# uv
uv.lock

downloads/
eggs/
Expand Down Expand Up @@ -151,5 +155,6 @@ dmypy.json
# For manim
/videos
/custom_config.yml
/latex_cache
test.py
CLAUDE.md
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

128 changes: 89 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,58 @@ Note, there are two versions of manim. This repository began as a personal proj
> [!Note]
> **Note**: To install manim directly through pip, please pay attention to the name of the installed package. This repository is ManimGL of 3b1b. The package name is `manimgl` instead of `manim` or `manimlib`. Please use `pip install manimgl` to install the version in this repository.

Manim runs on Python 3.7 or higher.
Manim runs on Python 3.10 or higher (3.12+ recommended).

System requirements are [FFmpeg](https://ffmpeg.org/), [OpenGL](https://www.opengl.org/) and [LaTeX](https://www.latex-project.org) (optional, if you want to use LaTeX).
For Linux, [Pango](https://pango.org) along with its development headers are required. See instruction [here](https://github.com/ManimCommunity/ManimPango#building).

### Using uv (recommended)

### Directly
This project uses [uv](https://docs.astral.sh/uv/) for environment and dependency management.

```sh
# Install manimgl
# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and sync
git clone https://github.com/3b1b/manim.git
cd manim
uv sync

# Try it out
uv run manimgl example_scenes.py OpeningManimExample
# or
uv run manim-render example_scenes.py OpeningManimExample
```

### Using pip

```sh
# Install manimgl from PyPI
pip install manimgl

# Try it out
manimgl
```

For more options, take a look at the [Using manim](#using-manim) sections further below.

If you want to hack on manimlib itself, clone this repository and in that directory execute:
If you want to hack on manimlib itself, clone this repository and install in editable mode:

```sh
# Install manimgl
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .

# Try it out
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExample
```

### Directly (Windows)
### Platform-specific notes

**Windows:**
1. [Install FFmpeg](https://www.wikihow.com/Install-FFmpeg-on-Windows).
2. Install a LaTeX distribution. [MiKTeX](https://miktex.org/download) is recommended.
3. Install the remaining Python packages.
```sh
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .
manimgl example_scenes.py OpeningManimExample
```
3. Clone and install as above.

### Mac OSX

1. Install FFmpeg, LaTeX in terminal using homebrew.
**Mac OSX:**
1. Install FFmpeg and LaTeX via homebrew:
```sh
brew install ffmpeg mactex
```
Expand All @@ -74,31 +81,23 @@ manim-render example_scenes.py OpeningManimExample

> To avoid installing the full MacTeX bundle, which is ~6GB, you can alternatively install the
> lightweight [BasicTeX](https://formulae.brew.sh/cask/basictex) and then gradually add
> only the LaTeX packages you actually need. A list of packages sufficient to run examples can
> only the LaTeX packages you actually need. A list of packages sufficient to run examples can
> be found [here](https://github.com/3b1b/manim/issues/2133#issuecomment-2414547866).
> For an overview of the MacTeX installer bundles, see https://www.tug.org/mactex/.
</details>

2. If you are using an ARM-based processor, install Cairo.
2. If you are using an ARM-based processor, install Cairo:
```sh
arch -arm64 brew install pkg-config cairo
```

3. Install latest version of manim using these command.
```sh
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .
manimgl example_scenes.py OpeningManimExample (make sure to add manimgl to path first.)
```

## Anaconda Install

1. Install LaTeX as above.
2. Create a conda environment using `conda create -n manim python=3.9`.
3. Activate the environment using `conda activate manim`.
4. Install manimgl using `pip install -e .`.
3. Clone and install as above.

**Linux:**
Install Pango development headers (required for `manimpango`):
```sh
sudo apt-get install libpango1.0-dev # Debian/Ubuntu
```

## Using manim
Try running the following:
Expand All @@ -119,7 +118,58 @@ When running in the CLI, some useful flags include:

Take a look at custom_config.yml for further configuration. To add your customization, you can either edit this file, or add another file by the same name "custom_config.yml" to whatever directory you are running manim from. For example [this is the one](https://github.com/3b1b/videos/blob/master/custom_config.yml) for 3blue1brown videos. There you can specify where videos should be output to, where manim should look for image files and sounds you want to read in, and other defaults regarding style and video quality.

### Documentation
## MCP Server

This repository includes an [MCP](https://modelcontextprotocol.io/) (Model Context Protocol) server that exposes ManimGL's functionality to LLMs. This lets AI assistants generate and render math explainer videos, inspect available objects and animations, and validate scene code.

### Setup

```sh
uv sync --extra mcp
uv run manimgl-mcp
```

### Tools

| Tool | Description |
|---|---|
| `create_math_video` | Create a structured video plan from a natural language math topic description |
| `render` | Render a scene to mp4, gif, or png from Python code |
| `preview` | Capture a single frame as base64 PNG for quick feedback |
| `validate` | Check scene code for syntax/import errors without rendering |
| `list_topics` | Browse available math video topic templates by category and level |
| `get_topic_template` | Get a full video template with concept arc and renderable scene code |
| `get_math_helpers` | Get reusable math helper functions for a domain (calculus, linear algebra, etc.) |
| `get_example` | Get working example code for 18 common animation patterns |
| `list_mobjects` | List available mathematical object classes with signatures |
| `list_animations` | List available animation classes with signatures |

### Resources

| Resource | Description |
|---|---|
| `manim://style-guide` | Animation timing, color conventions, camera work, and common pitfalls |
| `manim://pedagogy` | 3Blue1Brown visual teaching principles: concrete before abstract, geometry before algebra |
| `manim://constants` | Direction vectors, frame dimensions, buffer sizes, and color palette |
| `manim://config` | Default rendering configuration (resolution, FPS, background) |

### Client configuration

To use the MCP server with an LLM client (Claude Desktop, Kiro, etc.), add the following to your MCP configuration:

```json
{
"mcpServers": {
"manimgl": {
"command": "uv",
"args": ["run", "--extra", "mcp", "manimgl-mcp"],
"cwd": "/path/to/this/repo"
}
}
}
```

## Documentation
Documentation is in progress at [3b1b.github.io/manim](https://3b1b.github.io/manim/). And there is also a Chinese version maintained by [**@manim-kindergarten**](https://manim.org.cn): [docs.manim.org.cn](https://docs.manim.org.cn/) (in Chinese).

[manim-kindergarten](https://github.com/manim-kindergarten/) wrote and collected some useful extra classes and some codes of videos in [manim_sandbox repo](https://github.com/manim-kindergarten/manim_sandbox).
Expand Down
34 changes: 34 additions & 0 deletions latex_cache/working.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
\documentclass[preview]{standalone}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{microtype}
\usepackage{pifont}
\DisableLigatures{encoding = *, family = * }
\linespread{1}
%% Borrowed from https://tex.stackexchange.com/questions/6058/making-a-shorter-minus
\DeclareMathSymbol{\minus}{\mathbin}{AMSa}{"39}


\begin{document}

\centering
\begin{align*}
x
\end{align*}

\end{document}
5 changes: 1 addition & 4 deletions manimlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from importlib.metadata import version, PackageNotFoundError
except ImportError: # For Python <3.8 fallback
from importlib_metadata import version, PackageNotFoundError # type: ignore
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("manimgl")
Expand Down
1 change: 1 addition & 0 deletions mcp_server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ManimGL MCP Server
Loading