sevenfifty777/dcs-lua-runner-mcp
If you are the rightful owner of dcs-lua-runner-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The DCS Lua Runner MCP Server is a Model Context Protocol server that facilitates real-time interaction between AI assistants and DCS World (Digital Combat Simulator) through chat.
DCS Lua Runner MCP Server
An MCP (Model Context Protocol) server that enables AI assistants to interact with DCS World (Digital Combat Simulator) in real-time through chat.
Features
This MCP server provides the following tools for AI interaction with DCS:
Tools Available
-
execute_lua - Execute arbitrary Lua code on DCS server
- Execute custom Lua scripts
- Choice of mission or GUI environment
- Returns execution results
-
get_mission_info - Get current mission information
- Mission time
- Theatre/map name
- Mission date
-
get_player_info - Get player aircraft information
- Aircraft name and type
- Position (x, y, z coordinates)
- Altitude
- Speed
- Heading
-
get_all_units - List all units in the mission
- Filter by coalition (red, blue, neutral, or all)
- Unit names, types, positions
- Coalition affiliations
-
spawn_unit - Spawn new units in the mission
- Ground units or vehicles
- Specify position using DCS coordinates, Lat/Long, or MGRS
- Custom unit names and heading
- Automatic coordinate conversion
-
send_message - Display messages in DCS
- Send text messages to all players
- Configurable display duration
-
get_theatre_info - Get theatre/map information
- Current map name
- Theatre details
-
get_aircraft_list - List all aircraft in mission
- All airborne units
- Positions and altitudes
- Coalition information
-
convert_coordinates - Convert real-world coordinates to DCS (NEW)
- Convert Lat/Long to DCS X/Z coordinates
- Convert MGRS to DCS coordinates
- Support for altitude/elevation
-
convert_dcs_to_ll - Convert DCS coordinates to Lat/Long (NEW)
- Convert DCS X/Z to real-world coordinates
- Get Latitude/Longitude from DCS positions
- Useful for mission planning and analysis
Prerequisites
- DCS World installed with DCS Fiddle server running
- Node.js installed (for running the MCP server)
Configuration
The MCP server reads settings from dcs_lua_runner_settings.json in the following priority order:
- Environment Variable (if set): Path specified in
DCS_SETTINGS_PATH - MCP Server Directory (default):
dcs_lua_runner_settings.jsonin the same folder as the MCP server - Fallback Defaults: If no settings file is found, uses default localhost configuration
Quick Setup
-
Copy the template file:
cp dcs_lua_runner_settings.json.template dcs_lua_runner_settings.json -
Edit the settings file with your DCS server details (the defaults work for most local setups)
The MCP server will automatically find and load the settings file from its own directory.
Settings Used
server_address- DCS server address for remote connectionsserver_port- Port for mission environment (default: 12080)server_address_gui- GUI environment server addressserver_port_gui- Port for GUI environment (default: 12081)use_https- Whether to use HTTPSweb_auth_username- Username for authenticationweb_auth_password- Password for authenticationrun_code_locally- Execute on local server (127.0.0.1)run_in_mission_env- Execute in mission vs GUI environment
Installation
Method 1: Direct Installation (Pre-built)
If you received a pre-built version:
- Extract the
dcs-lua-runner-mcpfolder to your preferred location - Navigate to the folder and install dependencies:
cd dcs-lua-runner-mcp npm install npm run build - Create your settings file (copy from
dcs_lua_runner_settings.json.template) - Configure your MCP client (see Configuration section below)
Method 2: Installation from GitHub
-
Clone the repository:
git clone https://github.com/sevenfifty777/dcs-lua-runner-mcp.git cd dcs-lua-runner-mcp -
Install dependencies:
npm install -
Build the project:
npm run build -
Create settings file:
Copy
dcs_lua_runner_settings.json.templatetodcs_lua_runner_settings.jsonand update with your DCS server details:cp dcs_lua_runner_settings.json.template dcs_lua_runner_settings.jsonThen edit
dcs_lua_runner_settings.jsonwith your settings:{ "server_address": "127.0.0.1", "server_port": 12080, "server_address_gui": "127.0.0.1", "server_port_gui": 12081, "use_https": false, "web_auth_username": "your_username", "web_auth_password": "your_password", "run_code_locally": true, "run_in_mission_env": true, "return_display_format": "lua" } -
Configure your MCP client:
You have two options for settings file location:
Option A: Settings in MCP Server Directory (Recommended)
Place
dcs_lua_runner_settings.jsonin the same directory as the MCP server. The server will automatically find it.For Cline (VS Code):
Edit
cline_mcp_settings.jsonlocated at:%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonAdd the server configuration:
{ "mcpServers": { "dcs-lua-runner-mcp": { "command": "node", "args": ["C:/absolute/path/to/dcs-lua-runner-mcp/build/index.js"] } } }For Claude Desktop:
Edit
claude_desktop_config.jsonlocated at:- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the server configuration:
{ "mcpServers": { "dcs-lua-runner-mcp": { "command": "node", "args": ["C:/absolute/path/to/dcs-lua-runner-mcp/build/index.js"] } } }
Option B: Custom Settings Location
If you want to place
dcs_lua_runner_settings.jsonin a different location (e.g., shared across multiple installations), use theDCS_SETTINGS_PATHenvironment variable.For Cline (VS Code):
{ "mcpServers": { "dcs-lua-runner-mcp": { "command": "node", "args": ["C:/absolute/path/to/dcs-lua-runner-mcp/build/index.js"], "env": { "DCS_SETTINGS_PATH": "C:/custom/path/to/dcs_lua_runner_settings.json" } } } }For Claude Desktop:
{ "mcpServers": { "dcs-lua-runner-mcp": { "command": "node", "args": ["C:/absolute/path/to/dcs-lua-runner-mcp/build/index.js"], "env": { "DCS_SETTINGS_PATH": "C:/custom/path/to/dcs_lua_runner_settings.json" } } } } - Windows:
-
Restart your MCP client (VS Code or Claude Desktop)
-
Test the connection:
Ask your AI assistant: "What's the current mission time in DCS?"
Verification
After installation, verify the MCP server is working:
- Check that
build/index.jsexists - Ensure DCS World is running with DCS Fiddle server
- Ask your AI assistant to get mission info
- Check MCP server logs in your client for any errors
Usage Examples
Once the MCP server is running, you can ask your AI assistant to interact with DCS:
Get Mission Information
"What's the current mission time in DCS?"
"What theatre/map am I flying in?"
Get Player Information
"Where is my aircraft?"
"What's my current altitude and speed?"
Spawn Units
Using DCS coordinates:
"Spawn a T-72B tank at coordinates x=100000, z=200000 for the red coalition"
"Create an M-1 Abrams at position 150000, 250000 facing north"
Using Latitude/Longitude:
"Spawn an M-1 Abrams at latitude 42.3601, longitude 43.3517 for the blue coalition"
"Create a tank at lat/lon 35.5, 45.8"
Using MGRS coordinates:
"Spawn a T-72B at MGRS 37SCA4022505929 for the red coalition"
"Create a tank at MGRS '38T MK 12345 67890' heading 90 degrees"
Convert Coordinates
Convert real-world coordinates to DCS:
"Convert latitude 42.3601, longitude 43.3517 to DCS coordinates"
"Convert MGRS 38TMK1234567890 to DCS coordinates"
"What are the DCS coordinates for MGRS '37 S CA 40225 05929'?"
Convert DCS coordinates to Lat/Long:
"Convert DCS coordinates x=100000, z=200000 to latitude and longitude"
"What's the real-world location of DCS position x=50000, z=75000?"
Send Messages
"Send a message to all players saying 'Mission starting in 5 minutes'"
Execute Custom Lua
"Execute this Lua code in DCS: return timer.getTime()"
"Run this script to get all blue coalition units"
List Units and Aircraft
"Show me all units in the mission"
"List all red coalition aircraft"
"What aircraft are currently in the mission?"
🌍 Coordinate Conversion
The MCP server supports automatic coordinate conversion between real-world coordinate systems and DCS world coordinates.
Supported Coordinate Systems
DCS World Coordinates:
- Native X, Z coordinate system (meters from map origin)
- Y coordinate for altitude
Real-World Coordinates:
- Latitude/Longitude: Decimal degrees format (e.g., 42.3601, 43.3517)
- MGRS (Military Grid Reference System): Standard military coordinate format
- Supports formats with or without spaces:
38TMK1234567890or38T MK 12345 67890 - Full format: Zone + Band + Digraph + Easting + Northing (e.g.,
37SCA4022505929)
- Supports formats with or without spaces:
Coordinate Conversion Tools
convert_coordinates
Converts real-world coordinates (Lat/Long or MGRS) to DCS world coordinates.
Example usage:
"Convert latitude 42.3601, longitude 43.3517 to DCS coordinates"
"Convert MGRS 38TMK1234567890 to DCS coordinates"
Returns DCS X, Z coordinates plus the original coordinates for reference.
convert_dcs_to_ll
Converts DCS world coordinates to real-world Latitude/Longitude.
Example usage:
"Convert DCS coordinates x=100000, z=200000 to latitude and longitude"
"What's the real-world location of x=50000, z=75000?"
Returns Latitude and Longitude in decimal degrees.
Enhanced spawn_unit Tool
The spawn_unit tool accepts coordinates in three different formats:
- DCS Coordinates (traditional):
xandzparameters - Latitude/Longitude:
latitudeandlongitudeparameters - MGRS:
mgrsparameter (e.g., "38TMK1234567890" or "38T MK 12345 67890")
The server automatically converts real-world coordinates to DCS coordinates before spawning.
MGRS Format Support
All these MGRS formats are supported:
38TMK1234567890(no spaces, 10-digit precision)38T MK 12345 67890(with spaces)37SCA4022505929(different zone)37 S CA 40225 05929(with spaces)
The parser automatically handles spaces and extracts all required components (UTM Zone, Band, MGRS Digraph, Easting, Northing) for accurate conversion.
DCS Setup Requirements
1. DCS Fiddle Server Installation
Ensure the DCS Fiddle server script (dcs-fiddle-server.lua) is installed in:
%USERPROFILE%\Saved Games\DCS\Scripts\Hooks\
2. DCS Desanitization
⚠️ Security Warning: This requires removing DCS security restrictions.
Edit DCS_INSTALL\Scripts\MissionScripting.lua and comment out these lines:
do
sanitizeModule('os')
sanitizeModule('io')
sanitizeModule('lfs')
-- _G['require'] = nil -- Comment this line
_G['loadlib'] = nil
-- _G['package'] = nil -- Comment this line
end
3. Start DCS
- Launch DCS World
- The DCS Fiddle server will start automatically
- Verify the server is running (check DCS.log for "DCS Fiddle successfully initialized")
Troubleshooting
Connection Errors
Error: "Connection refused - check if DCS Fiddle server is running"
- Solution: Ensure DCS is running and DCS Fiddle server is installed correctly
Error: "Request timeout - check server connection"
- Solution: Check if DCS Fiddle server is bound to the correct address/port
- Verify firewall settings if using remote connections
Authentication Errors
Error: Unauthorized (401)
- Solution: Check username/password in
dcs_lua_runner_settings.json - Ensure authentication settings match DCS Fiddle server configuration
Execution Errors
Error: "No player found"
- Solution: Ensure you're in a mission with a player-controlled aircraft
- Try switching between mission and GUI environments
Error: Lua execution errors
- Solution: Check Lua syntax and DCS API availability
- Some functions only work in mission environment
Testing with MCP Inspector
The MCP Inspector is a developer tool that allows you to test and debug your MCP server interactively before integrating it with an AI client.
Running the Inspector
-
Ensure the project is built:
npm run build -
Start the MCP Inspector:
npm run inspector -
Using the Inspector:
- The inspector will open in your default web browser
- You'll see an interactive GUI showing:
- Available Tools: List of all 8 DCS interaction tools
- Tool Parameters: Input fields for each tool's parameters
- Request/Response: Real-time display of MCP communication
- Test Results: Output from each tool execution
-
Testing Individual Tools:
- Select a tool from the list (e.g.,
get_mission_info) - Fill in required parameters (if any)
- Click "Execute" to test the tool
- View the response in JSON format
- Select a tool from the list (e.g.,
-
Example Test Scenarios:
- Test connection: Use
get_mission_infoto verify DCS connection - Test Lua execution: Use
execute_luawith simple code likereturn "Hello from DCS" - Test spawning: Use
spawn_unitwith test coordinates - Debug errors: View detailed error messages and stack traces
- Test connection: Use
Inspector Benefits
- No AI client needed: Test without configuring Cline or Claude Desktop
- Interactive debugging: See requests and responses in real-time
- Parameter validation: Verify tool inputs before integration
- Quick iteration: Test changes immediately after rebuilding
Notes
- The inspector runs the MCP server in a test environment
- You still need DCS World running with the Fiddle server for actual DCS interaction
- The inspector uses the same
dcs_lua_runner_settings.jsonconfiguration
Development
Building from Source
cd C:\{your_path}\dcs-lua-runner-mcp
npm install
npm run build
Project Structure
dcs-lua-runner-mcp/
├── src/
│ └── index.ts # Main MCP server implementation
├── build/
│ └── index.js # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
Adding New Tools
To add new DCS interaction tools:
- Add tool definition to
ListToolsRequestSchemahandler - Implement tool logic in
CallToolRequestSchemahandler - Rebuild:
npm run build
Security Considerations
- Local Execution: By default, executes on
127.0.0.1(localhost only) - Remote Execution: Requires authentication (username/password)
- Code Validation: All Lua code is base64-encoded before transmission
- DCS Security: Requires DCS desanitization (understand the risks!)
License
MIT License - Based on the DCS Lua Runner GUI project
Credits
- Original DCS Fiddle: JonathanTurnock and john681611
- DCS Lua Runner VSCode Extension: omltcat
- GUI Implementation: Created for standalone Windows application
- Model Context Protocol: MCP SDK by Anthropic
Support
For issues related to:
- MCP Server: Check the build output and MCP settings
- DCS Connection: Verify DCS Fiddle server installation
- Lua Execution: Check DCS.log for detailed error messages