mcp-dcs-lua-runner

sevenfifty777/mcp-dcs-lua-runner

3.2

If you are the rightful owner of mcp-dcs-lua-runner 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.

A Model Context Protocol (MCP) server designed for executing Lua code on Digital Combat Simulator (DCS) servers using Server-Sent Events (SSE) transport.

Tools
5
Resources
0
Prompts
0

DCS Lua Runner - MCP Server with SSE Transport

A Model Context Protocol (MCP) server for executing Lua code on DCS (Digital Combat Simulator) servers, using Server-Sent Events (SSE) transport. This server can be deployed to Vercel as a serverless function and used with Claude Desktop, Cline, or any MCP-compatible client.

Features

  • SSE Transport - HTTP-based MCP server using Server-Sent Events
  • Vercel Deployment - Deploy as a serverless function
  • Multiple Tools - Execute Lua, get mission info, player info, units, and more
  • Flexible Environment - Run in mission or GUI environment
  • Remote DCS Server - Connect to any DCS server (local or remote)

Available Tools

  1. execute_lua - Execute arbitrary Lua code on DCS server
  2. get_mission_info - Get current mission details (time, theatre, weather)
  3. get_player_info - Get player aircraft information
  4. get_all_units - List all units in the mission
  5. send_message - Send message to all players

Quick Start

1. Installation

cd C:\Users\thierry\Documents\GitHub\mcp-dcs-lua-runner
npm install

2. Configuration

Copy .env.example to .env and configure your DCS server:

cp .env.example .env

Edit .env:

server_address=51.75.131.6
server_port=12080
server_address_gui=51.75.131.6
server_port_gui=12081
use_https=false
web_auth_username=YourUsername
web_auth_password=YourPassword
run_code_locally=false
run_in_mission_env=true

3. Local Testing (Stdio Mode)

Run locally with stdio transport for testing:

npm run build
node build/api/index.js

4. Deploy to Vercel

vercel --prod

Or connect to GitHub and auto-deploy.

Usage with MCP Clients

Claude Desktop

Edit %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "dcs-lua-runner": {
      "url": "https://your-project.vercel.app/api"
    }
  }
}

Cline (VS Code)

Edit %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json:

{
  "mcpServers": {
    "dcs-lua-runner-vercel": {
      "type": "sse",
      "url": "https://your-project.vercel.app/api"
    }
  }
}

Environment Variables

Set these in Vercel dashboard (Settings → Environment Variables):

  • server_address - DCS server IP address
  • server_port - DCS mission environment port (default: 12080)
  • server_address_gui - DCS GUI environment IP (optional)
  • server_port_gui - DCS GUI environment port (default: 12081)
  • use_https - Use HTTPS for DCS connection (true/false)
  • web_auth_username - DCS server authentication username
  • web_auth_password - DCS server authentication password
  • run_code_locally - Connect to localhost (true/false)
  • run_in_mission_env - Use mission environment vs GUI (true/false)

Example Usage

Once configured in Claude Desktop or Cline, you can use natural language:

"Get the current mission information from DCS"
"Execute this Lua code: return Env.mission.theatre"
"Show me all blue coalition units"
"Send a message to all players: Mission starting in 5 minutes"

Development

Project Structure

mcp-dcs-lua-runner/
├── api/
│   └── index.ts          # MCP server with SSE transport
├── package.json          # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── vercel.json           # Vercel deployment config
├── .env.example          # Environment template
└── README.md             # This file

Local Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Test locally with stdio
node build/api/index.js

# Or use Vercel dev server
vercel dev

How It Works

  1. MCP Server: Implements the Model Context Protocol with SSE transport
  2. DCS Connection: Connects to DCS Fiddle server via HTTP
  3. Lua Execution: Sends base64-encoded Lua code to DCS
  4. Result Handling: Returns execution results through MCP

Troubleshooting

Connection Timeout

  • Verify DCS server is running and accessible
  • Check firewall rules allow connections
  • Confirm environment variables are set correctly in Vercel

Authentication Errors

  • Verify username/password in environment variables
  • Check DCS Fiddle server authentication settings

Deployment Issues

  • Ensure all environment variables are set in Vercel
  • Check Vercel function logs for errors
  • Verify TypeScript builds without errors

License

MIT

Credits

Built for DCS World integration using the Model Context Protocol.