What is MCP?

The Model Context Protocol lets AI assistants call external tools. Tenax provides an MCP server that gives Claude Code direct access to tensor network algorithms — no boilerplate, no copy-paste.

Ask Claude to “find the ground state energy of a 20-site Heisenberg chain” and it will call run_dmrg with the right parameters, interpret the results, and explain the physics.

Setup

Add the Tenax MCP server to your Claude Code configuration (~/.claude/settings.json):

{
  "mcpServers": {
    "tenax": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/tenax-mcp",
        "run", "tenax-mcp"
      ]
    }
  }
}

MCP Tools

Tenax exposes 9 tools through the MCP server. Claude Code can call any of them directly during a conversation.

run_dmrg

Run DMRG ground state search for a 1D quantum Hamiltonian. Specify the chain length, Hamiltonian terms, bond dimension, number of sweeps, and convergence tolerance. Returns the ground state energy, energy per sweep, and convergence status.

run_trg

Run the Tensor Renormalization Group on a 2D classical model. Currently supports the 2D Ising model. Provide inverse temperature or temperature, coupling constant, and TRG bond dimension. Returns free energy per site, exact solution, and relative error.

run_hotrg

Run Higher-Order TRG on a 2D classical model. Uses higher-order SVD for more accurate coarse-graining than standard TRG. Supports configurable direction order (alternating, horizontal, vertical). Returns free energy per site, exact solution, and relative error.

build_hamiltonian

Build an MPO Hamiltonian from operator terms and return diagnostic info (bond dimensions, number of terms, total Hilbert space dimension) without running a calculation.

optimize_contraction

Find the optimal contraction path and FLOP cost for a tensor network. Provide tensor labels and dimensions; returns the optimal contraction order, FLOP count, and speedup over naive contraction.

validate_network

Check tensor network validity — dimension matching, charge consistency, and flow directions. Returns a validation result with a list of any issues found.

generate_code

Generate complete, runnable Tenax Python code from a high-level description. Supports DMRG, TRG, HOTRG, iDMRG, iPEPS (1-site, 2-site, split-CTM), fermionic iPEPS, standard CTM with Tensor protocol, and quasiparticle excitations. Returns a ready-to-run Python script.

list_operators

List available built-in spin operators and their matrix representations. Supports spin-1/2 (Sz, Sp, Sm, Id) and spin-1 (Sz, Sp, Sm, Id in the |+1⟩, |0⟩, |-1⟩ basis).

export_netfile

Convert a tensor network description to .net file format (Cytnx-compatible). Provide tensor names and leg labels; returns a ready-to-use network file.

Tenax Toolkit (Claude Code Plugin)

The Tenax Toolkit is a Claude Code plugin that gives Claude 18 domain-specific skills for tensor network simulations. Install it once and Claude automatically knows how to guide you through DMRG, iPEPS, TRG, symmetry-aware tensors, and more.

Install

In Claude Code, first add the plugin from the marketplace (one-time setup), then install it:

claude plugin marketplace add tenax-lab/tenax-toolkit
claude plugin install tenax-toolkit

That’s it — all 18 skills are immediately available. Claude will automatically invoke them when your questions match (e.g., asking about DMRG triggers tenax-dmrg-workflow, asking about symmetries triggers tenax-symmetry).

Skills

Algorithm Workflows

tenax-dmrg-workflow

Complete DMRG ground-state calculation: finite DMRG, iDMRG, and 2D cylinder DMRG with AutoMPO Hamiltonians.

tenax-ipeps-workflow

iPEPS pipeline: simple update, AD-based optimization with CTM environments, and quasiparticle excitation spectra.

tenax-trg-workflow

TRG and HOTRG for 2D classical stat mech: partition functions, free energy, and phase transitions.

tenax-fermionic-ipeps

Fermionic iPEPS with graded tensors: FermionParity, FermionicU1, spinless fermions, and the t-V model.

Building Blocks

tenax-tensor-ops

Core tensor operations: DenseTensor, SymmetricTensor, label-based contraction, SVD, QR, and eigendecomposition.

tenax-symmetry

Symmetry system: U(1) and Z_n, TensorIndex with charges and FlowDirection, block-sparse operations.

tenax-autompo

Build Hamiltonian MPOs from natural-language model descriptions using AutoMPO.

tenax-blueprint

Design tensor network contractions using NetworkBlueprint and .net topology files.

tenax-observables

Compute expectation values, correlation functions, entanglement entropy, and order parameters.

Validation, Benchmarking & Teaching

tenax-debugger

Diagnose shape mismatches, JAX tracing issues, gradient problems, and convergence failures.

tenax-benchmark

Design and run performance benchmarks across CPU, CUDA, TPU, and Metal backends.

tenax-ed-comparator

Run exact diagonalization and DMRG side-by-side to validate results and study truncation error.

tenax-homework

Generate scaffolded tensor network homework problems for graduate courses.

tenax-getting-started

Install Tenax, configure JAX backends, and run your first calculation.

Migration from Other Libraries

tenax-migration-itensor

Translate ITensor (Julia/C++) code and concepts to Tenax.

tenax-migration-tenpy

Translate TeNPy code and concepts to Tenax.

tenax-migration-cytnx

Translate Cytnx code and concepts to Tenax.

tenax-migration-quimb

Translate quimb code and concepts to Tenax.