rf-agent
Provides electromagnetic simulation and optimization of RF passive designs using Ansys HFSS, including S-parameter extraction, DRC gating, and full-fidelity verification for layouts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rf-agent Design a 1:2 Wilkinson divider at 5.8 GHz with at least 25 dB return loss."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
rf-agent
A closed loop for RF passive design: a requirement in words → a parametric layout → HFSS → Optuna → an EM-verified board in Altium, driven by an LLM over MCP.
requirement ──▶ RFSpec ──▶ parametric layout ──▶ HFSS (PyAEDT)
▲ │ │
│ │ DRC gate │ S-parameters
│ ▼ ▼
└──────── Optuna ◀──────────── metrics + objective
│
▼
verify at full fidelity ──▶ DXF + Altium + reportIt is the physics half of a pair. eda-agent
owns the board a human has open in Altium — ~400 tools for schematic,
PCB, library and design-agent work. rf-agent owns what eda-agent
cannot know: what the copper should be. Run both and an agent has the
whole path.
Status: working, narrow. The loop runs end to end and the EM model is correlated against a real X-band design. One device family (Wilkinson dividers, 1:2 and 1:4) and one cross-section (grounded coplanar waveguide over a single ground) are implemented. Everything else is scaffolding waiting for a second device.
See it work first
examples/wilkinson_11g6/ is a complete
recorded run — an 11.6 GHz 1:2 divider taken from one sentence of
requirement to an EM-verified board, with all 30 HFSS solves, the trial
history, the S-parameters, the DXF and the generated report committed.
What it achieved. The textbook starting point fails: −17.07 dB return loss against a −20 dB requirement, with the match sitting 1.1 GHz above where it was asked for. Thirty trials and 24 minutes of solver time later:
analytic seed | after the loop | requirement | |
worst in-band S11 | −17.07 dB ✗ | −22.72 dB ✓ | ≤ −20 |
match centred at | 12.69 GHz | 11.83 GHz | 11.6 |
isolation | −20.04 dB | −18.43 dB ✓ | ≤ −18 |
amplitude imbalance | 0.02 dB | 0.03 dB ✓ | ≤ 0.3 |
phase imbalance | 0.12° | 0.05° ✓ | ≤ 3.0 |
A working X-band divider that meets every requirement, from one sentence of English, with nothing drawn by hand and nobody watching. Return loss improved 4.2 dB, the match moved 860 MHz onto centre, and the balance metrics came in 30× and 50× inside their limits.
The winner was then written into a live Altium session over the eda-agent bridge and read back to check it: 87 tracks, 41 vias, both pours, every net assignment and zero unrouted connections all match the plan. Doing that for real is what caught two bugs a dry run cannot — a net list joined with the wrong delimiter, and a missing ground plane. Screenshot and the plan-vs-actual record are committed.
The example is also worth reading for what it doesn't do: isolation clears by 0.44 dB and only after the widths round onto Altium's placement grid, and the report says so in those words instead of banking the pass. The written board carries no pads or footprints either — it is a routed RF structure, not yet a fabricable PcbDoc. That is the behaviour to check before trusting any of this on a real board.
Stage 1 of that example needs no Ansys licence and no Altium:
uv run python examples/wilkinson_11g6/01_synthesize.pyRelated MCP server: ansys-aedt-mcp
What it actually does
Synthesises, rather than templating. Trace widths come from a conformal-mapping grounded-CPW model, quarter-wave lengths from the effective permittivity that model returns, via pitch from λg/12 in the substrate. Change the laminate or the frequency and every dimension moves. Nothing is a constant carried over from one previous design.
The line model is anchored: on RO4350B 0.254 mm with a 0.25 mm gap it
returns 49.99 Ω at the HFSS-tuned width of 0.524 mm and 70.75 Ω at
0.275 mm — the two drawn widths of an X-band GCPW divider that was
tuned in HFSS and built. tests/test_lines.py holds that as a regression.
Rejects the unbuildable before it costs a solve. Every candidate is checked against the fab rules — trace and gap minima, annular ring, via clearance to signal copper, board-edge keepout — and a failure is scored from its violations rather than sent to HFSS. On a loop where one sample is a minute, that is most of the budget.
Seeds the optimiser with the textbook answer. Optuna trial 0 is always the analytic design, so TPE starts from a real gradient instead of a random corner. The seed is deliberately placed above the ideal quarter wave: a drawn Wilkinson arm always runs long, because the tee and the bends add electrical length the closed-form model cannot see. On the reference design that was about 19%.
Explores cheap, reports honest. The study runs a draft mesh and a short sweep. The winner is re-solved at full fidelity before anything is reported. And because Altium's PCB command surface is integer mils (1 mil = 25.4 µm), if rounding the trace widths onto that grid moves an impedance, the snapped geometry is solved again — so the report states what the board will do, not what the optimiser found.
Writes design intent, not polygons. The Altium export sends centrelines as tracks with their real widths, ground vias as vias, and the coplanar ground as a polygon pour plus a clearance rule sized to the gap the EM model used. Altium regenerates the copper from that, so the result is net-aware, routable and DRC-clean.
Install
Needs Python 3.11+, and Ansys Electronics Desktop for anything that solves.
uv sync --extra plotOptional, for the Altium half: have eda-agent importable (pip install -e path/to/eda-agent, or set RF_AGENT_EDA_AGENT to its checkout).
Check the machine:
uv run rf-agent doctorUse it from the command line
uv run rf-agent line --laminate RO4350B-0.254 --f0 11.6 --z0 70.711uv run rf-agent synth --f0 11.6 --n-way 2uv run rf-agent design --f0 11.6 --n-way 2 --trials 40design runs the whole loop and writes a run directory: spec.json,
layout.png, sparams.png, the touchstone, the DXF, the HFSS project,
report.md and result.json.
Use it from an agent
Register the MCP server:
claude mcp add rf-agent -- uv --directory C:/path/to/rf-agent run rf-agent serveTools:
tool | what it is for |
| is HFSS reachable, is the Altium bridge live |
| impedance ↔ width, λg, loss, via pitch |
| requirement → structured spec |
| draw a candidate, DRC it, render it — no solve |
| one candidate through HFSS, scored |
| start a study; returns a job id |
| the whole loop; returns a job id |
| poll the long stages |
| why the bridge is not ready, specifically |
| commit a design into the open PCB |
The long stages return a job id rather than blocking — an MCP call that takes an hour is not usable by an agent.
skills/rfdesign/SKILL.md is the companion skill: how to sequence these,
and what not to claim about the results.
The EM model
Correlated against that same built X-band divider, and reproduced by
src/rf_agent/em/hfss.py:
substrate box on the laminate material, PEC via barrels punched through
top copper as zero-thickness sheets with a finite-conductivity boundary carrying the real copper thickness and surface roughness
an air box above the board, outer faces left on HFSS's default PEC boundary — that is the metal housing, and it is why there is no radiation boundary anywhere in the file
isolation resistors as lumped RLC sheets bridging the two lands
wave ports on the board edges, integration line running from the ground plane up to the trace
Ports are sized from the line cross-section and from the spacing between neighbouring ports on the same edge. Two overlapping wave-port sheets assign without complaint and fail during the solve, which is an expensive way to find out.
What this does not model
Stated plainly, because a report that only shows the winning curve is not a report:
Isolation resistors are ideal. A real 0402's parasitic inductance degrades isolation above roughly 10 GHz. An X-band isolation figure from this loop is optimistic.
The enclosure is a perfect box. No lid channels, no absorber unless you configure one, no connector launches.
εr is a single design value. No dispersion, no batch tolerance, no temperature.
Conductor loss is first-order. The analytic attenuation is good to a few tens of percent — enough to rank candidates and sanity-check an HFSS insertion loss, not enough to quote.
One signal layer over one ground. Multilayer, buried structures and differential pairs are not in the stackup model.
A note on the pour
The generator floods the pour interior with stitching vias, not just a fence along the traces. That is not conservatism. On 0.254 mm RO4350B at X band, running ground vias only along the trace edges leaves large un-stitched islands that behave as patch resonators between the top pour and the bottom ground — on the reference divider, a 3.9 dB notch 260 MHz from the design point. Islands too small to hold a via are dropped entirely rather than left floating.
Layout of the code
src/rf_agent/
lines.py closed-form grounded CPW: the analytic seed layer
stackup.py laminates, via policy, fab rules
spec.py RFSpec: the contract between words and geometry
geometry.py Seg/Arc primitives, pour, stitching, DRC
devices/ parametric structures (wilkinson.py)
em/hfss.py PyAEDT model build, solve, content-addressed cache
metrics.py touchstone → worst-case-in-band numbers
objective.py metrics → the scalar Optuna minimises
optimize.py the study
pipeline.py the closed loop
export/ dxf.py (exact) and altium.py (via the eda-agent bridge)
report.py the design report
server.py MCP surface
cli.py the same, from a terminalAdding a device means adding one module under devices/: a parameter
space derived from the spec and a build() that returns a Geometry.
The solver, metrics, optimiser and exporters never learn its topology.
Available Tools
12 toolsrf_altium_preflightA
Is a live Altium session reachable, with a PCB open and ready to write?
Says which of the three things is missing -- eda-agent not importable, Altium not running, or the bridge script not started inside it -- and how to fix that one.
Inputs: no named parameters. Returns: object
rf_designA
Run the whole closed loop: seed, optimise, verify, export, report.
Returns a job id; poll rf_job_status. The winner is re-solved at
full fidelity before anything is reported, and if rounding the trace
widths onto Altium's 1-mil grid shifts an impedance, the snapped
geometry is solved too so the report states what the board will
actually do rather than what the optimiser found.
write_altium=True commits the result into the PCB the user has open,
which needs a live eda-agent bridge -- check rf_doctor first.
Inputs: spec (required), out_dir, n_trials, timeout_s, +2 more. Returns: object
rf_doctorA
Check the RF toolchain on this machine before trusting any result.
Reports the AEDT install PyAEDT will drive, the Python packages the loop needs, and whether a live Altium bridge is reachable. Call this first when anything behaves oddly.
Inputs: no named parameters. Returns: object
rf_export_altiumA
Write a design into the PCB document the user currently has open.
Emits design intent, not EM polygons: centrelines as tracks with their real widths, ground vias as vias, and the coplanar ground as a polygon pour with a clearance rule sized to the gap the EM model used.
dry_run=True (the default) resolves the whole plan to mils and
returns it without touching the board. Look at the quantisation report
before committing -- Altium's PCB command surface is integer mils, and
on a narrow high-impedance arm that rounding moves the impedance.
Inputs: spec (required), params, dry_run, place_pour, +2 more. Returns: object
rf_job_statusC
Progress of a running study or design loop, and its result when done.
Inputs: job_id (required), include_result. Returns: object
rf_line_modelA
Grounded-CPW impedance, effective permittivity and wavelength.
Give width_mm to analyse a line, or z0 to synthesise the width
that hits an impedance. This is the closed-form model the optimiser
seeds from -- it is accurate enough to start from and not accurate
enough to finish on.
Inputs: z0, f0_ghz, gap_mm, laminate, +1 more. Returns: object
rf_list_devicesD
The parametric structures this server can synthesise and optimise.
Inputs: no named parameters. Returns: object
rf_list_jobsB
Every job this server has run in this session.
Inputs: no named parameters. Returns: object
rf_make_specA
Turn a requirement into the structured spec everything else reads.
Limits are stated the way a datasheet states them: s11_db=-20 means
S11 at or below -20 dB across the band, isolation_db=-18 means the
coupling between any two outputs stays at or below -18 dB. Keep
requirement_text -- it goes in the report so the design can be
traced back to the sentence that asked for it.
Inputs: f0_ghz (required), name, n_way, gap_mm, +8 more. Returns: object
rf_optimizeA
Start an Optuna study over the device's parameters, scored by HFSS.
Returns a job id immediately; poll rf_job_status. Trial 0 is always
the analytic seed. Exploration runs at draft mesh; call rf_design
instead if you want the winner verified, exported and reported in one
go.
Inputs: spec (required), seed, n_trials, timeout_s. Returns: object
rf_solveA
Solve one candidate in HFSS and score it against the spec.
Blocking, and a full-fidelity solve on a small divider is minutes.
Use draft=True for a fast, coarser answer. Results are cached by
geometry content, so re-solving the same candidate is free.
Inputs: spec (required), draft, params. Returns: object
rf_synthesizeA
Draw a candidate layout without solving it.
With no params this returns the analytic seed -- the textbook
starting point the optimiser begins from. Always cheap; use it to
sanity-check dimensions, DRC and board size before committing solver
time. The PNG is worth looking at.
Inputs: spec (required), params, render, out_dir. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct stage (spec, analytic model, candidate layout, solve, optimize, export) and the descriptions explicitly differentiate the high-level rf_design from rf_optimize and rf_doctor from rf_altium_preflight. Minor overlap exists between rf_line_model and rf_synthesize's analytic seed, and between the two environment-check tools, but the descriptions are clear enough to avoid serious misselection.
All tools share the rf_ prefix and snake_case verb_noun style (list_devices, make_spec, export_altium), making the surface easy to scan. A few names are noun-heavy or verbless — rf_doctor, rf_line_model, rf_job_status, rf_design — which slightly breaks the otherwise consistent pattern.
Twelve tools is well-scoped for an RF design-and-optimization workflow: preflight checks, spec creation, modeling, synthesis, solving, optimization, job tracking, and Altium export each have a dedicated entry point. No tool feels redundant, and the count is manageable.
The surface covers the full design loop: health checks, device discovery, spec capture, analytic modeling, candidate generation, full-fidelity solving, optimization, asynchronous job status, and Altium export with a dry-run safety path. There are no obvious dead ends or missing lifecycle steps for the stated RF synthesis and export purpose.
Maintenance
Related MCP Connectors
Autonomous 0-DRC PCB Routing, RF/DFM Pre-Flight & KiCad MCP Server (calligraphyeda.com).
Design circuits, simulate and verify embedded firmware, and lay out PCBs with AI agents.
Design, route, check, review and export manufacturable PCBs from plain language; KiCad import.
RF module design for AI assistants: transmit chains, receivers, link budgets, PCB stackups, thermal and compliance, every figure computed by a solver from real catalog parts, never guessed. Free, no sign-in.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceEnables quantum circuit design and electromagnetic simulation optimization through Qiskit Metal and Octave/OpenEMS. Provides 25+ specialized tools across two integrated MCP servers for designing transmon qubits, analyzing CPW transmission lines, and automating parameter optimization workflows.3-
- AlicenseCqualityNot gradedmaintenanceEnables AI agents to control Ansys Electronics Desktop (HFSS, Maxwell, Q3D, etc.) using MCP tools for simulation automation.10064PolyForm Noncommercial 1.0.0
- FlicenseNot gradedqualityDmaintenanceMCP server for automating ANSYS HFSS simulations, enabling persistent connections, modeling, simulation setup, and S-parameter extraction through AI assistants.1-
- AlicenseCqualityCmaintenanceEnables engineers to convert antenna papers/diagrams and natural language specs into auditable, versionable HFSS Python modeling code, with optional simulation and parametric optimization.22MIT