Skip to main content
Glama

cst-sim-agent

中文版

一个 Claude Code 插件,通过 MCP 将 CST Studio Suite 变成对话式电磁仿真助手。

AI for Science(AI4S)正把 AI 从"聊天"推向"真正做科研和工程"。

对于电磁仿真,真正的瓶颈在于:智能体(Agent)需要操作 CST 这类专业软件,却无法与它顺畅沟通——即使连接成功,它也不知道正确的 VBA 方法名或适配 CST 的 Python 惯用法。通用大语言模型并没有受过如何在 CST 中操作的训练;直接编写原生代码会臆造出不存在的"幽灵方法",而一个 (10091) 报错就可能浪费几个小时。

cst-sim-agent 用三层设计解决这个问题:MCP 工具集让自然语言直接驱动建模 → 材料赋值 → 端口设置 → 求解 → 结果读取;内嵌领域知识库(8 大领域的 VBA 语法库、158 个官方示例、避坑清单)让智能体能够随查随用——不需要像人类工程师那样重新翻文档、重新学界面操作、甚至在不同应用领域间重新学习物理;约束钩子在编写 VBA 前先查知识库,并在执行后检查 CST 消息窗口,同时防范模型幻觉和静默失败。在端到端验证实践中,这一机制在 2 天内完成了近 20 个多方法仿真项目(建模、方法切换、参数对比)——同样的工作量若使用纯人工流程,往往需要数周。更重要的是,这一机制会随你的使用不断自我进化——你踩过的每一个坑、验证出来的每一条经验,都会在收尾时被引导回知识库,形成“使用 → 沉淀 → 复用”的闭环:用得越多它越聪明,同类任务也越跑越顺手。

我们的愿景是让 AI for Science 真正进入工程师和科研工作者的仿真工作台——不是取代工程师,而是通过物理仿真延伸人类做科学的能力:把繁琐重复的操作和跨领域学习交给智能体,让人类保留电磁设计和物理判断,把工程师真正解放出来。

特性

类别

工具

连接与工程

cst_connect / cst_disconnect / cst_create_project / cst_open_project / cst_save_project / cst_close_project / cst_get_project_state / checkpoint 系列

几何查询

cst_query_geometry / cst_get_model_tree / cst_get_materials

建模图元

cst_create_brick / cst_create_cylinder / cst_create_cone / cst_create_sphere / 布尔运算 / 变换 / 删除

材料

cst_create_material / cst_create_sit_material(SIT 阻抗表)/ cst_set_material

求解器

cst_set_frequency_range / cst_start_solver / cst_is_solver_running / cst_stop_solver / cst_run_simulation / cst_parameter_sweep

SBR/RCS

cst_configure_sbr / cst_run_sbr / cst_farfield_read

VBA/脚本

cst_execute_vba(任意 CST VBA)

操作

cst_get_messages / cst_check_status / cst_detect_popups / cst_dismiss_popup

Related MCP server: CST Studio Orchestrator MCP

成熟度与验证

本插件脱胎于几个 CST 自动化工程项目,经历了内部多轮迭代,并在首次公开发布前通过了独立盲测验收。已验证覆盖范围:安装与钩子、连接真实 CST 实例、官方贴片天线教程端到端、知识库与残留审查。尚未完全覆盖:多版本 CST 兼容、更复杂模型、更多工具组合——这些需要社区开发者共同验证。

端到端官方示例(圆形贴片天线,2–3 GHz)跑通结果:S11 谐振点为 2.40 GHz,与 CST 官方教程参考值(≈2.4 GHz)吻合。详见验证报告

技术选择与设计决策(VBA 通道为主、官方 API 辅助)记录在架构文档中。

前置条件

  • Windows(CST 的 COM 接口依赖 Windows)

  • CST Studio Suite 2024/2025/2026(推荐 2026;旧版可能能工作字段但未逐一验证)

  • Python 3.10+(包括 Windows 自带的 py 启动器——官方 Python 安装时会自带;MCP 服务器通过 py -3 启动,不依赖 PATH 中的 python

  • Python 依赖:执行 pip install -r requirements.txt(包含 mcppywin32

CST 官方 Python 库路径的解析(src/controller.pysrc/connection.py):

  1. 优先读取环境变量 CST_INSTALL_DIR(指向 CST 安装根目录,例如 C:\Program Files\CST Studio Suite 2026

  2. 否则自动检测常见安装位置(C:\Program Files\CST Studio Suite 202x 等)

为了最稳定可靠的路径解析,建议设置 CST_INSTALL_DIR 环境变量。

安装

# Option 1: install from the GitHub marketplace (available after publishing to GitHub)
claude plugin marketplace add https://github.com/<your-name>/cst-sim-agent
claude plugin install cst-sim-agent@cst-sim-agent

# Option 2: install from a local directory (development / offline)
claude plugin marketplace add /path/to/cst-sim-agent
claude plugin install cst-sim-agent@cst-sim-agent

安装完成后重启 Claude Code,并通过 /plugins 确认插件已加载;然后即可在对话中直接调用 cst_* 工具。

插件根目录自带 .claude-plugin/marketplace.json——它本身就是一个 marketplace(source=./)。directory 类型的 marketplace 采用原位加载,无需复制。

钩子机制(按需注入)

插件在 hooks/ 中声明了 4 个钩子;它们仅在会话中实际调用 cst_* 工具时注入提醒:

钩子

触发时机

提醒内容

pre_vba

cst_execute_vba 之前

写 VBA 前先查语法库(按领域嗅探以给出精确提示)

post_vba

cst_execute_vba 之后

检查 CST 消息窗口 + 在写出下一步之前查阅知识库

post_mutate

在修改几何/材料的工具之后

关键操作后立即保存

stop_check

在使用 CST 的会话收尾时

强制将经验沉淀(写入知识库)

所有钩子只提醒、不阻断(不返回 permissionDecision)。

拿成长:越用越聪明

内嵌知识库既是最初的知识,也是积累的容器:

  • 使用:每个仿真项目中,智能体完成建模、求解与结果分析;

  • 沉淀:会话收尾时,stop_check 钩子强制提醒把本次会话的坑与验证过的经验写进 references/(避坑清单、VBA 语法库、经验手册);

  • 复用:下一次再遇到类似问题时,pre_vba / post_vba 钩子引导你直接查库,而不是重犯同一个错误。

这就形成了"使用 → 沉淀 → 复用"的拿成长闭环——插件将持续积累领域经验,同类任务自然越来越顺手。知识库完全掌握在你自己手中(skills/cst-expert/references/),沉淀什么、保留什么,由你全权决定。

技能知识库

随插件内置在 skills/cst-expert/references/

  • vba-rules.md — VBA 四条铁律、代码注释规范、MCP 故障排查

  • official-docs.md — 官方文档地图与查询技巧

  • case-study-flow.md — 官方示例深度学习流程

  • common-pitfalls.md — 通用避坑清单(端口 / 网格 / 求解器 / API 陷阱)

  • best-practices-template.md — 留白经验模板,供你自行追加经验

  • knowledge/ — VBA 语法库(8 大域)、158 个官方示例索引、35 篇深度拆解、经验手册

目录结构

cst-sim-agent/
├── .claude-plugin/plugin.json   # plugin manifest
├── .mcp.json                    # MCP server definition (cst-sim)
├── src/                         # MCP server implementation
│   ├── server.py                # tool registration (FastMCP)
│   ├── controller.py            # unified controller (facade)
│   ├── connection.py            # CST process/project lifecycle
│   ├── dezip.py                 # CST DE-ZIP container parser
│   ├── popup_utils.py           # popup detect/dismiss
│   ├── popup_watchdog.py        # popup watchdog
│   └── version_manager.py       # checkpoint versioning
├── hooks/                       # constraint mechanization hooks
├── skills/cst-expert/           # domain-knowledge skill
└── requirements.txt

常见问题

  • cst_connect 失败 / 工具不出现:先看 Claude CLI 的 MCP 日志(%LOCALAPPDATA%\claude-cli-nodejs\Cache\<workdir-encoded>\mcp-logs-*.jsonl 中的 Server stderr),不要瞎猜。

  • 工具提示找不到 CST:确认已设置 CST_INSTALL_DIR,或 CST 安装在标准位置。

  • .cst 文件打不开.cst 是 CST 专有的 DE-ZIP 容器;Python 的 zipfile 无法打开,请改用 src/dezip.py

  • SBR 结果全为零:先检查几何体材料——从 STEP 导入的几何体默认为散射透明材料;如需散射结果,请先指定为 PEC / 介电材料。

参与贡献

欢迎社区参与验证和优化:提 issue、贡献代码、补充知识库经验。开发与提交规范见 CONTRIBUTING;社区行为准则见 CODE_OF_CONDUCT;安全漏洞提报见 SECURITY;版本历史见 CHANGELOG

许可

Apache License 2.0

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables natural language control of HFSS (v2019-2025) for antenna modeling, simulation, and result extraction via win32com without PyAEDT.
    1
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI agents to control CST Studio Suite for 3D electromagnetic simulation, antenna design, and schematic-based field-circuit co-simulation through 177 MCP tools.
    100
    5
    AGPL 3.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Python-first MCP server for CST Studio Suite (2024–2026) that lets AI assistants drive CST from Windows: open projects, build geometry, set materials and ports, run solvers, read S-parameters and farfield metrics, and generate design reports.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • AI-callable calculators and engineering models with real formulas. No hallucinated math.

  • GibsonAI MCP server: manage your databases with natural language

  • Deterministic reasoning stack for AI agents: simulate, decide & compute, plus cross-domain tools.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/valenZW/cst-sim-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server