# VisualTorch

VisualTorch turns PyTorch model structure into architecture diagrams and animated GIFs. Use it when an agent needs to inspect a neural network visually.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 341
- Author: hiddenstateresearch
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hiddenstateresearch/visualtorch
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/visualtorch

## What it does

VisualTorch is an MCP server for visualizing PyTorch models. It can render `graph`, `flow`, and `lenet` architecture styles, plus animated GIFs that reveal the model layer by layer or column by column. The server uses stdio and returns structured output metadata.

The project lists Python 3.10+ and PyTorch 2.0+ as requirements. Its MCP extras can be installed with `visualtorch[mcp]`, while Claude Code connects through `uvx`. VisualTorch supports PyTorch `Sequential` and custom models. It traces a real forward pass, so data-dependent control flow is represented by the branch taken for the test input. Models with several meaningful output tensors still get node sizing from the first tensor, although `show_dimension=True` can show every output shape. That matters when the model relies on conditional paths or multi-output layers.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add visualtorch -- uvx visualtorch
```
uvx runs the command named after the package; if the README names another one, use uvx --from visualtorch <command>

### Codex

**Platform CLI**
```bash
codex mcp add visualtorch -- uvx visualtorch
```
uvx runs the command named after the package; if the README names another one, use uvx --from visualtorch <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "visualtorch": {
            "command": "uvx",
            "args": [
                "visualtorch"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from visualtorch <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "visualtorch": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "visualtorch"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from visualtorch <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add visualtorch uvx visualtorch
```
uvx runs the command named after the package; if the README names another one, use uvx --from visualtorch <command>

## When to use it
- render a PyTorch architecture diagram
- map layer connections in `graph` style
- generate a model view in `flow` or `lenet` style
- create a GIF that reveals the architecture step by step
- inspect a custom model through a forward pass

## Example prompts
- Use VisualTorch to render the PyTorch model from `model.py` in `graph` style and show tensor dimensions.
- Generate an animated `flow` GIF for this model with VisualTorch.
- Render the same model in `graph`, `flow`, and `lenet` styles, then compare the diagrams.

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [labelhead-artist-momentum](https://affpapa.org/en/nevibecode/mcp/labelhead-artist-momentum.md) — MCP server · ★ 107423
- [Agent Skills Search Server](https://affpapa.org/en/nevibecode/mcp/agent-skills-search-server.md) — MCP server · ★ 26559
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [PraisonAI](https://affpapa.org/en/nevibecode/mcp/praisonai.md) — MCP server · ★ 9289

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
