defcon-mcp-server

defcon-mcp-server

Enables AI tools to play the game DEFCON by providing tools to communicate with the game, analyze game state, and issue commands such as placing structures, moving fleets, and launching nukes.

Category
访问服务器

README

DEFCON MCP Server

This is a Model Context Protocol (MCP) server for Introversion Software's 2007 game DEFCON, which allows your favourite AI tool to play GLOBAL THERMONUCLEAR WAR.

(work in progress; not all commands are available yet!)

Setting up

  1. Install DEFCON. Make sure to start it once to load your CD key.
  2. Download the DEFCON AI API and extract v1.57 to your DEFCON installation folder. You may want to rename the AI API .exe to DEFCON_ai.exe.
  3. Download LUABOT and extract it to <defcon installation folder>/AI; rename the folder so that you have <defcon installation folder>/AI/luabot/luabot.dll.
  4. Git clone this repository into the luabot folder.
  5. The MCP server writes to an input text file, which the Lua bot reads. The lua bot then writes to an output text file which is read by the MCP server. You will have to set the file paths yourself; they're hardcoded to write to R:\input.txt and R:\output.txt by default, but you can supply inputfile and/or outputfile CLI arguments to Defcon to override tis. A RAMDisk is recommended if you can set one up.
  6. Install dependencies with npm ci in this repository folder.
  7. Start the game via .\Defcon_ai.exe host nowan nolan nowlan luabot="AI\luabot\main.lua" numplayers=2 territory=0 debug inputfile="D://input.txt" outputfile="D://output.txt". Select AI/luabot/luabot.dll as the "external bot", and then add an internal AI player as well. The game should start automatically; if it doesn't just ready up to start!
  8. Configure your MCP-enabled LLM interface to start the MCP server via node mcp-server.mjs (for stdio transport) or node mcp-server.mjs --http (for HTTP transport). You can pass --inputfile="D://input.txt" and --outputfile="D://output.txt" or similar to set the location of input/output text files.
  9. Watch the carnage unfold!

Architecture

The DEFCON MCP Server uses a multi-layered architecture to enable AI-powered gameplay:

  1. Game Layer: DEFCON game running with the AI API extension
  2. Lua Bridge: A Lua bot (main.lua) that interfaces with the game through the DEFCON AI API
  3. File I/O Layer: Communication between the Lua bot and MCP server via text files
    • input.txt: Commands from MCP server to the game
    • output.txt: Game state information from the game to the MCP server
  4. MCP Server Layer: Node.js server (mcp-server.mjs) implementing the Model Context Protocol
    • Provides standardized tools, resources, and prompts for LLM interaction
    • Supports both stdio and HTTP transport methods
  5. LLM Integration Layer: Your AI tool connects to the MCP server to analyze game state and issue commands

Data Flow

  1. The Lua bot reads the game state and writes it to output.txt
  2. The MCP server reads output.txt to get the current game state
  3. The LLM analyzes the game state and decides on actions
  4. The MCP server writes commands to input.txt
  5. The Lua bot reads input.txt and executes commands in the game

Command Correlation

The system uses correlation IDs to track command execution:

  • Each command sent to the game includes a unique ID
  • Command results are tagged with the same ID
  • This allows the MCP server to verify if commands were executed successfully

Available MCP Tools

The MCP server provides the following tools:

  • debug-log: Send a debug message to the game log
  • send-chat: Send a chat message to opponents
  • place-structure: Place a structure (RadarStation, Silo, or AirBase) at specified coordinates
  • place-fleet: Place a fleet of ships at specified coordinates
  • move-fleet: Move a fleet to specified coordinates
  • whiteboard-draw: Draw a line on the whiteboard
  • whiteboard-clear: Clear all lines from the whiteboard
  • launch-nuke: Launch a nuclear missile from a silo to target coordinates
  • set-silo-defensive: Set a silo to defensive mode
  • get-command-results: Retrieve results of previously executed commands
  • get-game-state: Get the latest game state information
  • generate-ai-response: Generate an AI response based on the current game state

Available MCP Resources

The MCP server provides the following resources:

  • defcon://game-state: Get the current game state
  • defcon://level: Get the current DEFCON level

Available MCP Prompts

The MCP server provides the following prompts:

  • analyze-game-state: Analyze the current game state and suggest optimal moves
  • suggest-structure-placement: Suggest optimal locations for structure placement
  • suggest-nuke-targets: Suggest optimal targets for nuclear strikes

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选