# VisualTorch MCP server

> Generates static PNG diagrams and animated GIF reveals of PyTorch neural network architectures using flow, graph, or LeNet styles.

- Repository: https://github.com/willyfh/visualtorch
- Page: https://hostedmcp.org/servers/willyfh/visualtorch
- Transport: stdio
- Stars: 351
- License: MIT
- Latest version: 1.4.1

## Install

### Claude Code

```sh
claude mcp add visualtorch -- uvx visualtorch
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "visualtorch": {
      "command": "uvx",
      "args": [
        "visualtorch"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "visualtorch": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "visualtorch"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"visualtorch","type":"stdio","command":"uvx","args":["visualtorch"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "visualtorch": {
      "command": "uvx",
      "args": [
        "visualtorch"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add visualtorch -- uvx visualtorch
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.visualtorch]
command = "uvx"
args = ["visualtorch"]
```

### Gemini CLI

```sh
gemini mcp add -s user visualtorch uvx -- visualtorch
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "visualtorch": {
      "command": "uvx",
      "args": [
        "visualtorch"
      ]
    }
  }
}
```

## FAQ

### What styles of architecture diagrams can I generate?

VisualTorch supports three canonical styles: graph, flow, and lenet.

### Can I create animations of my model architecture?

Yes, every style can be rendered as an animated GIF that reveals the model one layer or column at a time.

### What is the limitation regarding data-dependent control flow?

Because VisualTorch traces a real forward pass, models with branches that depend on specific tensor values will only show the branch taken by the dummy input used during tracing.

### How do I install the MCP server component?

You can install the MCP integration by using the command `pip install "visualtorch[mcp]"`.
