Claude Plays Terminal Games logo

Claude Plays Terminal Games

Community
brendanlong

An MCP server that allows Claude to interact with terminal-based games through tmux

Publisherbrendanlong
Repositoryclaude-code-plays-text-games
LanguageJavaScript
Forks
3
Stars
16
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Claude Plays Terminal Games exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    16 stars and 3 forks from the linked repository.

Claude Plays Terminal Games

This project provides an MCP (Model Context Protocol) server that allows Claude to interact with terminal-based games through tmux. It enables Claude to play text-based games like Colossal Cave Adventure, NetHack, Zork, and other terminal games.

Security note: The start_game tool included in this repo can run arbitrary commands, so you probably don't want to give Claude unconditional permission to run it. The other commands are relatively safe to allow since they only work on whatever game is started, and the tmux session will end with it. This assumes you're running and actual game and not something like bash (in which case, send_line and send_keys can also run arbitrary commands).

Read more: Dwarf Fortress and Claude's ASCII Art Blindness

Examples

Features

  • MCP Server: Provides a clean API for Claude to interact with games
  • Terminal Game Support: Works with any terminal-based game available in your PATH
  • Tmux Integration: Uses tmux for reliable session management
  • Special Key Support: Send complex key combinations and special keys
  • Game Notes: Includes notes and guides for specific games

Quick Start

  1. Install dependencies:

    bash
    npm install
  2. Restart Claude Code - it will automatically detect the .mcp.json file and load the game controller server!

Available MCP Tools

  • start_game: Start a new game session

    • Parameters: game_name (e.g., "adventure", "nethack")
  • send_line: Send text commands to the game

    • Parameters: command (the command text)
  • send_keys: Send special keys to the game

    • Parameters: keys (array of key names, e.g., ["Escape"], ["C-c"])
  • read_output: Read the current game state/output

  • end_game: Terminate the game session

Supported Games

Any terminal-based game that can run in tmux, including:

  • Colossal Cave Adventure (adventure)
  • NetHack (nethack)
  • Zork series (zork1, zork2, zork3)
  • Dwarf Fortress (dwarffortress)
  • And many more...

Key Names Reference

Use these key names with the send_keys tool:

  • Arrow keys: Up, Down, Left, Right
  • Special keys: BSpace, BTab, DC (Delete), End, Enter, Escape, Home, IC (Insert), Space, Tab
  • Page keys: NPage/PageDown, PPage/PageUp
  • Function keys: F1 to F12
  • Modifiers: C- (Ctrl), S- (Shift), M- (Alt)
  • Examples: C-c (Ctrl+C), S-Tab (Shift+Tab), M-a (Alt+A)

Project Structure

claude-code-plays-text-games/
├── src/                   # Source code
│   ├── mcp-server.js      # Main MCP server
│   └── game-controller.js # Game interaction logic
├── scripts/               # Shell scripts for game interaction
│   ├── start_game.sh
│   ├── send_line.sh
│   ├── send_key.sh
│   ├── read_output.sh
│   └── end_game.sh
├── tests/                 # Test files and snapshots
│   ├── game-controller.test.js
│   └── __snapshots__/
├── game-notes/            # Game-specific notes and guides
│   └── dwarffortress/
├── CLAUDE.md              # Instructions for Claude
└── .mcp.json              # MCP server configuration

Requirements

  • Node.js
  • tmux
  • Game executables installed and available in PATH
  • Claude Code with MCP support

Testing

Run the test suite:

bash
npm test

Troubleshooting

  • Use /mcp in Claude Code to check if the server is connected
  • Ensure all game binaries are installed and in your PATH
  • Check that tmux is installed and working
  • Make sure you've run npm install to install dependencies

Installation

TypingMind
{
  "mcpServers": {
    "claude-code-plays-text-games": {
      "command": "node",
      "args": [
        "src/mcp-server.js"
      ]
    }
  }
}

Use Claude Plays Terminal Games MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Claude Plays Terminal Games is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Claude Plays Terminal Games as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Claude Plays Terminal Games MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "claude-code-plays-text-games": {
      "command": "npx",
      "args": [
        "-y",
        "claude-game-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Claude Plays Terminal Games MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Claude Plays Terminal Games MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Claude Plays Terminal Games to help me with this task?
Claude Plays Terminal Games
Sure. I read it.
Here is what I found using Claude Plays Terminal Games.

Frequently asked questions

What is the Claude Plays Terminal Games MCP server used for?

Claude Plays Terminal Games is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Claude Plays Terminal Games MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Claude Plays Terminal Games with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Claude Plays Terminal Games MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Claude Plays Terminal Games connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Claude Plays Terminal Games MCP to TypingMind?

Claude Plays Terminal Games runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Claude Plays Terminal Games MCP provide in TypingMind?

Claude Plays Terminal Games exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Claude Plays Terminal Games MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Claude Plays Terminal Games requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇