loading…
Search for a command to run...
loading…
Enables AI assistants to play interactive fiction games (Glulx and Z-machine) through the Model Context Protocol, with automatic save/restore and optional journ
Enables AI assistants to play interactive fiction games (Glulx and Z-machine) through the Model Context Protocol, with automatic save/restore and optional journaling mode.
An MCP (Model Context Protocol) server for playing interactive fiction games. Enables AI assistants like Claude to play text adventure games through a standardized interface.
# Using uvx (recommended)
uvx mcp-server-if
# Or install with pip
pip install mcp-server-if
The package includes pre-compiled interpreters. No additional setup required.
| Variable | Description | Default |
|---|---|---|
IF_GAMES_DIR |
Directory to store games | ~/.mcp-server-if/games |
IF_GLULXE_PATH |
Override path to glulxe binary | Bundled binary |
IF_BOCFEL_PATH |
Override path to bocfel binary | Bundled binary |
IF_REQUIRE_JOURNAL |
Require journal reflections | false |
mcp-server-if --help
Options:
--games-dir PATH Directory to store games
--glulxe-path PATH Path to glulxe binary (overrides bundled)
--require-journal Require journal reflections between turns
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"interactive-fiction": {
"command": "uvx",
"args": ["mcp-server-if"]
}
}
}
claude mcp add interactive-fiction -- uvx mcp-server-if
play_ifPlay a turn of interactive fiction.
play_if(game="zork", command="go north")
play_if(game="zork", command="", journal="...reflection...") # with journaling
list_gamesList available games and their save state status.
download_gameDownload a game from the IF Archive or any URL.
download_game(name="advent", url="advent.ulx")
download_game(name="bronze", url="https://example.com/Bronze.gblorb")
reset_gameReset a game to start fresh (clears save state, preserves journal).
read_journalRead the playthrough journal for a game.
read_journal(game="zork", recent=10) # last 10 entries
search_journalSearch journal entries by keyword.
search_journal(game="zork", query="treasure")
Glulx (modern, uses glulxe interpreter):
.ulx - Raw Glulx game files.gblorb - Blorb containers with Glulx gamesZ-machine (classic Infocom format, uses bocfel interpreter):
.z3, .z4, .z5, .z7, .z8 - Z-code game files.zblorb - Blorb containers with Z-machine gamesFind games at the IF Archive: Glulx games, Z-code games.
Enable with --require-journal or IF_REQUIRE_JOURNAL=true. In this mode:
{game}/journal.jsonlread_journal and search_journal to review your playthroughThis encourages thoughtful, reflective gameplay rather than rushing through.
Games are stored in ~/.mcp-server-if/games/{name}/
Each game directory contains:
.ulx, .gblorb, .z5, etc.)state/ - autosave data (persists between sessions)metadata.json - session metadatajournal.jsonl - playthrough journal (if enabled)The server selects the appropriate interpreter based on file format:
Both interpreters use RemGlk for JSON-based I/O
Game state is automatically saved after each turn
Requires uv, a C compiler (gcc or clang), a C++ compiler (g++ or clang++), make, and git.
git clone --recursive https://github.com/davidar/mcp-server-if.git
cd mcp-server-if
uv sync --group dev
uv run pytest -v
uv sync compiles the bundled interpreters (glulxe and bocfel) from source automatically. If binaries are missing after a fresh clone, run uv sync --reinstall-package mcp-server-if to force recompilation.
This shouldn't happen with pip/uvx installs. If it does:
pip install --force-reinstall mcp-server-if or uv sync --reinstall-package mcp-server-ifIF_GLULXE_PATH to a manually installed glulxeUse list_games to see available games, or download_game to get new ones.
In-game save/restore triggers file dialogs that aren't supported. Use the automatic autosave system instead - your game state persists between sessions automatically.
MIT License - see LICENSE for details.
Выполни в терминале:
claude mcp add mcp-server-if -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.