内容
CP服务器
**用于ExtendSim的AI驱动仿真建模**
一个MCP(模型上下文协议)服务器,使AI助手能够构建、配置、运行和分析 [ExtendSim](https://extendsim.com) 仿真模型。与Claude Code、Claude Desktop、Gemini CLI、Cursor和ChatGPT等配合使用。
> **注意:** 这是由Duke Systems AB开发第三方工具。它与Imagine That, Inc.(ANDRITZ Inc.的子公司),即ExtendSim的制造商无关,也未得到其认可。
## 概述
```
AI 客户端(Claude, Gemini, Cursor, ChatGPT)
│
│ MCP 协议(JSON-RPC 2.0)
▼
TypeScript MCP 服务器(99 种工具)
│
│ JSON 通过 stdin/stdout
▼
Python COM 后端(32)
│
│/DCOM
▼
ExtendSim 应用程序
```
服务器暴露了 **99 种工具**,涵盖 17 个类别:
| 类别 | 工具 |
|----------|-------|
| 模型管理 | `model_open`, `model_save`, `model_new`, `model_close`, `model_info`, `model_validate`, `model_extract`, `model_overview`, `model_snapshot`, `model_list` |
| 模块操作 | `block_add`, `block_add_batch`, `block_connect`, `block_disconnect`, `connect_chain`, `connect_graph`, `block_remove`, `block_list`, `connection_list`, `block_info`, `block_discover`, `block_discover_variables` |
| | `block_move`, `block_get_position`, `block_align`, `block_duplicate`, `block_find` |
| 配置 | `block_configure`, `block_set_value`, `block_get_value`, `execute_command`, `attribute_set`, `attribute_get` |
| 仿真 | `simulation_run`, `simulation_stop`, `simulation_pause`, `simulation_resume`, `simulation_status`, `simulation_get_results`, `simulation_setup_get`, `simulation_setup_set`, `simulation_step`, `simulation_get_state` |
| 统计 | `block_get_stats`, `simulation_get_block_stats`, `resource_pool_get_stats` |
| 多次运行 | `simulation_run_multi`, `simulation_run_scenarios`, `scenario_manager_run`, `scenario_manager `scenario_manager_get_results`, ``, `optimizer_get |
| 数据库 | `db `db_table_info`, `_value`, `db_set_value`, `db_get_records`, `db_add_records`, `db_delete_records`, `db_create`, `db_import`, `db_export`, `db_find_record`, `db_sort`, `db_relations_list`, `db_relation_create` |
| 全局数组 | `ga_list`, `ga_create`, `ga_read`, `ga_write| 层次结构 | `hierarchy_list`, `hierarchy_get_contents` |
| AI 辅助 | `MCP_init`, `modeling_guide`, `pattern_search`, `model_advisor`, `simulation_type_guide` |
| 参考 | `modl_search`, `block_search`, `dialog_search`, `template_list`, `block_template` 模板 | `text_block_add` |
| 时间/日期 | `time_convert` |
| 上下文 | `context_set`, `context_get`, `context_clear` |
| 状态 | `extendsim_status`, `extendsim_start`, `extendsim_get_license` |
| 遥测 | `telemetry_control` |
## 需求
- **Windows 10/11**(64 位)
- **Node.js** 18+
- **Python 3.x**,使用 pywin32:`pip install pywin32`
- **ExtendSim** 已安装并注册 COM 组件
## 快速入门
### 从源码安装
```bash
cd src/ExtendSimMCP.TypeScript
npm install
npm run build
```
### 从安装程序安装
从 `installer/` 目录下载 `SimulationsMCP-Setup-1.19.2.exe` 并运行它。
> **注意:** 预编译的安装程序(`1.19.2`)早于最新的工具。对于当前的 **1.20.0** 服务器(99 种工具,包括 `table_get`/`table_set`/`detect_attributes`),请从源代码(上面)安装,直到重新编译安装程序。
### 配置 AI 客户端
在您的 MCP 配置文件(例如,Claude Code 的 `.mcp.json`)中添加:
```json
{
"mcpServers": {
"SimulationsMCP": {
"command": "node",
"args": ["C:/Program Files/SimulationsMCP/dist/index.js"]
}
}
}
```
对于其他客户端(Claude Desktop、Gemini CLI、Cursor、ChatGPT),请参阅 [用户手册](docs/USER_MANUAL.md)。
### 首次会话
1. 启动 ExtendSim
2. 打开您的 AI 客户端
3. 运行 `MCP_init` 以获取规则和指导
4. 使用 `modeling_guide` 或 `pattern_search` 找到合适的方法
5. 构建、配置、运行和分析您的仿真
## 传输模式
| 模式 | 用例 | 设置 |
|------|----------|-------|
| **stdio**(默认) | Claude Code、Claude Desktop、Gemini CLI、Cursor | 零配置 — AI 客户端将服务器作为子进程启动 |
| **HTTP** | ChatGPT | 本地主机:3001 上的 Windows 服务,需要 HTTPS 反向代理 |
## 主要功能
- **block_configure** — 单个工具,自动检测模块类型并配置 Activity、Queue、Create、Exit、Select Item、Gate、Tank、Valve 等 25+ 种模块类型
- **即发即忘** — `simulation_run`、`scenario_manager_run` 和 `optimizer_run` 默认启动非阻塞;使用状态工具轮询
- **268 个示例模型** — 通过 `pattern_search` 搜索已验证的模式
- **12 个建模指南** — 队列、制造、物流、资源、流程和连续系统的逐步指导
- **模型顾问** — 模型的自动警告、建议和补全
- **自动对话框关闭** — 在长时间运行操作期间处理 ExtendSim COM 错误对话框
## 文档
- [用户手册](docs/USER_MANUAL.md) — 安装、配置、工具参考、工作流程、故障排除
- [设计文档](docs/DESIGN_DOCUMENT.md) — 架构、安全分析、威胁模型、数据流
## 构建和测试
```bash
cd src/ExtendSimMCP.TypeScript
# 构建
npm run build
# 运行测试(142 个测试,不需要 ExtendSim)
npm test
# 运行实时 COM 测试(需要运行 ExtendSim)
npm run test:live
```
## 安全
- **stdio 模式**:零网络攻击面 — 所有通信通过进程本地管道
- **无凭证存储** — COM 使用 Windows 进程级信任
- **本地仅遥测** — 使用模式记录到磁盘,永不传输
- **输入验证** — 所有工具参数的 Zod 模式,ModL 字符串净化
- **无云依赖** — 所有内容都在您的机器上本地运行
有关完整的安全架构和威胁分析,请参阅 [设计文档](docs/DESIGN_DOCUMENT.md)。
## 许可证
MIT — 请参阅 [LICENSE](LICENSE)
## 作者
Duke Systems AB
---
*使用 [模型上下文协议](https://modelcontextprotocol.io) 构建*
---
**商标声明:** ExtendSim 是 Imagine That, Inc.(ANDRITZ Inc. 的子公司)的注册商标。本项目是独立的第三方集成,与 Imagine That, Inc. 或 ANDRITZ 无关,也未得到其认可或赞助。所有其他商标均为其各自所有者的财产。