Foundry MCP Server
Provides a permissioned, multi-world MCP interface to Foundry Virtual Tabletop v14, enabling discovery and management of documents, actors, items, scenes, compendiums, images/assets, journal sessions, and background intelligence through a GM-authorized browser companion.
Optional integration with OpenAI Images for generating images, activated by an explicit provider key and ai:network grant.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Foundry MCP ServerCan you list the scenes in my current world?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Foundry MCP Server
A Windows-first Model Context Protocol server for Foundry Virtual Tabletop v14. It gives an MCP client a permissioned, multi-world view of Foundry through a local Windows host and a GM-authorized browser companion. Docker-hosted Foundry uses the same browser companion and Windows host; only the module-install path changes to the container's writable User Data bind mount.
What it can do
Area | MCP capabilities | Important boundary |
Connections | Enumerate connected worlds and require an explicit | A successful empty list proves transport, not a live Foundry connection. |
Objects | Discover document types and every runtime Actor/Item subtype; list, get, dry-run, create, and update root, embedded, or writable compendium documents; enumerate Scenes, RollTables, Playlists, Cards, Macros, and unknown system fields. | Foundry permissions and explicit host capability grants both apply; locked or non-writable packs fail closed. |
Images/assets | Enumerate FilePicker sources, broad image formats, and image references; upload validated images; generate deterministic images or opt in to OpenAI Images; attach a destination-writable asset to a document. | Local files are denied until an absolute root is allowlisted. Remote imports are SSRF-filtered. There is no public delete tool. |
Journal sessions | Start, append to, list, and read idempotent JournalEntry/JournalEntryPage-backed sessions with links and attribution. | Session mutations require separate grants. |
Background intelligence | Capture permitted events, reconcile pre-existing world state, search/timeline/changed-since, build bounded context packs, and expose provenance/status. | Private-content capture defaults off; restricted Actor, Item, and Journal content is filtered by default. |
MCP surface | 27 tools, five enumerable | Prompt text grants no mutation authority. See the generated-surface reference for exact schemas. |
Related MCP server: foundry-cli
Start here
Windows quick start — build the module ZIP, install and pair it, run the host, grant capabilities, and configure an MCP client.
Claude Code, Codex, and Cursor setup — instantiate the source checkout and register its stdio adapter in each supported MCP client.
Docker-hosted Foundry — use a writable User Data bind mount with the checked-in Compose example or overlay.
Configuration, privacy, and providers — typed settings, precedence, safe defaults, and opt-in provider setup.
Tools, resources, and prompts — the exact public MCP surface.
Architecture and threat model — trust boundaries and failure modes.
Validation matrix — deterministic evidence versus live/manual gaps.
Runtime shape
MCP client
-> stdio adapter
-> current-logon Windows named pipe
-> local Windows host + SQLite intelligence store
-> authenticated loopback ws:// bridge (or reviewed wss:// proxy)
-> GM browser companion
-> Foundry public APIs and FilePicker providersThe companion authenticates with a per-user DPAPI-protected pairing secret and an HMAC challenge. The host binds its browser bridge to loopback and checks the exact Foundry page Origin. Docker does not require the Docker socket and does not move desktop secrets into the container.
Build from source
Requirements are Windows 10/11, Node.js 22+, pnpm 9.15.0, and PowerShell 7 (Windows PowerShell 5.1 is also exercised for the setup scripts).
pnpm install --frozen-lockfile
pnpm build
pnpm typecheck
pnpm lintThe CLI package exposes the foundry-mcp executable when installed or linked. In a source checkout, create a session-local command after building:
$FoundryMcpCli = (Resolve-Path -LiteralPath .\packages\cli\dist\bin.js).Path
function foundry-mcp { & node $FoundryMcpCli @args }Then create the loadable Foundry module directory and versioned ZIP:
foundry-mcp build-module --output .\releaseThe builder packages only module.json and the self-contained browser bundle. Continue with the Windows or Docker guide instead of copying package build directories into Foundry by hand.
Security and privacy defaults
Configuration precedence is built-in defaults < JSON config < environment < CLI flags.
The checked-in config example uses a stable loopback port, exact Origins, 30-day event retention, private-content capture off, and an empty
localAssetRootsdenylist.Pairing and provider credentials are accepted outside command-line arguments and protected with current-user DPAPI on the Windows production path.
Mutations are denied until explicitly granted per connection, Foundry role, and capability; denials and committed outcomes are audit logged with secret redaction.
Deterministic image generation is local. OpenAI Images is optional, requires an explicit provider key and
ai:networkgrant, and sends credentials only to the official HTTPS Images endpoint.
Development
pnpm test
pnpm test:e2eTests use fake Foundry globals, real local pipe/WebSocket transports where noted, and no redistributed Foundry code. A licensed Foundry desktop/container, real browser TLS route, external provider call, and cross-user Windows account test remain manual evidence boundaries; do not describe mock coverage as a live Foundry pass.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any AI to your Foundry VTT world: actors, combat, dice, journals, tokens, compendiums.
Official remote MCP server for Archivist AI TTRPG campaign memory: characters, sessions, and more.
Manage your tabletop RPG campaign from any MCP client: worlds, sessions, quests, lore, recaps.
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceConnects Claude Desktop to Foundry VTT for AI-powered campaign management, enabling natural language interaction with game data including quest creation, character management, compendium searches, and dice rolling. Provides 20 MCP tools for seamless integration between Claude and your tabletop RPG sessions.70-
- FlicenseAqualityDmaintenanceMCP server for managing Foundry VTT journal content (entries, categories, pages) and listing actors, enabling AI-assisted world-building via natural language commands.11-
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to interact with Foundry Virtual Tabletop, supporting reading world data, managing combat, rolling dice, and updating actor attributes via a sidecar architecture.42 npmMIT
- AlicenseCqualityAmaintenanceEnables preparing Foundry worlds and running encounters through the FoundryVTT REST API Relay, with tools for managing worlds, scenes, encounters, and table play.53MIT