FoundryVTT MCP Server
Provides comprehensive read and write access to a Foundry Virtual Tabletop world, enabling AI assistants to act as Co-GMs by managing actors, items, tokens, combat encounters, canvas placeables (walls, lights, sounds, templates, drawings, notes, tiles), scenes, playlists, macros, roll tables, compendiums, and world settings.
Click on "Install 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., "@FoundryVTT MCP ServerRoll a stealth check for the rogue with advantage and show the result in chat."
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.
FoundryVTT MCP Server
A comprehensive, production-grade Model Context Protocol (MCP) server for Foundry Virtual Tabletop (FoundryVTT).
This server empowers AI assistants (Claude Desktop, Claude Code, Oh My Pi, VS Code, Cursor, etc.) to act as fully capable, autonomous Co-GMs and GM assistants inside FoundryVTT. It provides complete read and write access across game mechanics, actors, items, tokens, combat encounters, canvas placeables (walls, lights, sounds, templates, drawings, notes, tiles), playlists, macros, roll tables, compendiums, world settings, and live canvas rendering.
π Key Highlights & Capabilities (111 Tools)
ποΈ Real-Time Event Stream & Activity Log (
watch_events): Zero-polling event awareness via Socket.IOmodifyDocumentand companion bridge pushes. An AI DM agent can long-poll on a cursor-addressed stream (cursor,waitMs,excludeSelf,types,sceneId) to react instantly when players chat, move tokens, advance combat, toggle doors, or select targets.π² Game Mechanics & Interactive Chat: Roll dice with standard or complex drop/keep notation (
4d6kh3,1d20r1). Roll and post interactive, clickable chat cards directly to the Foundry chat log via the companion bridge (roll_and_post).πΊοΈ Full Canvas & Spatial Control: Create, inspect, update, and remove all canvas placeable types:
Scene Regions (v12+):
create_region,delete_region,list_regionswith geometric shapes (rectangle,circle,ellipse,polygon) and automated trigger behaviors.Walls & Doors: standard, doors (open/close/lock), secret doors, windows, ethereal walls, and custom coordinates (
create_wall,list_walls,set_door_state).Ambient Lights: coordinate or grid-cell placement, dim/bright radii, animation effects, color thresholds (
create_light,update_light,delete_light,list_lights).Ambient Sounds: audio tracks, radii, volume, repeat modes (
create_sound,delete_sound,list_sounds).Measured Templates: cone, circle, ray, and rect spell area-of-effect markers with directional rotation and colors (
create_template,delete_template,list_templates).Drawings: freehand and geometrical shapes, stroke/fill styling, and text annotations (
create_drawing,delete_drawing,list_drawings).Map Notes & Pins: landmark markers linked to journal entries or standalone labels (
create_note,delete_note,list_notes).Tiles & Props: place decorative tiles and backgrounds (
create_tile,delete_tile,list_tiles).Canvas Viewport Capture: screenshot the GM canvas viewport with a burned-in coordinate grid overlay (
[col,row]) viacapture_scene.Targeting & Animated Pings: focus player attention with animated camera pings (
ping_canvas) and view/set token targeting reticles (set_target,get_targets).
π§ Token & Actor Control:
A* Pathfinding Movement: tokens navigate around walls and automatically open closed doors along their path (
move_token_pathfind).Token Vision & Lighting: configure sight ranges, vision modes, dim/bright emitted light, and vision detection angles (
update_token_vision).Generalized ActiveEffects: create, update, delete, and inspect mechanical buffs/debuffs with attribute changes (
key,mode,value,priority) and durations (rounds,seconds,turns) on top-level or synthetic unlinked token actors (create_actor_effect,update_actor_effect,delete_actor_effect,list_actor_effects).Status Conditions: apply/remove system-agnostic status conditions (
apply_status_effect).Compendium Actor & Item Import: import entire NPC/monster documents from compendium packs with automatic per-item error recovery (
import_compendium_actor), or import specific items into actor inventories (create_actor_item).System Attribute Mutations: patch actor system data (HP, temporary HP, currency, resources, spell slots) using JSON merge patches (
update_actor_attributes).
βοΈ Combat Encounter Management: Create encounters, seed combatants from tokens, manage initiative orders, advance turns/rounds, track active combatants, pause/unpause the game clock (
set_pause), and end encounters.π World Documents & Organization:
Folders: manage hierarchical folder structures for actors, items, journals, and scenes (
create_folder,list_folders).Macros: inspect, create, and delete script/chat macros (
create_macro,list_macros,delete_macro).Playlists & Audio: create multi-track playlists, control playback (play, pause, stop), and adjust track states (
create_playlist,set_playlist_state,list_playlists).Roll Tables: create tables with automatic sequential range distribution (
1dN), and draw live results (create_roll_table,roll_table,list_roll_tables).Document Ownership & User Roles: configure granular document permissions (
set_document_ownership) and user roles with self-demotion lockout guards (set_user_role).World Settings: safely inspect and update module and system settings with built-in protection against core engine corruption (
get_world_setting,set_world_setting).Asset Uploads: upload images, tokens, and audio directly into Foundry's
Data/storage via native FilePicker or local filesystem (upload_asset).
π«οΈ Scene, Weather & Exploration Management: Switch active scenes, adjust darkness levels, toggle global illumination, set environmental weather effects (
set_scene_weather), and reset Fog of War exploration (reset_fog).π Rules & Compendium Search: Search world documents, compendium packs, and rule text with contextual snippets (
search_compendium_content,lookup_rule).
Related MCP server: Foundry VTT MCP Bridge
ποΈ Architecture
The server employs a hybrid architecture to deliver real-time responsiveness and deep game-engine integration:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Assistant / MCP Client β
β (Claude Desktop, Oh My Pi, VS Code) β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β MCP (stdio)
ββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β FoundryVTT MCP Server β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ€
β In-Memory World Cache β A* Pathfinding Router β
β (Live Socket.IO Sync) β Dice Notation Engine β
ββββββββββββββββ¬ββββββββββββββββ΄βββββββββββββββ¬ββββββββββββββββ
β Socket.IO (Port 30000) β WebSocket (Port 31415)
β (modifyDocument / Events) β (Bridge Protocol)
ββββββββββββββββΌβββββββββββββββββββββββββββββββΌββββββββββββββββ
β FoundryVTT Game Engine β
β ββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
β β Active World & Data β β Companion Module β β
β β (Actors, Scenes, β¦) β β (foundryvtt-mcp-bridge)β β
β ββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββSocket.IO Primary Connection: Connects to FoundryVTT as an authenticated user (
mcp-api). Automatically synchronizes and caches the world state, enabling instant lookups and high-frequency document mutations via themodifyDocumentprotocol.Companion Module Bridge (
foundryvtt-mcp-bridge): A lightweight Foundry module running in the browser that executes canvas-bound operations (PIXI canvas screenshot with grid overlay, nativeRollchat card rendering, document schema introspection, and compendium item extraction).Optional REST API Module: Provides server diagnostics, log retrieval, and health reporting when the local REST module is installed.
π Quick Start
1. Prerequisites
Node.js 18+ or Bun
FoundryVTT v11+ / v12+ running an active world
A dedicated Foundry user account with Gamemaster or Assistant GM role
2. Configure Dedicated Foundry User
In FoundryVTT:
Open Configuration β User Management
Click Create User
Set Username:
mcp-api, Password:mcp(or your choice)Role: Gamemaster (or Assistant GM with write permissions enabled)
3. Install the Companion Module (Recommended)
Copy the foundry-module folder from this repo to your FoundryVTT Data/modules/ directory:
# Windows
cp -r foundry-module "%LOCALAPPDATA%/FoundryVTT/Data/modules/foundryvtt-mcp-bridge"
# macOS
cp -r foundry-module "~/Library/Application Support/FoundryVTT/Data/modules/foundryvtt-mcp-bridge"
# Linux
cp -r foundry-module "~/.local/share/FoundryVTT/Data/modules/foundryvtt-mcp-bridge"In FoundryVTT, go to Manage Modules and enable FoundryVTT MCP Bridge.
βοΈ Configuration & Client Setup
Environment Variables
Variable | Required | Default | Description |
| Yes |
| FoundryVTT server URL |
| Yes | β | FoundryVTT user account name |
| Yes | β | FoundryVTT user account password |
| No |
| Enables game-state mutations (walls, actors, tokens, etc.) |
| No |
| Enables WebSocket bridge for canvas screenshots & chat rolls |
| No |
| WebSocket port for the companion module bridge |
| No | β | Local path to Foundry |
| No | β | Optional REST API key for server diagnostics tools |
| No |
| In-memory event log ring buffer capacity |
| No |
| Default long-polling timeout for |
| No |
| Logging verbosity ( |
Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"foundryvtt": {
"command": "node",
"args": ["<PATH_TO_REPO>/dist/index.js"],
"env": {
"FOUNDRY_URL": "http://localhost:30000",
"FOUNDRY_USERNAME": "mcp-api",
"FOUNDRY_PASSWORD": "mcp",
"FOUNDRY_WRITE_ENABLED": "true",
"FOUNDRY_MODULE_BRIDGE_ENABLED": "true",
"FOUNDRY_MODULE_BRIDGE_PORT": "31415"
}
}
}
}Oh My Pi Configuration
Add to ~/.omp/agent/mcp.json (or ~/.omp/mcp.json):
{
"mcpServers": {
"foundryvtt": {
"type": "stdio",
"command": "node",
"args": ["<PATH_TO_REPO>/dist/index.js"],
"env": {
"FOUNDRY_URL": "http://localhost:30000",
"FOUNDRY_USERNAME": "mcp-api",
"FOUNDRY_PASSWORD": "mcp",
"FOUNDRY_WRITE_ENABLED": "true",
"FOUNDRY_MODULE_BRIDGE_ENABLED": "true",
"FOUNDRY_MODULE_BRIDGE_PORT": "31415"
},
"timeout": 60000
}
}
}π οΈ Tool Catalog (111 Tools)
1. Real-Time Event Awareness
watch_eventsβ long-poll a cursor-addressed activity log (cursor,waitMs,limit,kinds,types,actions,sceneId,excludeSelf) capturing document broadcasts and canvas activity without polling.
2. Canvas & Spatial Placeables
create_region/delete_region/list_regionsβ manage Scene Regions (v12+) with geometric shapes (rectangle,circle,ellipse,polygon) and automated behaviors.create_wall/delete_wall/list_walls/set_door_stateβ complete wall and door geometry management.create_light/update_light/delete_light/list_lightsβ ambient lighting control (radii, colors, animations).create_sound/delete_sound/list_soundsβ ambient audio placement on canvas scenes.create_template/delete_template/list_templatesβ spell and effect area-of-effect templates.create_drawing/delete_drawing/list_drawingsβ map shapes, zones, and text annotations.create_note/delete_note/list_notesβ map pins and landmark markers.create_tile/delete_tile/list_tilesβ decorative tiles and map props.capture_sceneβ screenshot the active scene canvas with a grid coordinate overlay burned in.ping_canvasβ emit an animated canvas ping at specific pixel coordinates.find_open_cellsβ scan scenes for unblocked grid cells suitable for token/prop placement.list_scene_assetsβ discover map backgrounds, token art, and audio files with parsed tags and dimensions.upload_assetβ upload image/audio files into Foundry'sData/directory via FilePicker or local filesystem.
3. Tokens & Movement
spawn_tokenβ place actor tokens on scenes with custom size, elevation, and coordinates.delete_tokenβ remove tokens from scenes without deleting the underlying actor.list_tokensβ list placed tokens on active or specific scenes.move_tokenβ teleport a token to exact pixel coordinates.move_token_pathfindβ move tokens using A* obstacle avoidance around walls with automatic door opening.move_tokensβ batch move multiple tokens simultaneously.set_target/get_targetsβ set and inspect token targeting reticles across connected users.update_token_visionβ configure vision ranges, vision modes, dim/bright emitted lights, and angles.apply_status_effectβ toggle simple status conditions (prone,stunned,blinded,invisible, etc.).
4. Actors & Inventory
create_world_actor/create_full_actor/delete_world_actorβ create and delete actor documents.import_compendium_actorβ import entire NPCs/monsters from compendium packs with embedded items and automatic error recovery.search_actorsβ query actors by name and type with cursor pagination support.get_actor_detailsβ retrieve actor system data, statistics, attributes, and health.update_actor_attributesβ patch nested system data using dot paths (attributes.hp.value,currency.gp).get_actor_inventoryβ list owned items with full system properties.create_actor_itemβ create inline items OR import directly from compendium packs (source: { type: 'compendium', compendiumId, itemId }).update_actor_itemβ apply JSON merge patches to owned items.delete_actor_itemβ delete specific items from actor inventories.create_actor_effect/update_actor_effect/delete_actor_effect/list_actor_effectsβ general-purpose ActiveEffects with mechanical changes (key,mode,value,priority) and durations on top-level or synthetic unlinked token actors.
5. Combat Encounters
start_combatβ create encounters and seed combatants from scene tokens.get_combat_stateβ retrieve combatant turn order, HP, AC, and round number.set_initiativeβ set combatant initiative values and re-order turns.next_turnβ advance the turn tracker (handles round increments and skips defeated combatants).set_pauseβ pause or unpause the game clock.end_combatβ terminate active encounters.
6. World Documents & Organization
list_folders/create_folderβ organize actors, items, journals, and scenes in nested folders.list_macros/create_macro/delete_macroβ manage script and chat macro documents.list_playlists/create_playlist/set_playlist_state/delete_playlistβ audio playlist and sound controls.create_roll_table/delete_roll_table/roll_table/list_roll_tablesβ table creation and result rolling.get_world_setting/set_world_settingβ inspect and modify system/module settings with core protection.set_document_ownershipβ configure granular document permissions (none,limited,observer,owner).get_users/set_user_roleβ list connected users and change permission roles with self-demotion lockout guards.create_journal_entry/get_journal/search_journals/delete_journal_entryβ manage session notes and lore.
7. Scene, Weather & Exploration
create_scene/delete_scene/get_scene_info/switch_sceneβ scene creation and player activation.set_scene_weatherβ set or clear weather effects (rain,snow,fog,"").set_scene_lightingβ ambient darkness levels and global illumination settings.reset_fogβ reset Fog of War exploration on active scenes.
8. Game Mechanics & Bridge Tools
roll_diceβ local mathematical dice formula evaluation.roll_and_postβ evaluates formulas via Foundry's native engine and posts interactive chat cards.lookup_ruleβ search world journals and system compendium packs for rules with snippet previews.get_document_schemaβ introspect game system DataModel schemas for actor and item types.search_compendium_contentβ deep search inside compendium pack documents and journal pages.send_chat_message/get_chat_messagesβ post and read messages from the Foundry chat log.generate_npc/generate_lootβ instant procedural generators.
9. Diagnostics & Logging
get_health_status/get_system_healthβ connection and server health metrics.get_recent_logs/search_logsβ inspect server logs and error stack traces.diagnose_errorsβ analyze recent errors into prioritized resolution suggestions.refresh_world_dataβ force a re-fetch of the cached world state snapshot.
π§ͺ Development & Testing
# Install dependencies
npm install
# Compile TypeScript
npm run build
# Run complete unit test suite (713 tests)
npm test
# Run linter and formatting checks
npm run lint
# Start server in development watch mode
npm run devπ License
This project is licensed under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA Model Context Protocol server that integrates with FoundryVTT, allowing AI assistants to interact with tabletop gaming sessions through natural language to query actors, roll dice, generate content, and manage game worlds.23929MIT
- 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.66
- FlicenseNot gradedqualityNot gradedmaintenanceIntegrates with FoundryVTT tabletop gaming sessions, allowing AI assistants to query game data, roll dice, generate content (NPCs, loot, encounters), manage combat, and provide tactical suggestions through natural language.12
- FlicenseNot gradedqualityAmaintenanceEnables AI-powered campaign management for Foundry Virtual Tabletop through natural language, supporting multiple RPG systems with tools for quest creation, character management, combat resolution, and more.
Related MCP Connectors
Manage TTRPG campaigns: NPCs, locations, factions, quests, sessions, lore, and knowledge graphs.
MCP server for Argo RPG Platform β connects AI assistants to campaign data via OAuth2
Official remote MCP server for Archivist AI TTRPG campaign memory: characters, sessions, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/RN0000/foundryvtt-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server