Skip to content
Foundry Api Bridge Module logo
MCP server
Remote

Foundry Api Bridge Module MCP Server

HTTP REST API bridge for Foundry VTT - enables external tools to access world data

Foundry Api Bridge Module scores 45 (Fair), licensed MIT and written in TypeScript. It can be reached as a remote MCP endpoint. It declares 3 tools. Filed under Knowledge. GitHub shows 11 stars. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.

by alexivenkovMITTypeScript11 stars
Trust score
45Fair
Trust score 45 of 100, Fair

Fair trust

45 of 100 from six public signals. Nobody can buy a point.

  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 45 comes from

0 + 20 + 4 + 10 + 4 + 7 = 45. Each factor is capped, so no single signal can carry a listing.

Registry0 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 0 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity4 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 4 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs7 / 10

A real summary, a README with depth, listed tools.

Docs: 7 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "alexivenkov-foundry-api-bridge-module": {      "url": "https://foundry-vtt-code--ai-nitromoon.run.tools/"    }  }}

Environment variables

This server does not declare environment variables.

Tools3Tool docs quality grade C

All capabilities
  • docstool

    Reference for the foundry.* API used in query and execute scripts. No arguments: the index โ€” every domain with its methods; ๐Ÿ”’ marks methods above your tier. With domain (e.g. "actors"): the TypeScript declarations of that domain with param

  • Run a script against the connected Foundry world with the full foundry.* API โ€” reads, writes and deletes. `code` is the body of an async function (see docs): call foundry. . ({ ... }), use await, console.log, and return what you want back (

  • querytool

    Run a read-only script against the connected Foundry world. `code` is the body of an async function: call foundry. . ({ ... }) (see docs), use await, console.log, and return the value you want back (JSON, size-limited). Only read methods ar

About

Foundry API Bridge

Foundry version Latest release smithery badge MCP Registry License: MIT

Foundry VTT module that connects your world to Foundry MCP, so an AI assistant โ€” Claude, ChatGPT, Codex, Cursor, Gemini or any MCP client โ€” can read your campaign and act in it: roll dice, run combat, write journals, move tokens, import from compendiums. It is built for Game Masters: the module runs only on the GM's client, keeps one outgoing connection to the server and executes commands inside Foundry with GM permissions. The same module serves the public REST API at api.foundry-mcp.com.

What you get

  • 121 tools over MCP: actors & inventory, dice & combat, journals & roll tables, scenes & tokens, compendium search & import, world time & UI.
  • D&D 5e, Pathfinder 1e and 2e, SWADE and Call of Cthulhu 7e aware. The core works with any game system. dnd5e/* adds ability, skill, save, attack and damage rolls and item use; pf2e/* adds skills, saves, strikes, conditions, spells and consumables; swade/* adds trait rolls with the wild die and raises, attacks and damage, Toughness damage and soak, bennies, statuses, a sheet summary and action cards; coc7/* adds d100 checks with bonus and penalty dice, attacks and damage, hit points, Sanity loss and bouts of madness, Luck, conditions and a sheet summary; pf1/* adds ability, skill, save, caster level and concentration checks, item use (attacks with damage and critical confirmation, spells, consumables), damage and healing with nonlethal and Wounds & Vigor, conditions and a sheet summary.
  • Public REST API for bots, dashboards and your own scripts, with the same module and the same key: api.foundry-mcp.com/docs.
  • Code mode (preview). The assistant writes a short TypeScript script against a typed foundry.* API and runs it in a sandbox: one round trip instead of dozens of tool calls. See Code mode and foundry-mcp.com/code.

Quick start

  1. In Foundry VTT: Add-on Modules โ†’ Install Module โ†’ search for Foundry API Bridge โ†’ Install, then enable it in your world.
  2. Open the module settings, click Get API Key, sign in with Patreon and paste the key back. A free Patreon account is enough.
  3. Add https://foundry-mcp.com/mcp to your AI client and sign in with Patreon when it asks.

The rest of this page has the details for each step.

Installation

From Foundry (recommended). Add-on Modules โ†’ Install Module โ†’ search for Foundry API Bridge โ†’ Install. The module is listed on foundryvtt.com and updates through Foundry's normal update check.

By manifest URL. Paste this into the Manifest URL field of the Install Module dialog:

https://raw.githubusercontent.com/alexivenkov/foundry-api-bridge-module/master/dist/module.json

Manually. Download foundry-api-bridge.zip from the latest release, extract it into Data/modules/foundry-api-bridge/, restart Foundry.

Then enable the module in your world: Game Settings โ†’ Manage Modules.

Setup

API key

Open foundry-mcp.com/auth/patreon, or click Get API Key under the API Key field in the module settings, and sign in with Patreon. You get a key of the form pk_โ€ฆ plus setup instructions for every supported client. No subscription is required to start. The same page shows your key again whenever you come back to it.

If you connect an AI client through OAuth first, the key is created for you at that moment and appears on the same page.

Module settings

Game Settings โ†’ Configure Settings โ†’ Module Settings โ†’ Foundry API Bridge:

SettingDefaultWhat it does
MCP WebSocket URLwss://foundry-mcp.com/wsChannel for AI assistants (MCP). Leave as is.
API WebSocket URLwss://api.foundry-mcp.com/v1/connectChannel for the public REST API. Leave as is, or clear it if you never use the REST API.
API KeyemptyYour pk_โ€ฆ key. Stored in this browser only; enter it again on another computer.
Allow Script MacrosoffLets the API create and run script macros: arbitrary JavaScript with GM rights. Keep it off unless you need it and trust every client that holds your key.

Save. Foundry reloads the world and two notifications confirm the link: [MCP] Connected to server and [API] Connected to server.

After a network drop the module reconnects on its own. The delay doubles from 5 seconds up to a 60-second ceiling, and it keeps trying for as long as the world is open. While connected it pings the server every 25 seconds; an unanswered ping means the connection is dead, and it is re-established without waiting. The same check runs when the browser comes back online or the tab becomes visible again.

The Configure button next to the module in the module list opens the advanced form:

SettingDefaultDescription
Enable WebSocketonTurn the connections on or off without clearing the URLs
Reconnect Interval (ms)5000Base delay between reconnection attempts; doubles each time
Max Reconnect Attempts0Attempts before the module gives up until the next reload; 0 = keep trying
Enable LoggingonModule logging in the browser console (Foundry API Bridge | โ€ฆ)
Log Levelinfodebug, info, warn, error

Connect an AI client

The MCP endpoint is https://foundry-mcp.com/mcp (Streamable HTTP). Where the client supports OAuth, add the URL and sign in with Patreon when asked: no key is copied anywhere. Where it does not, use the API key.

ClientHow to connect
Claude (web or desktop)Settings โ†’ Connectors โ†’ Add custom connector. Name Foundry, URL https://foundry-mcp.com/mcp, leave client ID and secret empty, click Add, then Connect and sign in with Patreon.
ChatGPT (Pro / Team / Enterprise)Settings โ†’ turn on Developer Mode. In a chat: + โ†’ Developer Mode โ†’ Add Sources, paste the URL, choose OAuth, sign in with Patreon. Leave client ID and secret empty. Enable the connector in each new chat.
Claude Codeclaude mcp add --transport http foundry https://foundry-mcp.com/mcp, then run /mcp and choose Authenticate.
Codex CLIcodex mcp add foundry --url https://foundry-mcp.com/mcp, then codex mcp login foundry.
Cursor~/.cursor/mcp.json: { "mcpServers": { "foundry": { "url": "https://foundry-mcp.com/mcp" } } }, then click Needs login in Settings โ†’ MCP.
VS Code.vscode/mcp.json: { "servers": { "foundry": { "type": "http", "url": "https://foundry-mcp.com/mcp" } } }, then sign in when prompted.
Gemini CLIgemini mcp add --transport http foundry https://foundry-mcp.com/mcp, then /mcp auth foundry.
WindsurfAPI key. ~/.codeium/windsurf/mcp_config.json: { "mcpServers": { "foundry": { "serverUrl": "https://foundry-mcp.com/mcp", "headers": { "Authorization": "Bearer pk_โ€ฆ" } } } }
ClineAPI key. MCP Servers โ†’ Remote Servers, name foundry, URL https://foundry-mcp.com/mcp, then add "headers": { "Authorization": "Bearer pk_โ€ฆ" } to the entry in cline_mcp_settings.json.

How OAuth works: the client asks the endpoint, gets an OAuth challenge, discovers the authorization server at foundry-mcp.com/oauth/*, registers itself (OAuth 2.1 with PKCE, dynamic client registration or a client metadata document) and sends you to Patreon. The token it receives is tied to your Patreon account and to the same pk_ key the module uses, so your tier applies everywhere. Command-line and desktop clients that redirect to a localhost callback (Claude Code, Codex CLI, Cursor, Gemini CLI, VS Code) are supported since 2026-09-21.

For clients that cannot do OAuth, and for scripts: send Authorization: Bearer pk_โ€ฆ with every request, using the key from the module settings.

ClientConfiguration
Claude Codeclaude mcp add --transport http --header "Authorization: Bearer pk_โ€ฆ" foundry https://foundry-mcp.com/mcp
Codex CLIcodex mcp add foundry --url https://foundry-mcp.com/mcp --bearer-token-env-var FOUNDRY_MCP_KEY, with the key in that environment variable
CursorAdd "headers": { "Authorization": "Bearer pk_โ€ฆ" } to the server entry in ~/.cursor/mcp.json
Gemini CLI~/.gemini/settings.json with "httpUrl" and "headers"
VS CodeAdd "headers" to the server entry in .vscode/mcp.json
Any other MCP clientEndpoint https://foundry-mcp.com/mcp, Streamable HTTP, header Authorization: Bearer pk_โ€ฆ

ChatGPT connectors support OAuth only.

Claude Desktop builds without connector support can use a config file and the key. It goes through mcp-remote and needs Node.js installed; restart Claude Desktop after saving:

{
  "mcpServers": {
    "foundry": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote@latest",
        "https://foundry-mcp.com/mcp",
        "--transport", "http-only",
        "--header", "Authorization:Bearer pk_โ€ฆ"
      ]
    }
  }
}

Config file locations: macOS ~/Library/Application Support/Claude/claude_desktop_config.json, Windows %APPDATA%\Claude\claude_desktop_config.json, Linux ~/.config/Claude/claude_desktop_config.json.

Code mode (preview)

A second endpoint, https://foundry-mcp.com/mcp/code, exposes three tools: docs (the index of the typed foundry.* API, 19 domains and 118 methods, with methods above your tier marked ๐Ÿ”’), query (runs a read-only script) and execute (runs a script with the full API). The assistant reads the index, writes a short TypeScript script and the server runs it in a QuickJS sandbox against your world, returning a trace of every call with the ids it touched. A static check refuses the script before it runs if it calls a method your tier lacks.

Same module, same key. Keep /mcp connected as well: code mode adds to the 121 tools, it does not replace them.

ClientHow to connect
Claude Codeclaude mcp add --transport http foundry-code https://foundry-mcp.com/mcp/code, then /mcp โ†’ Authenticate.
Codex CLIcodex mcp add foundry-code --url https://foundry-mcp.com/mcp/code, then codex mcp login foundry-code.
Claude (web or desktop)Settings โ†’ Connectors โ†’ Add custom connector, URL https://foundry-mcp.com/mcp/code, leave client ID and secret empty, connect.
LimitValue
Calls per script150
Writes per script150
Deletes per script30
Wall time per script60 s
CPU time per script15 s
Script result48 KB
Result of a single call256 KB
Runs per dayGuest 10, Free 30, Adventurer 100, Dungeon Master unlimited

There are no transactions. A script that fails half-way does not roll back what it already did; the trace tells you exactly what happened, and you continue from there. More on foundry-mcp.com/code.

Tiers

Access follows your Patreon membership. Counts are wire commands by the lowest tier that unlocks them.

TierPriceCommandsUnlocks
GuestPatreon account, no membership2get-world-info, roll-dice
Freefree Patreon membership+56actors, inventory and world items, folders, active effects, D&D 5e and Pathfinder 2e rolls, chat, initiative
Adventurerโ‚ฌ3 / month+16journals, roll tables
Dungeon Masterโ‚ฌ10 / month+45scenes and doors, tokens, combat, compendiums and import, world time, pause, UI helpers

A tool above your tier stays visible to the assistant; calling it returns a short message that names the required tier instead of running. Tiers are managed on Patreon. A change of membership reaches the server automatically; no new key is needed.

How it works

Foundry VTT (GM client)                foundry-mcp.com                    AI assistant
  Foundry API Bridge  โ”€โ”€ WSS โ”€โ”€โ–บ  gateway โ”€โ”€ MCP server  โ—„โ”€โ”€ HTTPS/MCP โ”€โ”€  Claude, ChatGPT, Codex, โ€ฆ
                      โ—„โ”€โ”€ WSS โ”€โ”€
  Foundry API Bridge  โ”€โ”€ WSS โ”€โ”€โ–บ  api.foundry-mcp.com    โ—„โ”€โ”€ HTTPS/REST โ”€โ”€ your own scripts and tools

The module opens two outgoing WebSocket connections, one per server, authenticated with your key. When an assistant calls a tool, or a script calls the REST API, the server relays the command over the matching connection; the module runs it in the GM's browser session and returns the result. Each key has its own isolated data on the server, and world data is not shared between users. Connection status shows as Foundry notifications; details are in the browser console under Foundry API Bridge |.

Security & privacy

  • The module starts only for the Game Master. Nothing runs on players' clients, and nothing listens for incoming connections on your machine: the module opens outgoing connections only.
  • Your world is not stored on the server. Commands pass through to your Foundry client and results go straight back. Revoke access by deleting the key.
  • Anyone who holds your key can control your world through the API. Treat it like a password.
  • The key is stored in your browser (a client-scoped setting), not in the world, so players cannot read it. Enter it once in every browser you run the GM session from. Versions before 8.12.1 kept it in the world settings; the first start after updating moves it into the browser and deletes the world copy.
  • Commands run with GM permissions. Script macros are blocked unless Allow Script Macros is on.
  • Privacy policy ยท Terms of service

Supported commands

168 wire commands. Names are what the server sends over the wire; MCP tools and REST routes map onto them. The full list, with notes on each group, is in docs/COMMANDS.md.

GroupCommandsExamples
Dice, rolls & chat13roll-dice, roll-skill, send-chat-message, export-chat
Actors9get-actors, filter-actors, create-actor-from-compendium, apply-damage
Items & inventory14get-actor-items, add-item-from-compendium, use-item
Active effects & status conditions5add-actor-effect, toggle-actor-status
Combat17start-combat, next-turn, roll-initiative, get-combat-turn-context
Tokens10move-token (A* pathfinding), get-tokens-in-range, set-token-target
Scenes, walls, doors & notes18get-scene, capture-scene, set-door-state, create-note
Journals9get-journals, create-journal-page, show-journal
Folders5get-folders, create-folder
Roll tables7roll-on-table, create-roll-table
Macros6execute-macro (script macros need Allow Script Macros; since 8.18.0 takes args and returns the macro's value)
Playlists & sounds8play-playlist, play-sound-once
Compendiums9search-compendiums, import-from-compendium, resolve-uuid
World, time & UI10get-world-info, advance-time, pause-game, ping-location
D&D 5e (dnd5e/*)12dnd5e/roll-attack, dnd5e/activate-item, dnd5e/apply-damage, dnd5e/filter-compendium-actors
Pathfinder 2e (pf2e/*)16pf2e/roll-strike, pf2e/set-condition, pf2e/cast-spell
SWADE (swade/*)10swade/roll-skill, swade/apply-damage, swade/soak
Call of Cthulhu 7e (coc7/*)11coc7/roll-skill, coc7/sanity-check, coc7/apply-damage
Pathfinder 1e (pf1/*)9pf1/roll-skill, pf1/use-item, pf1/set-condition

The core command set is system-agnostic. dnd5e/*, pf2e/*, swade/*, coc7/* and pf1/* commands require the matching game system in the world; calling one in another system returns Operation '<command>' is not supported by game system '<world>'. The bare roll-ability, roll-skill, roll-save, roll-attack, roll-damage, roll-perception, use-item and activate-item are legacy aliases of the dnd5e/* commands; apply-damage and apply-healing are aliases of dnd5e/apply-damage and dnd5e/apply-healing.

SWADE notes. Every swade/* actor command takes actorId or tokenId (+ sceneId), so one unlinked token can be hit alone. Trait rolls return every die of the pool, the kept die, the wild die and the system's raises; showInChat posts the system's own card. swade/set-status knows the 32 status ids the system registers (shaken, incapacitated, dead, aiming, berserk, wild-attack, defending, holding, bound, entangled, frightened, distracted, encumbered, prone, stunned, vulnerable, bleeding-out, diseased, heart-attack, on-fire, poisoned, cover-shield, cover, reach, torch, burrowing, flying, invisible, blind, cold-bodied, smite, protection); linked statuses such as Vulnerable for Stunned are applied by the system itself. roll-initiative and roll-all-initiative draw action cards in a SWADE world (initiative is cardValue + suitValue / 10; a Level Headed combatant gets the system's card-pick dialog on the GM's screen) and swade/get-action-cards shows the cards. swade/roll-attack consumes no ammo, and the system's range, cover and illumination modifiers apply to the GM's current targets, so target first with set-token-target. Powers and power points are read-only in swade/get-actor-summary; casting, reloading, rate of fire above 1, vehicle critical hits, chases and dramatic tasks come later.

Call of Cthulhu 7e notes. The world's system id is CoC7; the commands are coc7/*. Every actor command takes actorId or tokenId (+ sceneId). The system keeps its check classes internal, so the module rolls the d100 pool itself through Foundry's dice (bonus dice keep the lowest tens, penalty dice the highest; the success-level ranges, the Luck needed per level and the development tick follow the system's CoC7DicePool and CoC7Check) and showInChat posts the module's own card with the dice attached, not the system's card. Damage, hit points, Luck, conditions and bouts of madness go through the system's own Actor API (dealDamage, setHp, spendLuck, conditionsSet, enterBoutOfMadness); coc7/sanity-check applies the SAN loss as the system's setSan would, without the pulp spend-Luck dialog. coc7/roll-attack consumes no ammo and resolves no target; opposed and combined rolls, maneuvers, reloading, the development phase, chases and the system's own cards come later.

Pathfinder 1e notes. The world's system id is pf1; the commands are pf1/* (verified against the pf1 11.11 sources and live on Foundry 13.351, supports Foundry 12โ€“13). Every actor command takes actorId or tokenId (+ sceneId). Checks and item use go through the system's own Actor and Item API (rollSkill, rollSavingThrow, ItemPF#use, applyDamage, setConditions) with its dialogs skipped, so the system's changes, conditional modifiers, charges, spell slots and ammunition all apply; showInChat posts the system's own card. pf1/use-item rolls a full attack (every iterative) and cannot add Haste, Rapid Shot or Manyshot attacks, because the system decides those in its dialog; uses the GM's current targets (target first with set-token-target), never places a measured template and reports threats, the confirmation roll and critical damage without judging them against AC. roll-initiative and roll-all-initiative skip the system's initiative dialog. pf1 12 (Foundry 14) is refused with a clear error until its new roll API is supported. Combat maneuvers as their own command, damage reduction by type, spell preparation and resting come later.

Troubleshooting

  • The assistant says "Foundry not connected". Open the world as GM with the module enabled and a key saved, and wait for the [MCP] Connected to server notification. The message from the server tells you when it last saw your world. If the module had given up reconnecting, reload the world.
  • The status flips between Connected and Disconnected every few seconds. Two causes, and since 8.15.0 the module names the one it sees:
    • The server rejected the API key (red notification that stays until dismissed; the module stops reconnecting). The saved key is not the one foundry-mcp.com issued: a character got lost or added in the paste, the word "Copy" came along with the mouse selection, or an OAuth token was pasted instead of a key. Open Module Settings, clear the field, go to your key page on foundry-mcp.com, use the Copy button there, paste, save, reload the world. A key that is obviously not a key (no pk_ prefix, wrong characters or length) is refused on save and on load with the same red notification, before any connection is attempted. Whitespace inside the key is removed on its own.
    • Another Foundry client is connected with this API key (yellow notification; this client retries in two minutes). The server keeps one connection per key, and a second GM client with the same key, in another browser, on another device or in your host's own GM session, keeps taking over. Close the other client, or give it its own key.
  • A tool answers with a lock and a tier name. That tool is above your Patreon tier; see Tiers.
  • OAuth login fails in a CLI client. Update the client to its latest version and try again. Sign-in from Claude Code, Codex CLI, Cursor, Gemini CLI and VS Code works since 2026-09-21; before that date the authorization server rejected clients with a localhost callback.
  • 429 / rate limited. The limit is 240 requests per minute per key (Dungeon Master: twice that). Wait a minute and retry.
  • Nothing in the console. The module only starts for the GM user. Check that logging is enabled in the Configure form.
  • Connected on one computer, not on another. The key is stored per browser. Open the module settings on the other computer and paste it again.

Compatibility

Foundry VTTStatus
v14Verified
v13Verified
v12Verified
v11Minimum supported

Module version 8.20.0. The core command set works with any game system; dnd5e/*, pf2e/*, swade/*, coc7/* and pf1/* require the respective system.

Development

npm install          # Install dependencies
npm run dev          # Watch mode build
npm run build        # Production build (type-check + Vite + copy config)
npm test             # Run tests
npm run lint         # ESLint check
npm run type-check   # TypeScript check only
npm run manifest     # Restamp dist/module.json (version + download) from package.json
npm run all          # lint + test + manifest:check + build

dist/module.json is the manifest Foundry fetches from master. Its version and download are derived from package.json: npm run manifest writes them, npm run manifest:check (CI and every release) fails when the committed copy is stale. A manifest that announces one version while pointing at another release's archive makes Foundry download the same old build on every update check.

The module builds into a single ES module (dist/module.js) via Vite. Symlink dist/ into Foundry's Data/modules/foundry-api-bridge/ for local development.

Links

License

MIT

Frequently asked questions

What is Foundry Api Bridge Module MCP Server?

HTTP REST API bridge for Foundry VTT - enables external tools to access world data

How do I install Foundry Api Bridge Module MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. Foundry Api Bridge Module MCP Server connects to the remote endpoint https://foundry-vtt-code--ai-nitromoon.run.tools/, so there is nothing to install locally.

Is Foundry Api Bridge Module MCP Server free and open source?

Yes. Foundry Api Bridge Module MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does Foundry Api Bridge Module MCP Server support remote (HTTP) connections?

Yes. Foundry Api Bridge Module MCP Server offers a hosted endpoint over Streamable HTTP, so HTTP-capable clients can connect to it without running anything locally.

What tools does Foundry Api Bridge Module MCP Server provide?

Foundry Api Bridge Module MCP Server provides 3 tools: docs, execute, and query. See the full tool list for descriptions and parameters.

How is Foundry Api Bridge Module MCP Server's trust score calculated?

Foundry Api Bridge Module MCP Server scores 45 out of 100 (Fair). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

โ€”Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server