Get the FREE Ultimate OpenClaw Setup Guide →

defcon

LET AI PLAY GLOBAL THERMONUCLEAR WAR. This is an MCP Server for Introversion Software's 2007 game DEFCON.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jorisvddonk-defcon-mcp-server node mcp-server.mjs

How to use

This DEFCON MCP Server exposes a Model Context Protocol interface to coordinate an AI-driven DEFCON game session. The server runs the mcp-server.mjs entry point and supports both standard input/output (stdio) and HTTP transports for LLM integration. It reads game state from the DEFCON Lua bot via the defined input/output text files and writes commands for the Lua bot to execute, enabling an AI to interact with DEFCON through MCP prompts and tools. Available tools include sending chat messages, placing structures and fleets, launching nukes, drawing on the whiteboard, and querying game state or command results; prompts help the AI analyze the game state and propose optimal moves or targets. To begin, start DEFCON with the Lua bot set up, then run the MCP server and connect your LLM interface to the stdio or HTTP transport, configuring any input/output file paths as needed.

How to install

Prerequisites:

  • Node.js (recommended latest LTS) and npm installed
  • A DEFCON installation with the DEFCON AI API and LUABOT set up, as described in the README
  • The DEFCON and LUABOT integration prepared to communicate via input.txt and output.txt

Installation steps:

  1. Ensure DEFCON and LUABOT are installed and configured per the DEFCON MCP README.

  2. Clone this repository into the luabot directory as described in the setup steps.

  3. Install Node.js dependencies for the MCP server:

    npm ci

  4. Start DEFCON and the AI bot as described in the README to establish the in-game I/O paths (input.txt / output.txt).

  5. Run the MCP server using Node.js:

    node mcp-server.mjs

  6. Connect your LLM or automation tool to the MCP server via stdio (default) or enable HTTP transport with:

    node mcp-server.mjs --http

  7. If you need to customize input/output file locations, pass them as CLI arguments, for example:

    node mcp-server.mjs --inputfile="D:/input.txt" --outputfile="D:/output.txt"

Prerequisites recap: ensure you have a working DEFCON setup with LUABOT, npm installed, and the MCP server files in place before starting the server.

Additional notes

Notes and tips:

  • This server is labeled work in progress; not all DEFCON commands may be available yet.
  • The server communicates with the game via text files (input.txt and output.txt). You may adjust their locations via CLI arguments when launching the server.
  • Transport options include stdio and HTTP; choose the one that matches your LLM integration setup.
  • If you run into file path issues, ensure the DEFCON process has the correct permissions to read/write the input/output text files.
  • The server provides a set of MCP tools (e.g., debug-log, send-chat, place-structure, launch-nuke) and resources/prompts to help guide the AI’s decisions. Use prompts like analyze-game-state and suggest-nuke-targets to craft strategic actions.
  • For debugging, monitor the DEFCON game log and the MCP server logs to trace command correlations by their IDs.

Related MCP Servers

Sponsor this space

Reach thousands of developers