STK
HTTP-SSE用于STK卫星工具包的MCP服务器
用于STK卫星工具包的MCP服务器
STK-MCP is an MCP (Model Context Protocol) server designed to enable Large Language Models (LLMs) or other MCP clients to interact with Ansys/AGI STK (Systems Tool Kit) - the leading Digital Mission Engineering software.
This project allows controlling STK via an MCP server, supporting both STK Desktop (Windows only) and STK Engine (Windows & Linux). It utilizes FastMCP from the official MCP Python SDK.
The primary goal of this project is to bridge the gap between programmatic interaction and the powerful simulation capabilities of STK. By exposing STK functionalities through a robust CLI and an MCP server, users can command STK simulations using simple commands or LLM-driven applications.
The MCP application, defined in src/stk_mcp/app.py, exposes STK operations as MCP tools, which are dynamically managed by a CLI entry point in src/stk_mcp/cli.py.
Typer.list-tools command enumerates available MCP tools.cli.py), MCP (app.py), STK logic (stk_logic/), and MCP tools (tools/).agi.stk12 Python wheel corresponding to your STK installation must be available. Typically found under CodeSamples\Automation\Python in your STK install.git clone <repository-url> cd stk-mcp
# Create the virtual environment uv venv # Activate it # On Windows (in PowerShell/CMD): # .venv\Scripts\activate # On Linux (in bash/zsh): source .venv/bin/activate
uv add ./agi.stk12-12.10.0-py3-none-any.whl # or: uv add path/to/your/STK/CodeSamples/Automation/Python/agi.stk12-*.whl # Windows only: COM bridge for Desktop automation uv add "pywin32; platform_system == 'Windows'"
pyproject.toml)
uv sync
This project is a command-line application. Ensure your virtual environment is activated before running commands.
uv run -m stk_mcp.cli list-tools
Prints a table of tool names and their descriptions.
Use the run command to start the MCP server. The server will automatically start and manage an STK instance.
Run with uv run so you don’t need to install the package into site-packages.
1) STK Engine (recommended for automation, Windows/Linux):
uv run -m stk_mcp.cli run --mode engine
2) STK Desktop (Windows only, shows GUI): Ensure STK Desktop is closed; the server will launch and manage its own instance.
uv run -m stk_mcp.cli run --mode desktop
The server will start, initialize STK, and listen for MCP connections on http://127.0.0.1:8765 by default.
3. Command Options:
You can see all options with the --help flag:
stk-mcp run --help
Once the server is running, you can connect to it using any MCP client, such as the MCP Inspector.
http://127.0.0.1:8765).setup_scenario, create_location, and create_satellite.Press Ctrl+C in the terminal where the server is running. The lifecycle manager will automatically close the STK Engine or Desktop instance.
The server exposes the following MCP tools/resources.
| Name | Kind | Description | Desktop (Windows) | Engine (Windows) | Engine (Linux) |
|---|---|---|---|---|---|
setup_scenario | Tool | Create/configure an STK Scenario; sets time period and rewinds animation. | Yes | Yes | Yes |
create_location | Tool | Create/update a Facility (default) or Place at latitude/longitude/altitude (km). | Yes | Yes | Yes |
create_satellite | Tool | Create/configure a satellite from apogee/perigee (km), RAAN, and inclination; TwoBody prop. | Yes | Yes | No |
Notes:
create_satellite on Linux Engine is not yet supported because it relies on COM-specific casts; a Connect-based fallback is planned.Resources:
| Name | Kind | Description | Desktop (Windows) | Engine (Windows) | Engine (Linux) |
|---|---|---|---|---|---|
resource://stk/objects | Resource | List all objects in the active scenario. Returns JSON records: {name, type}. | Yes | Yes | Yes |
resource://stk/objects/{type} | Resource | List objects filtered by type (e.g., satellite, facility, place, sensor). Returns JSON records. | Yes | Yes | Yes |
resource://stk/health | Resource | Report basic state: mode, scenario name, and object counts. | Yes | Yes | Yes |
resource://stk/analysis/access/{object1}/{object2} | Resource | Compute access intervals between two objects. Provide paths like Satellite/SatA and Facility/FacB (with or without leading */). | Yes | Yes | Yes |
resource://stk/reports/lla/{satellite} | Resource | Return satellite LLA ephemeris over the scenario start/stop interval. Provide path like Satellite/SatA (with or without leading */). | Yes | Yes | Yes |
Examples:
resource://stk/objectsresource://stk/objects/satelliteresource://stk/objects/location (alias for facilities and places)Access and LLA examples:
resource://stk/analysis/access/Satellite/ISS/Facility/Boulderresource://stk/reports/lla/Satellite/ISS (optional step_sec argument)Configuration is centralized in src/stk_mcp/stk_logic/config.py using pydantic-settings.
Defaults can be overridden with environment variables (prefix STK_MCP_).
STK_MCP_DEFAULT_HOST (default 127.0.0.1)STK_MCP_DEFAULT_PORT (default 8765)STK_MCP_LOG_LEVEL (default INFO)STK_MCP_DEFAULT_SCENARIO_NAME (default MCP_STK_Scenario)STK_MCP_DEFAULT_START_TIME (default 20 Jan 2020 17:00:00.000)STK_MCP_DEFAULT_DURATION_HOURS (default 48.0)Logging is standardized via src/stk_mcp/stk_logic/logging_config.py. The CLI uses
this configuration, producing structured logs with timestamps, levels, and context.
src/stk_mcp/stk_logic/decorators.py (@require_stk_tool and @require_stk_resource).tenacity) in src/stk_mcp/stk_logic/utils.py (safe_stk_command).@timed_operation for diagnostics.Managed with uv:
agi.stk12 (local wheel from your STK install)mcp[cli]>=1.6.0uvicorn>=0.30 (explicit for CLI server)rich>=13.7 (CLI table output)typer>=0.15.2pydantic>=2.11.7pywin32 (Windows only)Notes:
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.