Skip to main content
Glama
Avee4k

space-invaders-tui

by Avee4k

space-invaders-tui

Space Invaders in your terminal — with one rule changed: time only moves when you move.

Stand still and the world freezes mid-frame. Bombs hang in the air, the formation stops mid-step, your own shot waits above the cannon. Every move you make lets time flow again. The reflex classic becomes a duel of timing and position.

Space Invaders TUI demo

Play

Straight from your terminal, no install:

ssh -p 2222 invaders.m2-webvision.de

Or run it locally:

npx space-invaders-tui

Key

Action

← / → or A / D

Move (and let time flow)

Space

Fire — one shot in the air at a time

P

Pause

R

Restart after game over

Q / Ctrl+C

Quit

After game over, enter three letters arcade-style — the high-score table is global. You are playing against everyone who ever ssh'd in.

Related MCP server: textual-mcp-server

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 fight the invaders turn by turn:

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

Three tools: invaders_new_game, invaders_state (returns the board as ASCII plus structured state), and invaders_act (hold left/right/fire for N frames). The SUPERHOT rule applies to agents too: doing nothing freezes the world — moving is what spends time.

How it works

  • src/game.ts — pure game logic. No rendering, no I/O, fully unit-tested. The SUPERHOT mechanic is a per-frame time scale that ramps between 0.08 (idle) and 1 (moving); the world updates with scaled time, the player always moves in real time.

  • src/render.ts / src/app.tsOpenTUI rendering and input wiring. Uses the kitty keyboard protocol (press/release events) where available, falls back to event-driven movement elsewhere.

  • 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 API behind the global high-score table, with validation, plausibility checks, and rate limiting.

  • mcp/server.ts — MCP server on top of the pure game core, runs on plain Node.

Self-host

cd deploy && docker compose up -d

Runs the SSH arcade and the leaderboard API in one hardened container stack. See deploy/ for details. LEADERBOARD_URL="" disables the global leaderboard, LEADERBOARD_URL=https://… points the game at your own instance.

Development

npm install
npm start           # play locally (needs the bundled bun runtime)
npm test            # game logic (node) + headless rendering smoke test (bun)
npm run typecheck

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

License

MIT

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • An MCP server that gives your AI access to the source code and docs of all public github repos

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Avee4k/space-invaders-tui'

If you have feedback or need assistance with the MCP directory API, please join our Discord server