space-invaders-tui

space-invaders-tui

MCP server that lets LLMs play a terminal Space Invaders game with the SUPERHOT rule: time only moves when the agent moves. Exposes tools to start a game, inspect the board state, and act by holding left/right/fire for N frames.

Category
访问服务器

README

space-invaders-tui

STARFALL — a roguelite shmup in your terminal. You fly, the sky falls on you, and every level-up offers three random perks. Ten levels in you are cutting a laser through the swarm while two drones cover your flanks.

STARFALL demo

Play

Straight from your terminal, no install:

ssh -p 2222 invaders.m2-webvision.de

Or run it locally:

npx space-invaders-tui

Needs a terminal of at least 44x22 characters.

Key Action
← / → or A / D Fly (the ship has inertia — it drifts)
Space Fire
1 / 2 / 3 Pick a perk on level-up
P Pause
R Restart after game over
Q / Ctrl+C Quit

A run

Enemies arrive in a continuous stream, not in a formation: drifters fall straight, weavers snake, divers drop fast, gunners hold their line and shoot at you, brutes soak up damage. The longer you survive, the denser and tougher the mix gets.

Every kill gives score and experience. Enough experience and the game stops for a moment and offers three perks out of thirteen — rapid fire, spread shot, a laser beam, auto-aim, homing rockets, piercing shots, heavier shots, escort drones, extra hull, a rechargeable shield, crit chance, thrusters, more experience per kill. Perks stack, so the run compounds: the build you end with is never the build you planned.

Hits cost hull. A shield absorbs one hit and recharges when you stay clean. At zero hull the run ends, you type three letters arcade-style, and your score joins the global table — you are playing against everyone who ever ssh'd in.

Let an LLM play

The game logic is pure TypeScript with no terminal dependency, so it also ships as an MCP server. Point any MCP client at it and let a model fly:

claude mcp add starfall -- npx -y space-invaders-tui mcp

Four tools: start a run, look at the current frame (ASCII plus structured state), hold inputs for a number of frames, and pick a perk when a level-up interrupts the run. The MCP server runs on plain Node, so it starts without the runtime detour the game itself needs.

Install size

npx space-invaders-tui pulls roughly 130 MB. Almost all of it is the bundled Bun runtime: OpenTUI's renderer is a native library loaded through FFI, which plain Node cannot do. Shipping Bun as a dependency is what makes the one-line npx start work without asking you to install anything first. The MCP server does not touch the renderer, so it runs on your own Node instead.

How it works

  • src/game.ts — pure game logic: spawning, ballistics, perks, collisions, experience. No rendering, no I/O, an injectable random source, fully unit-tested.
  • src/perks.ts — the perk catalog as plain data plus a roll function; the only thing that touches the player's modifiers.
  • src/render.ts / src/app.ts — rendering and input wiring on top of OpenTUI. Uses the kitty keyboard protocol (press/release events) where available and falls back to impulse-based movement elsewhere, which is why the ship glides instead of stuttering.
  • mcp/server.ts — MCP server on top of the pure core, running on plain Node.
  • bin/cli.js — the npx launcher: it resolves the bundled Bun binary for the game and starts the MCP server in the Node you already have.
  • server/ssh-server.ts — the SSH arcade. Every connection gets its own in-process OpenTUI renderer writing ANSI straight into the SSH channel: no shell, no PTY subprocess, no auth. Hardened with session caps, idle timeouts, dimension clamping and backpressure limits.
  • server/leaderboard-api.ts — small Bun + SQLite service behind the global high-score table, with validation, plausibility checks, rate limiting and the landing page at invaders.m2-webvision.de.

Source, self-hosting, development

The npm package ships only what a player needs: the launcher, the game, the MCP server. Everything below lives in the repository at github.com/Avee4k/space-invaders-tui — clone it to follow along.

git clone https://github.com/Avee4k/space-invaders-tui
cd space-invaders-tui
npm install
npm start           # play locally
npm test            # game logic + MCP server (node) and a headless render smoke test (bun)
npm run test:server # SSH arcade and leaderboard API (bun)
npm run typecheck

Self-hosting the arcade, also from the clone:

cd deploy && docker compose up -d

That runs the SSH arcade and the leaderboard API as one hardened container stack; see deploy/ for details. In the game, LEADERBOARD_URL="" disables the global leaderboard and LEADERBOARD_URL=https://… points it at your own instance.

The test suite plays the game headlessly through OpenTUI's test renderer, and the SSH server is tested end-to-end with a real ssh2 client against an in-memory session.

License

MIT

推荐服务器

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

官方
精选