Skip to main content
Glama

opensta-mcp

An MCP server that keeps one OpenSTA process alive for the whole conversation and exposes static timing and power analysis as nine tools. An agent (Claude Code, or any MCP client) loads a design once, then asks questions; the server translates each question into OpenSTA Tcl, runs it in the live session, and returns the result with the exact command it ran.

Claude Code  ──JSON-RPC over stdio──▶  opensta-mcp (Python)  ──Tcl over stdin/stdout──▶  sta
             ◀──────────────────────                          ◀────────────────────────

The left pipe carries request ids; the right pipe is plain text and carries none. Everything in session.py exists because of that asymmetry.

Tools

tool

what it does

load_design(liberty, verilog, top, sdc="", spef="")

reads the design (liberty may be a list); returns per-step timings and a digest of warnings

get_summary()

worst setup/hold slack, TNS/WNS, min period and fmax per clock, DRV violation counts, cell/net counts

report_timing(path_delay, path_count, scope, from_pin, to_pin, fields, format)

report_checks with the common options typed; scope="reg2reg" etc.

report_power(top_instances=0, format="text")

power by group and component, optionally the N highest-power instances; always states whether switching activity came from a VCD/SAIF or from OpenSTA defaults

run_tcl(command)

any other OpenSTA command, sandboxed and journaled; shows printed output and the Tcl return value; run_tcl("help report_checks") shows options

find_commands(pattern="*")

names of the OpenSTA commands matching a glob; for when the agent does not know a command's name

get_status()

what sta is doing now; works even while another tool is waiting

get_conditions(state=0)

the files, constraint changes, activity source and scenes a result was computed under; every result ends with [conditions #n], and state=n reads that state back from the journal

restart_session()

the only way the sta process is restarted; after sta dies every other tool is refused until this is called

Every analysis result (the report tools, get_summary, load_design, and run_tcl when it runs a report_* command) ends with one line naming its conditions, e.g. [conditions #2] liberty: sky130_fd_sc_hd__tt_025C_1v80 | sdc: 6_final.sdc +1 change by run_tcl | spef: 6_final.spef. The number advances on load_design and on every state-changing run_tcl, so two results with the same number were computed under the same conditions. The count is by the text sent, so a command OpenSTA accepts but ignores, or a read_sdc of an empty file, is counted too. load_design on a running sta reads the SDC on top of the earlier state; the line then says so and earlier run_tcl changes are listed apart. Call restart_session first for a clean state.

Anything not covered by a dedicated tool goes through run_tcl. Commands that recur in the journal are candidates for promotion to a dedicated tool.

Related MCP server: Fusion Compiler Session MCP

Install

git clone https://github.com/InsungHeo/opensta-mcp && cd opensta-mcp
python3 -m venv .venv && source .venv/bin/activate
pip install -e .            # adds the `opensta-mcp` and `opensta-mcp-probe` commands
which sta                   # OpenSTA must be on PATH, or set STA_BIN

Register with Claude Code (adjust paths):

claude mcp add opensta \
  --env STA_BIN=/path/to/OpenROAD/bin/sta \
  -- /path/to/opensta-mcp/.venv/bin/opensta-mcp

or copy examples/claude_mcp.json into your project's .mcp.json.

Claude Code on Windows, OpenSTA in WSL. A Windows claude cannot execute a Linux path, and --env sets a Windows-side variable that does not cross into WSL. Launch the server through wsl.exe and set the variable inside it:

claude mcp add --scope user opensta -- \
  wsl.exe -d Ubuntu-24.04 --exec env STA_BIN=/home/<you>/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/sta \
  /home/<you>/opensta-mcp/.venv/bin/opensta-mcp
claude mcp list        # should show opensta as connected

--exec matters: without it the command goes through a shell first, which expands $VAR and $(...) before your own settings apply.

Two Windows shell traps seen in practice:

  • PowerShell 5.1 drops -- when calling a native program, so claude reads -d as its own option (unknown option '-d'). Run the command from Git Bash or cmd instead.

  • Git Bash rewrites /home/... into a Windows path. Prefix the command with MSYS_NO_PATHCONV=1.

Configuration (environment variables)

variable

default

meaning

STA_BIN

sta

OpenSTA binary

STA_ARGS

-no_splash -no_init

extra arguments

OPENSTA_MCP_HOME

~/.opensta-mcp

where sessions and ownership files live

OPENSTA_MCP_STDERR

file

file: sta's stderr goes to sta.stderr.log; merge: into stdout

OPENSTA_MCP_STALL_S

60

seconds of silence before the server checks whether sta is idle

OPENSTA_MCP_MAX_OUTPUT

12000

characters returned per tool call before truncation (about 150 report lines)

OPENSTA_MCP_LOG

INFO

server log level (stderr + server.log)

What a session leaves behind

~/.opensta-mcp/sessions/20260926_153012_4242/
    journal.jsonl     every command: tool, arguments, Tcl sent, ok/error, seconds, warning count
    replay.tcl        only the state-changing commands; `sta replay.tcl` reproduces the session by hand
    warnings.log      every warning line, grouped by command (OpenSTA prints warnings on stdout)
    sta.stderr.log    the sta process's stderr, for crash traces
    server.log        the server's log

tail -f journal.jsonl in another terminal shows what the agent is doing in real time.

Design decisions

  1. One live process, not one per query. Liberty/SPEF loading dominates; constraints set earlier must still apply later.

  2. Scripts travel as base64 data. The stdin line is always a complete Tcl command (__mcp_run <id> <base64>), so an unbalanced brace becomes a caught error instead of an interpreter waiting for more input.

  3. catch decides success. The Tcl side reports __MCP_ERR__ <id> before the error text; the server never guesses from output patterns.

  4. A per-request end marker. __MCP_DONE__ <id> with a fresh id per command, matched as a whole line, so late output from an abandoned command is recognised and dropped.

  5. One lock in front of the pipe. The MCP side may send requests concurrently; the sta side cannot tell them apart.

  6. No automatic restart. Death, computing and stalled are distinguished (/proc/<pid>/stat) and reported with a diagnosis. After sta dies every command is refused until restart_session, so nothing runs silently on a fresh sta that lacks the design and constraint changes.

  7. Dies with its parent. PR_SET_PDEATHSIG, spawned from the reader thread so the signal is tied to the process lifetime. Ownership files let a new server reap orphans left by a crashed one, and only those.

  8. Sandbox, inside the interpreter. exec exit socket source cd load are deleted from the Tcl interpreter (the session stops sta by closing its stdin); open is wrapped to allow reading only (OpenSTA's own read_sdc and include read files through Tcl open, so removing it breaks them; the first real-OpenSTA run found this); file keeps read-only subcommands; rename and interp are deleted last, so nothing can be brought back, not even from a file read with include; auto_noexec stops Tcl from running a program for an unknown word. OpenSTA's own file writers (at any command position) and > file redirection are allowed only under the session directory (only the output argument is checked; library and model inputs may live anywhere). The original open and file remain reachable inside the interpreter under internal names, so a script written to find them can still write files: this guards against accidents and careless prompts, not against a determined user. The sta process runs with the user's permissions.

  9. Every argument is quoted. Bus bits like reg_next_pc[31] would otherwise be read as a command substitution; OpenSTA itself is deprecating unquoted bus names (ChangeLog 2026-09-24).

  10. stdout is for JSON-RPC only. Server logs go to stderr and a file.

  11. Errors carry a fix hint when the cause is Tcl, not OpenSTA. An unquoted reg_next_pc[31]$_SDFFE_PN0P_/D fails as invalid command name "31"; the error says to use braces.

Checking the tool before trusting the design

opensta-mcp-probe --liberty LIB.lib --verilog design.v --top TOP --sdc c.sdc --spef d.spef --json probe.json

prints whether this OpenSTA supports -format json, whether output is buffered when piped, which stream warnings use, and how long each load step takes. These answers decide the output format and the stderr handling for your version.

Tests

pip install -e ".[dev]"
pytest                                  # uses tests/fake_sta.py, no OpenSTA needed
OPENSTA_MCP_INTEGRATION=1 STA_BIN=sta pytest   # also runs the real-sta round trip

Status and limits

Built for a talk on agent-driven timing analysis (September 2026).

  • Tested: OpenSTA 3.1.0 (the sta built by OpenROAD-flow-scripts) on Linux / WSL2, Python 3.12, MCP Python SDK 1.x.

  • Not a security boundary against a determined user: the sandbox stops accidents and careless prompts; the sta process itself runs as you and can read what you can read.

  • MCP SDK: pinned to mcp<2. SDK 2.x renamed FastMCP to MCPServer; migration is planned.

  • OpenSTA versions: 3.x. Older releases call -group_path_count -group_count, so report_timing fails there (use run_tcl).

  • macOS: should work but is untested. Stall detection reads /proc; without it the server never declares a stall and reports the process state as unknown.

  • Windows: run the server in WSL (see Install).

  • OpenSTA bug worked around: report_power -highest_power_instances N fails in OpenSTA 3.1.0 (and on master as of 2026-09-24) because power/Power.tcl calls a proc highest_power_instances that does not exist. report_power(top_instances=N) checks for that proc and, when it is missing, calls the underlying sta::report_power_highest_insts directly.

License

MIT

Available Tools

9 tools
find_commandsA

Names of the OpenSTA commands matching a glob pattern (e.g. "power", "report_*"). Use this when you do not know a command's name or run_tcl answered "invalid command name". Returns names only; read a command's description and options with run_tcl "help ".

Inputs: pattern. Returns: result

get_conditionsA

The analysis conditions behind a result: the Liberty, netlist, SDC and SPEF files (full paths), every constraint change made through run_tcl since, the switching-activity source and the scenes. Analysis results end with "[conditions #n]"; pass that n as state to see the conditions they were computed under, or 0 for the current state. Answers from the session journal, so earlier states can be read even after sta died.

Inputs: state. Returns: result

get_statusA

What the OpenSTA session is doing. Safe to call at any time, including while another tool is waiting: shows the running command and its elapsed time, whether sta is computing or idle, the loaded design and its state number, constraint changes made through run_tcl, and the session log directory.

Inputs: no named parameters. Returns: result

get_summaryA

Timing and size summary as numbers: worst setup/hold slack, TNS, WNS, minimum clock period and fmax per clock, design-rule violation counts, cell and net counts.

Inputs: no named parameters. Returns: result

load_designA

Load a design into the OpenSTA session. Call this once before any analysis.

liberty: Liberty (.lib) file path, or a list of paths verilog: gate-level netlist (.v) path top: top module name to link sdc: SDC constraints file (optional but required for meaningful timing) spef: parasitics file (optional; without it delays use wire-load / no parasitics)

Returns per-step timings and a digest of warnings. Warnings raised here (unmatched SPEF nets, missing cells, unconstrained ports) affect every later result, so read them. Starts a new analysis state (see get_conditions). Loads on top of the running sta: to drop earlier constraints and run_tcl changes, call restart_session first.

Inputs: top (required), liberty (required), verilog (required), sdc, +1 more. Returns: result

report_powerB

Report power by group (sequential, combinational, clock, macro, pad) and component (internal, switching, leakage), in watts.

top_instances: also list this many highest-power instances (0 = none) format: "text" table or "json" (the instance list is always text)

The result states where switching activity came from: a VCD/SAIF read through run_tcl, or OpenSTA's default activity (then values are estimates).

Inputs: format, top_instances. Returns: result

report_timingA

Report timing paths (OpenSTA report_checks).

path_delay: "max" = setup paths, "min" = hold paths path_count: paths per path group (-group_path_count) scope: "reg2reg" = register to register only, "in2reg" = from input ports, "reg2out" = to output ports, "all" = no restriction from_pin / to_pin: restrict to a start or end point (pin, port or instance name; bus bits like reg_next_pc[31] are fine, they are quoted for you) fields: include input-pin rows (separates wire from cell delay) and slew, capacitance, fanout and net columns format: "end" and "summary" are one line per path; "json" only if this OpenSTA supports it (check with run_tcl "help report_checks") timeout_s: 0 = wait as long as it takes (a stalled sta is still detected)

Inputs: scope, fields, format, to_pin, +4 more. Returns: result

restart_sessionA

Stop the sta process and start a fresh one. The loaded design and any constraint changes are lost; call load_design again. Use this after get_status reports sta as exited, stalled, or holding an unfinished command.

Inputs: no named parameters. Returns: result

run_tclA

Run any OpenSTA Tcl command(s) in the live session.

Rules:

  • OpenSTA syntax. Unsure of a command name? Use find_commands. Unsure of its options? Run help <command> here first.

  • Wrap bus bit names in braces: -to {reg_next_pc[31]}.

  • exec, exit, socket, source, cd and load are disabled. Files (reports via > file, write_* commands) can be written only under the session directory shown by get_status.

  • State changes made here (read_*, set_*, create_*, ...) stay in effect, start a new analysis state and are listed by get_conditions.

  • The script's Tcl return value is returned too, so puts is not needed.

  • Long output is truncated; narrow the query instead of asking for everything. timeout_s: 0 = no limit. sta is never restarted automatically.

Inputs: command (required), timeout_s. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes: load_design loads, report_timing/report_power produce specific reports, restart_session resets, etc. However, run_tcl is a general escape hatch that overlaps functionally with report_timing and report_power, and get_status vs get_conditions both report session state, creating some potential for misselection. Descriptions mitigate this well.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (get_summary, load_design, report_timing, run_tcl, find_commands, get_status, get_conditions, restart_session). There are no deviations in casing or style.

    Tool Count5/5

    Nine tools is a well-scoped set for an STA server. Each tool covers a distinct operation (load, report, inspect, reset, discover) and there is no redundant tool that could be removed without losing functionality.

    Completeness5/5

    The surface covers the full lifecycle: loading a design, querying conditions/status, producing timing and power reports, discovering commands, running arbitrary Tcl, and restarting. Missing specialized reports (e.g., area, clocks) can be accessed via run_tcl, so there are no dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables starting and managing named independent PTY sessions for Synopsys Fusion Compiler, sending arbitrary Tcl commands, and listing/interrupting sessions via MCP.
      -
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Manages a persistent Fusion Compiler session via PTY, enabling Tcl command execution and common EDA queries through an MCP interface.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI clients to directly launch, control, and analyze AMD/Xilinx Vivado on Windows and Linux, supporting project management, synthesis, implementation, bitstream generation, timing/resource analysis, and simulation through a persistent Tcl session.
      50 PyPI
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents such as Claude Code, Cursor, and Codex to safely drive a locally installed Xilinx Vivado through 32 curated tools covering sessions, synthesis, implementation, timing, CDC, XDC, IP, waveforms, and device programming. Provides structured timing evidence with baseline comparison, offline VCD queries, Chinese diagnostics for critical warnings, and GUI/Tcl/attach session modes.
      -