AFSIM MCP Server
# AFSIM MCP Server
MCP (Model Context Protocol) server for the **Advanced Framework for Simulation, Integration, and Modeling (AFSIM)**. Enables LLMs and AI agents to interact with AFSIM through standardized tools.
## Features
| Category | Tools |
|---|---|
| **Scenario Management** | `create_scenario`, `load_scenario`, `save_scenario`, `validate_scenario`, `list_scenarios`, `delete_scenario`, `get_scenario_content`, `list_scenario_files` |
| **Entity & Component Management** | `create_platform`, `delete_platform`, `modify_platform`, `list_platforms`, `add_mover`, `add_sensor`, `add_weapon`, `remove_component`, `list_components` |
| **Simulation Control** | `run_simulation`, `stop_simulation`, `get_simulation_status`, `list_simulation_runs`, `set_afsim_binary` |
| **Results Handling** | `list_result_files`, `query_csv_results`, `query_evt_results`, `query_aer_results`, `export_results_to_json`, `get_results_summary` |
| **AFSIM Backend** | `set_afsim_home`, `detect_afsim_installation`, `set_tool_binary_path`, `run_wizard`, `run_mission`, `run_warlock`, `run_mystic` |
| **Natural Language** | `generate_scenario_from_prompt`, `refine_scenario_from_prompt` |
## Installation
```bash
pip install -e .
```
Or install dependencies directly:
```bash
pip install mcp
```
## Usage
### Running the server
```bash
# Via installed CLI
afsim-mcp
# Via Python module
python -m afsim_mcp.server
```
The server uses **stdio transport** and is compatible with any MCP client (Claude Desktop, VS Code MCP extension, etc.).
### Claude Desktop configuration
Add to `claude_desktop_config.json`:
=======
# AFSIM MCP
本项目是一个本地 MCP 服务器,用于把 AFSIM 能力接入支持 MCP 的客户端(如 Cursor、Claude Desktop、VS Code、Trae、OpenCode 等)。
仓库只包含 MCP 服务源码与配置脚本,不附带测试工程、测试数据、示例生成产物或本地运行状态。实际使用时,请把 AFSIM 工程目录通过配置指向你自己的 `project_root`。
如需给大模型或团队成员提供统一项目背景与建模建议,可参考仓库中的 `memory.md`。
如需评估当前项目真实能力边界,可参考 `CAPABILITY_ASSESSMENT.md`;如需约束接入大模型的标准工作流,可参考 `MODEL_WORKFLOW_PROMPT.md`。
## 前置条件
- Windows
- Python 3.10+
- 已安装 AFSIM(本机可运行)
## 快速开始
在项目目录执行:
```bash
python configure_mcp.py
```
脚本会按提示询问并写入本地配置,同时输出客户端所需的 MCP 配置片段。
### 配置项说明
- AFSIM 根目录:AFSIM 安装目录
- AFSIM 项目目录:你的 AFSIM 工程目录
- AFSIM demos 目录:官方示例目录
- AFSIM bin 目录:`mission.exe` 等可执行文件所在目录
- 配置文件存放目录:默认 `C:\Users\你的用户名\.afsim_mcp`
- 运行时状态目录:默认 `project_root\mcp_state`;客户端通常只需要传入 `AFSIM_MCP_CONFIG_DIR` 用于定位配置文件,如需覆盖状态目录可额外设置 `AFSIM_MCP_STATE_DIR`
如果检测到已有配置,脚本会显示旧值;直接回车表示保留旧值。
## 客户端配置
脚本会输出两段内容:
1) 通用连接信息
2) 你选择的平台对应的 JSON 配置示例
```json
{
"mcpServers": {
"afsim": {
"command": "afsim-mcp"
}
}
}
```
Or if not installed:
```json
{
"mcpServers": {
"afsim": {
"command": "python",
"args": ["-m", "afsim_mcp.server"],
"cwd": "/path/to/AFSIM_MCP"
}
}
}
```
TDQS
Scored across 37 tools
Each tool targets a distinct action or resource: scenario, platform, component, simulation, results, or configuration. Even closely related tools like run_simulation, run_warlock, run_mission are clearly differentiated by their specific AFSIM binary and purpose. No two tools overlap in functionality.
All tools follow a verb_noun naming pattern (e.g., create_scenario, list_platforms, run_simulation). Verbs are descriptive and consistent (create, delete, list, get, set, run, query, etc.). Even longer names like export_results_to_json maintain the pattern with additional qualifiers.
With 37 tools, the server is above the typical range but still appropriate for the complex AFSIM domain. Each tool serves a specific need across scenario creation, platform management, simulation execution, and result analysis. The count is high but not excessive given the breadth of functionality.
The tool set covers the full lifecycle: scenario CRUD, platform and component management, simulation execution (multiple binaries), result querying/export, and configuration. There are no critical gaps; all major operations for managing AFSIM simulations are represented.