Skip to content

Connecting Foundry VTT & Other VTTs (ACP v1) ​

Elthoria ships built-in Tactical Battle Boards and Hex World Maps inside elthoria web, and includes a real, installable Foundry VTT (v12 / v13) module (elthoria-acp-bridge) that connects Foundry directly to your local Elthoria Harness over Agent Client Protocol (ACP) v1 WebSockets — plus provider-neutral contracts for Owlbear Rodeo, Roll20, or custom browser VTTs.


How the Foundry VTT connection works ​

text
┌─────────────────────────────────────────────────────────────────────────┐
│  Foundry VTT (v12 / v13) — `elthoria-acp-bridge` Module (GM-only)       │
│  • GM chat commands (`/elthoria`, `/elthoria-turn`, `/elthoria-ooc`,    │
│    `/elthoria-recap`, `/elthoria-status`) + Token Controls button       │
│  • Streams responses into a private GM whisper with Cancel & Reveal     │
└───────────────────────────────┬─────────────────────────────────────────┘
                                │ ws://127.0.0.1:9188/acp?token=<secret>
                                │ (ACP v1 JSON-RPC 2.0 over localhost WS)
                                ▼
┌─────────────────────────────────────────────────────────────────────────┐
│  Elthoria ACP WebSocket Bridge (`elthoria acp --ws`)                    │
│  • Pure-JDK loopback-only RFC 6455 bridge (127.0.0.1, token + Origin)   │
│  • Pipes NDJSON bidirectionally to `kompile acp` + Elthoria MCP server  │
│  • Enforces GM vs. PLAYER visibility (`elthoria.vtt-scene-sync.v1`)     │
└─────────────────────────────────────────────────────────────────────────┘
  • 100% local & GM-only: The bridge binds strictly to 127.0.0.1 and requires both a one-time auth token and an allowed Origin header. Players in your Foundry world cannot see your token, run /elthoria commands, or see GM whispers until you click Reveal to Players.

Step-by-Step: Installing the Foundry VTT Module (elthoria-acp-bridge) ​

Step 1: Install the module in Foundry VTT ​

  1. Open Foundry VTT Setup (the main home screen before launching a world).
  2. Click the Add-on Modules tab, then click Install Module.
  3. At the bottom of the Install Module dialog, paste this Manifest URL:
    text
    https://elthoria-ai.github.io/elthoria-harness/foundry/module.json
  4. Click Install. Foundry downloads and verifies elthoria-acp-bridge.zip automatically.

Method B — Manual ZIP Download (Offline / Self-Hosted Server) ​

  1. Download the packaged module ZIP:
  2. Extract the archive into your Foundry VTT Data/modules/ directory so that module.json sits at Data/modules/elthoria-acp-bridge/module.json:
    • macOS: ~/Library/Application Support/FoundryVTT/Data/modules/
    • Windows: %LOCALAPPDATA%\FoundryVTT\Data\modules\
    • Linux: ~/.local/share/FoundryVTT/Data/modules/
  3. Restart Foundry VTT (or refresh Setup).

Method C — From Source or Installed Distribution (Developers) ​

If you cloned elthoria-harness or installed the portable distribution, you can symlink the module directory directly into Foundry's Data/modules/:

bash
# From a source checkout:
ln -s /path/to/elthoria-harness/integrations/foundry-vtt/elthoria-acp-bridge \
  ~/.local/share/FoundryVTT/Data/modules/elthoria-acp-bridge

# Or from an installed distribution:
ln -s ~/.elthoria/components/elthoria/current/share/elthoria/integrations/foundry-vtt/elthoria-acp-bridge \
  ~/.local/share/FoundryVTT/Data/modules/elthoria-acp-bridge

Step 2: Enable the module in your Foundry world ​

  1. Launch your Foundry world and log in as Gamemaster.
  2. Open Game Settings (gear icon in the top-right sidebar) → Manage Modules.
  3. Check Elthoria GM — ACP v1 Bridge and click Save Module Settings (Foundry reloads the world).

Step 3: Start the local Elthoria ACP WebSocket bridge ​

In a terminal on your GM machine, start the bridge:

bash
elthoria acp --ws --port 9188

Elthoria binds strictly to 127.0.0.1:9188, generates a one-time random auth token, and prints:

text
Elthoria ACP v1 WebSocket bridge listening on ws://127.0.0.1:9188/acp
Auth token: <generated-token>
Connect URL: ws://127.0.0.1:9188/acp?token=<generated-token>

TIP

Want a stable token across restarts, or running Foundry on a LAN hostname? Pass --token <your-secret> and/or --allow-origin:

bash
elthoria acp --ws --port 9188 --token my-gm-secret --allow-origin http://foundry.local:30000

Step 4: Configure the module settings in Foundry (GM-only) ​

  1. In Foundry, open Game Settings → Configure Settings → Elthoria GM — ACP v1 Bridge.
  2. Paste the Connect URL (ws://127.0.0.1:9188/acp?token=<generated-token>) directly into Elthoria ACP WebSocket URL — or paste ws://127.0.0.1:9188/acp into the URL field and the token into Elthoria ACP Auth Token (both work).
  3. Set Elthoria Campaign ID (e.g. 1, matching your campaign in Elthoria).
  4. Leave Attach Active Foundry Scene Snapshot (GM-only) checked if you want Foundry's active scene grid and token positions sent privately alongside /elthoria prompts.
  5. Click Save Changes.

Step 5: Verify & play right inside Foundry Chat ​

In Foundry's chat box (as GM), run:

text
/elthoria-connect

You should see a private GM whisper card confirming Status: Connected, your active ACP session ID, campaign ID, and active Foundry scene.

Built-in Foundry GM Chat Commands ​

CommandWhat it does
/elthoria <prompt>Send an in-character or GM prompt with the active Foundry scene snapshot attached
/elthoria-turn <action>Run a grounded combat or action turn through Elthoria
/elthoria-play [notes]Orient or resume your active Elthoria campaign
/elthoria-recapGenerate a spoiler-free recap (arrives as a private GM whisper — click Reveal to Players to share it!)
/elthoria-ooc <question>Ask an out-of-character rules, AC breakdown, or prep question without advancing the scene
/elthoria-rules <query>Look up mechanics or your player-safe bookshelf
/elthoria-statusShow current bridge status, ACP session ID, campaign ID, and active Foundry scene
/elthoria-connect / /elthoria-reconnect / /elthoria-disconnectConnect, refresh token/session, or disconnect from the bridge
/elthoria-cancelCancel an in-flight streaming response

You can also click the Ask Elthoria GM wizard-hat icon in Foundry's Token Controls toolbar (left sidebar, GM-only) to send a prompt from a dialog.

  • Streaming & spoiler safety: Responses stream live into a private GM whisper card showing tool progress and a Cancel button while running. Once finished, click Reveal to Players whenever you want to post that narration publicly to Foundry chat.
  • Hidden tokens stay hidden: Hidden Foundry tokens are marked hidden: true on GM snapshots and automatically stripped on any PLAYER-audience snapshot (extractSceneSnapshot('PLAYER')).

Troubleshooting ​

SymptomCause & Fix
Failed to connect / WebSocket rejected (401)You restarted elthoria acp --ws, which generated a new random token. Paste the new Connect URL (or pass --token <fixed-secret> when launching) and run /elthoria-reconnect.
WebSocket rejected (403 Forbidden)Your Foundry browser tab is opened on a hostname other than localhost/127.0.0.1 (for example http://192.168.1.50:30000). Restart the bridge with --allow-origin http://192.168.1.50:30000.
Browser blocks ws://127.0.0.1 on an https:// Foundry hostBrowsers treat http://localhost / ws://127.0.0.1 as potentially trustworthy in Chromium/Firefox, while Safari or strict proxies may block ws:// from an https:// page. Open Foundry locally on http://localhost:30000 (or reverse-proxy the bridge over wss:// on your GM machine).
Nothing happens when a player types /elthoriaExpected — the module restricts all settings, toolbar buttons, and /elthoria* commands strictly to Gamemaster accounts.

Optional: Connecting Owlbear Rodeo, Roll20, or Custom VTTs (Developers) ​

  • ACP v1 over WebSocket (elthoria acp --ws): Any browser VTT extension can reuse the zero-dependency ESM client in integrations/foundry-vtt/elthoria-acp-bridge/scripts/acp-client.mjs (ElthoriaAcpClient, resolveConnectionTarget, extractFoundrySceneSyncSnapshot) to speak standard ACP v1 JSON-RPC 2.0 (initialize → session/new / session/resume → session/prompt, streaming session/update, session/cancel).
  • ACP v1 over stdio (elthoria acp): Connects desktop ACP clients directly to Elthoria's GM workspace.
  • Provider-neutral VTT contracts (elthoria-integrations):
    • VttCapabilities (foundry-vtt, owlbear-rodeo, roll20, elthoria-web)
    • VttSceneSyncSnapshot (elthoria.vtt-scene-sync.v1) with fail-closed toPlayerSafe() filtering
    • VttSyncEvent (elthoria.vtt-event.v1) for SCENE_ACTIVATED, TOKEN_MOVED, INITIATIVE_UPDATED, CHAT_MESSAGE, ROLL_RESULT, and HP_UPDATED
    • VttBridgePort SPI for Java/JVM adapters
  • Direct Foundry MCP servers: If you also want the AI GM to push direct Foundry actor/journal/token edits via MCP, you can mount any compatible Foundry MCP server alongside elthoria in your Kompile MCP configuration.

Next steps ​

Built on the upstream Kompile harness. Released under the MIT License.