AI-Driven HFSS Simulation: Codex Automates AEDT Modeling and Solving via MCP

AI Agents automate HFSS simulation end-to-end via MCP bridge to Ansys AEDT.
This article demonstrates how AI Agents like Codex and Claude Code can directly control Ansys HFSS through a custom AEDT MCP bridge tool, automating the entire electromagnetic simulation workflow — from geometric modeling and material assignment to solving and post-processing. Using a Wilkinson power divider as a practical example, it covers environment setup, prompt engineering strategies, and the complete automated execution process.
From Manual Operations to AI-Automated Simulation
The traditional HFSS electromagnetic simulation workflow is tedious and time-consuming — creating projects, building geometric models, defining materials, setting up ports and boundary conditions, configuring air boxes, specifying solution frequencies… every step requires manual effort from the engineer. For a classic microwave device like the Wilkinson power divider, the entire process typically involves at least seven critical steps.
HFSS (High Frequency Structure Simulator) is Ansys's flagship 3D full-wave electromagnetic field simulation software, widely used in RF/microwave devices, antennas, high-speed interconnects, EMC/EMI, and more. Based on the Finite Element Method (FEM) for solving Maxwell's equations, it can accurately compute electromagnetic field distributions, S-parameters, far-field radiation patterns, and other key metrics in complex 3D structures. HFSS's adaptive mesh refinement technology is one of its core competitive advantages — the software automatically refines the mesh in regions with steep field gradients until the solution converges to the user-specified accuracy threshold. This capability allows engineers to obtain reliable results without manually adjusting the mesh, but it also means each simulation carries significant computational cost — a moderately complex model on a modern workstation may require anywhere from tens of minutes to several hours to solve.
But what if all of this could be accomplished automatically by an AI Agent using natural language instructions?
This article provides a detailed guide on how to use AI Agents like Codex or Claude Code, combined with a custom-developed AEDT MCP (Model Context Protocol) bridge tool, to directly connect to Ansys Electronics Desktop (AEDT) and achieve end-to-end automation from modeling and solving to post-processing. The final outputs include S-parameter plots, electric field contour maps, and surface current distribution maps — all completed autonomously by the AI.

Core Concept: Not Just Generating Scripts, But Actually Executing Them
Traditional Script Generation vs. AI-Driven Execution
This approach is fundamentally different from the common practice of "having AI write a script and then manually executing it." In the traditional approach, you might ask ChatGPT to generate an IronPython script, then copy it into AEDT's script editor to run. But this method has obvious limitations: the script may contain syntax errors, API call mismatches, or lack awareness of the current project state, and errors still require manual troubleshooting.
The AI-driven approach is entirely different. Through the MCP protocol, Codex or Claude Code can:
- Directly read the current AEDT runtime status, project information, and design content
- Call AEDT APIs in real time to execute modeling, simulation, and other operations
- Automatically handle errors — when a step fails, the AI can detect the error message and self-correct
- Export results and provide summary analysis
This means the AI is no longer just a "code generator" but a true "simulation executor."
Codex is OpenAI's cloud-based AI coding agent capable of autonomously executing multi-step programming tasks in a sandbox environment, with support for reading repository code, running commands, and invoking MCP tools. Claude Code is Anthropic's command-line AI coding tool that runs directly in the developer's terminal, with file read/write, command execution, and MCP tool invocation capabilities. Both share a key feature: support for an "agentic loop" — rather than generating all code at once, the AI operates in an iterative "think → act → observe → think again" mode, adjusting its strategy at each step based on the results of the previous one. This capability is critical for simulation automation, as the simulation process frequently encounters issues like failed Boolean operations on geometry, incorrect port definitions, or mesh generation anomalies. An AI Agent can detect these errors in real time and self-correct, rather than halting at the first error like a traditional script.
The Critical Role of the AEDT MCP Bridge Tool
MCP (Model Context Protocol) is a standard protocol for connecting AI Agents with external tools. The author-developed AEDT MCP serves as a bridge between Codex/Claude Code and Ansys Electronics Desktop, wrapping AEDT's various operations as MCP tool calls so that the AI Agent can operate HFSS simulation software as naturally as manipulating local files.
From a technical architecture perspective, MCP is an open standard protocol introduced by Anthropic in late 2024, designed to establish a unified communication interface between AI models and external data sources and tools. The MCP architecture involves three core roles: Host (the host application, such as Claude Desktop or Codex), Client (the protocol client responsible for maintaining a one-to-one connection with the Server), and Server (the server side that exposes specific tool capabilities and resources). MCP uses JSON-RPC 2.0 as its message format and supports two transport methods: stdio and HTTP+SSE. In this article's scenario, the AEDT MCP Server wraps Ansys AEDT's Python API (PyAEDT) as standard MCP tool calls, with each tool corresponding to a specific simulation operation (such as creating geometry, setting materials, running solvers, etc.). The AI Agent sends tool call requests to the Server via the MCP Client, the Server executes the corresponding AEDT operations locally and returns results, forming a closed-loop interaction cycle.

Environment Setup: Three Steps to Connect AI with AEDT
Step 1: Prepare the Software Environment
The required software environment includes:
- Ansys Electronics Desktop (the video demonstrates version 2026 R1), with the HFSS module available
- AI Agent client: Codex, Claude Code, or any other AI orchestration tool that supports the MCP protocol
- AEDT MCP project: Obtained from the author's GitHub repository, located at
MCP folder → ANSYS → AEDT MCP
Step 2: Install the AEDT MCP Service
The installation process is straightforward — copy the AEDT MCP repository URL into a preset installation prompt and send it directly to Codex or Claude Code. The AI will automatically complete the installation and configuration. A client restart is required after installation.
After restarting, you can verify successful installation in two places:
- In the Codex/Claude Code settings → MCP server list, you should see the "ANSYS AEDT" server
- In AEDT's Automation module, a "Start AEDT MCP Bridge" button will appear
Step 3: Connectivity Test
After clicking the "Start AEDT MCP Bridge" button in AEDT to launch the bridge service, send a test command in Codex. The AI will automatically perform the following verification steps:
- Query the current AEDT process status
- Probe the MCP Bridge port connectivity
- Read the current project and design information via the MCP protocol

When the AI returns "AEDT MCP is currently available and can read the running AEDT project and design," the connection has been successfully established. At this point, Codex has the ability to directly control AEDT.
Hands-On Demo: AI Automatically Simulates a Wilkinson Power Divider
Wilkinson Power Divider: A Classic Microwave Engineering Device
Before diving into the simulation workflow, it's worth understanding the technical background of the Wilkinson power divider. The Wilkinson Power Divider is one of the most classic passive devices in microwave engineering, proposed by Ernest Wilkinson in 1960. Its core design principle leverages the impedance transformation properties of quarter-wavelength (λ/4) transmission lines to split an input signal equally in amplitude and phase to two output ports. Under ideal conditions, it achieves simultaneous matching at all three ports, complete isolation between output ports, and a theoretical insertion loss of only 3 dB (i.e., equal power splitting). Key design parameters include: the characteristic impedance of the quarter-wavelength transmission line is √2×Z₀ (where Z₀ is typically 50Ω, yielding approximately 70.7Ω), and the isolation resistor connecting the two output ports has a value of 2×Z₀ (i.e., 100Ω). This isolation resistor is what distinguishes the Wilkinson power divider from a simple T-junction — it absorbs the differential-mode signal energy between the output ports, achieving port isolation without affecting the transmission of common-mode (equal amplitude, in-phase) signals.
Prompt Engineering: Precisely Defining the Simulation Task
When sending the simulation task to the AI, the structural design of the prompt is crucial. The author employed a layered prompt architecture:
- Role definition: Tell the AI it is an AEDT automation simulation engineer, already connected to the local AEDT via MCP
- Task nature: Explicitly require "not providing a plan, but actually invoking MCP to complete modeling, simulation, post-processing, screenshots, and project saving"
- Design objective: Create a 1-to-2 equal-split Wilkinson power divider at the 3 GHz band
- Core requirements: Include specific technical specifications such as material parameter definitions, geometric parameter variables, and simulation settings

Applying prompt engineering to the CAE simulation domain differs significantly from general text generation or code writing. Simulation prompts must contain sufficient physical constraint information; otherwise, the AI may generate models that are geometrically correct but physically unreasonable. For example, microstrip line width must match the substrate's dielectric constant and thickness to achieve the target characteristic impedance; the air box must be large enough to avoid boundary truncation effects but not so large as to waste computational resources. The advantage of the layered prompt architecture is: the role definition layer ensures the AI thinks like an engineer rather than purely in code; the task nature layer prevents the AI from degenerating into merely outputting suggestions without executing operations; the design objective layer provides hard constraints on physical parameters; and the core requirements layer defines completeness standards for the simulation workflow. This structured prompt design essentially encodes the engineer's domain knowledge into an instruction format that the AI can understand.
The Complete HFSS Automation Process
After the prompt was sent, Codex automatically completed all of the following steps via AEDT MCP:
- Creating the HFSS project: Creating a new project and HFSS design in AEDT
- Geometric modeling: Automatically creating the microstrip line structure based on the Wilkinson power divider's design parameters, including the input port, two output ports, and the isolation resistor
- Material assignment: Assigning correct material properties to the substrate, conductors, and resistor respectively
- Port and boundary setup: Automatically creating wave ports and radiation boundary conditions
- Air box configuration: Automatically generating an appropriate simulation domain based on model dimensions
- Solution setup: Configuring the frequency sweep range and solution accuracy
- Post-processing and export: Generating S-parameter curves, electric field contour maps, and surface current distribution maps
S-parameters (Scattering Parameters) are the core metrics for characterizing multi-port networks in microwave engineering. For a three-port device like the Wilkinson power divider, the key S-parameters include: S11 (input port reflection coefficient, measuring input matching quality), S21 and S31 (transmission coefficients from input to the two outputs, with an ideal value of -3 dB), S22 and S33 (output port reflection coefficients), and S23 (isolation between the two output ports). In HFSS, S-parameters are excited and extracted by defining Wave Ports or Lumped Ports at the ports. Electric field contour maps and surface current distribution maps are visual representations of field distributions — electric field maps show the spatial distribution of electromagnetic energy within the device, helping engineers identify field concentration areas and potential radiation leakage; surface current maps intuitively display the current flow direction and intensity distribution on conductor surfaces, providing valuable reference for understanding device operating mechanisms and optimizing layouts.
The final result in AEDT is a complete simulation project file with a clean and well-structured model, simulation results containing complete S-parameter curves (S11, S21, S31, etc.), and intuitive field distribution contour maps.
Technical Value and Future Prospects
Efficiency Improvement Analysis
For an experienced HFSS engineer, manually completing the modeling and simulation of a Wilkinson power divider takes approximately 30–60 minutes. With the AI-driven approach, the entire process from sending the prompt to obtaining complete results is dramatically shortened, with no manual intervention required.
More importantly, this approach lowers the barrier to entry for HFSS simulation. Even engineers unfamiliar with the AEDT interface can obtain professional-grade simulation results simply by describing their simulation requirements in natural language.
Extensible Simulation Scenarios
This MCP bridge solution is not limited to the Wilkinson power divider — it can theoretically be extended to any electromagnetic simulation scenario supported by HFSS, including antenna design, filter design, coupler simulation, transmission line analysis, and more. The key factors are the quality of prompt design and the coverage of MCP tools.
Current Limitations and Considerations
There are some limitations to be aware of with this approach:
- Geometric modeling of complex models may require more refined prompt engineering
- The AI's ability to judge simulation convergence remains to be validated
- A full local installation of AEDT software is required, which imposes certain hardware requirements
Conclusion
By connecting AI Agents directly to Ansys HFSS through AEDT MCP, we've achieved a qualitative leap from "AI helping write scripts" to "AI directly executing simulations." This is not just a technical demonstration — it represents an important direction for AI integration in the CAE simulation field: making AI a "digital colleague" for engineers, not merely a simple "code assistant."
Readers interested in this project can visit the author's GitHub page to access the complete AEDT MCP source code and documentation, or obtain the full simulation prompt templates from their Obsidian repository.
Related articles

Dual-Layer Knowledge Graphs: How AI Safeguards Continuity in 500,000-Word Novels
CanonPulse AI uses dual-layer knowledge graphs to detect plot holes across 500,000-word novels while protecting intentional twists, solving narrative debt for serial fiction creators.

Dual-Layer Knowledge Graphs: How AI Safeguards Continuity in 500,000-Word Novels
CanonPulse AI uses a dual-layer knowledge graph to detect plot holes across 500K+ word novels while protecting intentional twists — shifting AI writing tools from generation to consistency maintenance.

The Era of AI Capability Overhang: Why You Need to Reset Your Ambition Every 3 Months
Understanding Capability Overhang in the AI era: when model capabilities far exceed application imagination, how teams should reset feasibility boundaries quarterly to avoid ceding advantages to competitors.