VisualTorch MCP Server
io.github.willyfh/visualtorch
Visualize PyTorch neural network architectures as static diagrams or animated GIF reveals in multiple styles.
What is the VisualTorch MCP server?
VisualTorch is a PyTorch visualization tool that generates architecture diagrams for neural networks in flow, graph, and LeNet styles. It supports both static PNG output and animated GIF reveals that show model layers progressively, using real forward-pass tracing to build accurate visualizations.
VisualTorch helps you understand PyTorch model architectures by rendering them as visual diagrams. It offers three distinct visualization styles (flow, graph, LeNet), can generate animated GIFs showing layer-by-layer reveals, and includes an MCP server for integration with AI agents. Useful for documentation, research, and model exploration.
How to install VisualTorch
Copy-paste configuration for popular MCP clients.
Tools & capabilities
Tools this server exposes to the agent.
visualize— Generate static PNG diagrams of PyTorch model architectures in flow, graph, or LeNet styleanimate— Create animated GIF reveals showing PyTorch models one layer or column at a timecapability_discovery— Discover available visualization styles and configuration options
Use cases
- Generate publication-ready architecture diagrams for research papers and documentation
- Create animated model reveals for presentations and tutorials
- Visualize custom PyTorch Sequential and custom models to understand layer flow
- Export model architecture visualizations in multiple styles for different use cases
- Explore and debug neural network structures through interactive visual representations
VisualTorch MCP server FAQ
VisualTorch is a PyTorch visualization library that generates architecture diagrams and animated GIF reveals for neural networks. It supports three visualization styles (flow, graph, LeNet) and uses real forward-pass tracing to build accurate model visualizations.
Yes, VisualTorch is open source under the MIT License and available for free on PyPI.
Install with `pip install "visualtorch[mcp]"` to get the optional MCP server component. It provides stdio-based integration for generating diagrams from PyTorch model source code.
VisualTorch requires Python 3.10+ and PyTorch 2.0+.
VisualTorch supports PyTorch Sequential and custom models. It traces a real forward pass, so models with data-dependent control flow may only show the branch taken by the dummy input.
Yes, the MCP server enables integration with Claude and other MCP-compatible clients. Install with `pip install "visualtorch[mcp]"` and configure stdio access per the MCP integration guide.
README (reference)
Source of truth, from the repository.
VisualTorch aims to help visualize Torch-based neural network architectures. It currently supports generating flow-style, graph-style, and LeNet-style architectures for PyTorch Sequential and Custom models. Its original visual styles were inspired by visualkeras, pytorchviz, pytorch-summary, and torchview; since then, it has grown its own unified tracing backend and architecture-handling logic well beyond its origins.
Note: 1.0+ is a major release with breaking API changes, but with significantly better features and algorithms - upgrading is recommended. For the old API, use 0.2.5 or older.
Limitation: VisualTorch traces a real forward pass to build the diagram, which has an inherent
limitation shared by any tracing-based approach (not a bug, and not fixable without full symbolic
execution): models with data-dependent control flow (e.g. a branch only taken if a tensor
value crosses some threshold) only show whichever branch the traced dummy input happened to take.
Separately, a layer that returns multiple meaningful output tensors (e.g. a custom multi-task
head, or nn.LSTM's (output, (h_n, c_n))) still has its node's size based on only its first
tensor; with show_dimension=True, every output tensor's shape is shown in the label, not just
the first. Downstream connections are correct either way. Contributions are welcome!

Animated Reveal
Every style can also render as an animated GIF, revealing the model one layer/column at a time,
via visualtorch.animate(model, input_shape, style=...) - see it in action for
flow,
graph, and
lenet styles.

Documentation
Online documentation is available at visualtorch.readthedocs.io.
The docs include usage examples, API references, and other useful information.
Installation
See the Installation page.
MCP integration
VisualTorch includes an optional, client-neutral stdio MCP server for generating static PNG
diagrams and animated GIF reveals from PyTorch model source. It exposes capability discovery,
structured output metadata, documentation resources, subprocess timeouts, and all three canonical
styles (graph, flow, and lenet). Install it with pip install "visualtorch[mcp]" and see the
MCP integration guide
for the tool schemas, generic stdio configuration, examples, and trusted-code security boundary.
No client-specific plugin or extension is required.
Used in Research
VisualTorch has been used in published research, including works published in Nature, IEEE, and MDPI.
See the Research Showcase page for the full list.
Used VisualTorch in your research, built something with it, or found a paper that cites it? Tell us about it or open a pull request to add it directly - we'd love to hear.
Examples
See the Usage Examples page.
Contributing
Please feel free to send a pull request to contribute to this project by following this guideline.
Releases
See GOVERNANCE.md for release methodology and cadence, and the PyPI release history for past releases.
License
This poject is available as open source under the terms of the MIT License.
Originally, this project was based on the visualkeras (under the MIT license), with additional modifications inspired by pytorchviz, pytorch-summary, and torchview, all of which are also licensed under the MIT license.
Citation
Please cite this project in your publications if it helps your research.
Note: the paper below describes VisualTorch as of its publication date (2024). The project has since been substantially refactored, including breaking API changes (see the documentation for the current API) - the DOI always resolves to what was actually reviewed and published.
@article{Hendria2024,
doi = {10.21105/joss.06678},
url = {https://doi.org/10.21105/joss.06678},
year = {2024},
publisher = {The Open Journal},
volume = {9},
number = {102},
pages = {6678},
author = {Willy Fitra Hendria and Paul Gavrikov},
title = {VisualTorch: Streamlining Visualization for PyTorch Neural Network Architectures},
journal = {Journal of Open Source Software}
}
Star History
<picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/willyfh/visualtorch/assets/docs/source/_static/images/star-history-dark.png" /> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/willyfh/visualtorch/assets/docs/source/_static/images/star-history-light.png" /> <img alt="Star History Chart" src="https://raw.githubusercontent.com/willyfh/visualtorch/assets/docs/source/_static/images/star-history-light.png" /> </picture>Related MCP servers

ContextLib
A project's long-term memory as plain Markdown files, with an append-only, tamper-evident log.

AgentBrain Handoffs
Exact, durable handoffs between AI coding agents: one turn in the right session, never twice.

Item-by-item inventory that reorders itself: per-SKU forecasts, purchase orders and ETAs.
View repository →Email marketing y transaccional AI-native: campañas, correos 1-a-1, contactos, flujos y métricas.
View repository →
io.github.wilzer/aidelly
Agent-operated social media for agencies — www.aidelly.ai. Post, approve, analyze on 11 networks.
Satellite land due-diligence: a green/caution/walk-away verdict with cited signals for any parcel.

