OpenTTD Directorate MCP

OpenTTD Directorate MCP

Clean-room MCP and OpenTTD GameScript integration for deterministic transport planning and route commissioning.

Category
访问服务器

README

OpenTTD Directorate MCP

Give an LLM agent a bounded, verifiable control plane for playing OpenTTD.

OpenTTD Directorate connects an MCP-capable agent to an OpenTTD 15.3 server. The agent can inspect the live world, plan transport routes, apply construction programs, commission vehicles, and verify that a route actually works and earns money. It is designed for persistent autonomous play without reducing the game to blind console commands.

This is both:

  • a TypeScript MCP server that exposes typed tools to an AI agent; and
  • an OpenTTD GameScript package that performs guarded planning, construction, persistence, and verification inside the game.

It is not an AI model, an OpenTTD server distribution, or a save-game bot. You bring OpenTTD, an MCP client, and the agent you want to operate it.

What an agent can do

The MCP surface exposes:

  • observe — read map, company, route, plan, and economy state;
  • plan — create and advance bounded route plans;
  • apply — execute a compiled construction program;
  • commission — buy and configure the first vehicle for a route;
  • verify — prove topology, commissioning, and economic operation;
  • execute — issue explicitly allowed GameScript commands;
  • chat — send bounded in-game chat messages; and
  • rcon — perform explicitly authorized server administration.

A successful tool response is not treated as proof by itself. Plans and operations are persisted, operation IDs are replay-safe, and commissioned routes can be read back and checked for topology, vehicle movement, cargo delivery, and revenue.

Why this exists

Most generic game-control bridges expose low-level actions and leave the agent to guess whether they worked. OpenTTD Directorate adds the missing operating layer:

  1. typed MCP contracts;
  2. authenticated OpenTTD Admin Network transport;
  3. a GameScript request/response bridge;
  4. bounded station and route planning;
  5. deterministic build programs;
  6. persistent plan and operation journals; and
  7. explicit post-build verification.

That makes it suitable for agents that need to resume after disconnects, avoid duplicating operations, and distinguish “the command returned success” from “the railway actually carries cargo profitably.”

Architecture

LLM agent / MCP client
        |
        | MCP tools
        v
TypeScript MCP server
        |
        | OpenTTD Admin Network protocol
        v
OpenTTD dedicated server
        |
        | JSON envelopes through Admin <-> GameScript bridge
        v
OpenTTD Directorate GameScript
        |
        +-- planner and site survey
        +-- build-program compiler
        +-- operation journal
        +-- route registry
        `-- topology / commissioning / economic verification

More detail:

Current package

The stable GameScript package lives at game/openttd_directorate and exposes:

  • class OpenTTDDirectorateInfo;
  • class OpenTTDDirectorate;
  • package name OpenTTD Directorate;
  • short name DRCT;
  • version 4; and
  • release date 2026-07-30.

Internal D4_* and DIRECTORATE_M4_* identifiers are intentionally retained as implementation-level lineage markers.

Requirements

  • Node.js 20 or newer;
  • OpenTTD 15.3;
  • OpenGFX in a standard OpenTTD location, or provided through OPENTTD_OPENGFX_DIR; and
  • an MCP-capable agent/client.

Install and build

git clone https://github.com/OVER99K/openttd-directorate-mcp.git
cd openttd-directorate-mcp
npm ci --ignore-scripts
npm run build

Install the GameScript package into OpenTTD's user data directory:

mkdir -p ~/.local/share/openttd/game
cp -a game/openttd_directorate ~/.local/share/openttd/game/

Select release version 4 in openttd.cfg:

[game_scripts]
"OpenTTD Directorate" = 4

Configure and run the MCP server

cp .env.example .env

Minimum configuration:

OPENTTD_ADMIN_HOST=127.0.0.1
OPENTTD_ADMIN_PORT=3977
OPENTTD_ADMIN_PASSWORD=<admin-password>
OPENTTD_ADMIN_NAME=OpenTTD Directorate MCP
OPENTTD_ADMIN_VERSION=0.1.0
MCP_TRANSPORT=stdio
OPENTTD_REQUEST_TIMEOUT_MS=15000
OPENTTD_CONNECT_TIMEOUT_MS=10000
OPENTTD_PING_INTERVAL_MS=30000

Start it:

npm run dev

Production build:

npm run build
npm start

Example MCP client configuration:

{
  "mcpServers": {
    "openttd-directorate": {
      "command": "node",
      "args": ["--env-file=.env", "dist/src/index.js"],
      "env": {
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

No bearer token is required in stdio mode. The public release intentionally keeps streamable_http disabled; do not expose the Admin port or credentials to untrusted networks.

Components used and borrowed foundations

OpenTTD Directorate is an independent clean-room implementation, but it deliberately builds on established open-source software and public specifications:

No source or history was copied from prior OpenTTD MCP implementations. The precise clean-room boundary and complete licence/source table are recorded in CLEAN_ROOM.md and THIRD_PARTY.md.

Testing and verification

npm run check
npm audit --audit-level=high

Optional exact OpenTTD 15.3 engine gate:

OPENTTD_15_BIN=/path/to/openttd-15.3 \
OPENTTD_OPENGFX_DIR=/path/to/opengfx \
OPENTTD_GATE_EVIDENCE_PATH=/tmp/openttd-directorate-gate.json \
node tests/integration/directorate-real-engine-gate.mjs

The gate uses a disposable fixture and does not write into the tracked GameScript package. Set OPENTTD_GATE_KEEP_FIXTURE=1 only when retaining a failed fixture for diagnosis.

Security boundaries

  • MCP defaults to stdio transport.
  • Admin credentials are redacted from logs.
  • Planning payloads and buffers are bounded.
  • Path-like untrusted planning inputs are rejected.
  • Chat and RCON remain narrow, explicit surfaces rather than general gameplay shortcuts.
  • No credentials or deployment-specific secrets belong in the repository.

Limitations

  • OpenTTD 15.3 is the validated engine target.
  • AdminJoinSecure is not yet the default transport handshake.
  • Exact engine verification is optional and resource intensive.
  • Autonomous play still requires an agent operating policy: company ownership, spending limits, destructive-action gates, and multiplayer etiquette are not choices the protocol should silently invent.

Creator and contributor

OpenTTD Directorate was designed and built by Nicolette, an autonomous AI researcher, writer, and systems operator at nicai.space.

Nicolette is the primary author and maintainer of the MCP server, OpenTTD GameScript integration, planning and verification model, test suite, and documentation. Human direction and operational testing were provided through the nicai.space project environment.

Release provenance

  • CLEAN_ROOM.md defines permitted and prohibited implementation inputs.
  • THIRD_PARTY.md records external software, specifications, licences, and source URLs.
  • docs/verification.md defines exact-SHA evidence and release acceptance policy.

License

MIT. See LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选