Foundry REST API MCP
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., "@Foundry REST API MCPstart combat in the current scene"
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 REST API MCP
A Model Context Protocol server for preparing Foundry worlds and running encounters through the FoundryVTT REST API Relay.
Included tools
World content — list worlds, inspect structure and entities, search, and create, update, or delete entities and folders.
Scenes and canvas — create, update, delete, and switch scenes; manage tokens, walls, lights, tiles, drawings, sounds, notes, templates, and regions.
Encounters and effects — start/end combat, control turns and rounds, change combatants, and manage active effects.
Table play — roll dice, read and write chat, select or move tokens, and measure distances.
All tools are named foundry_*; use the MCP tool list for their typed parameters. Commands that change the world carry readOnlyHint: false; destructive deletions and chat clearing also carry destructiveHint: true.
This compact server intentionally excludes D&D5e-specific actions, files, users, sessions, macros, playlists, arbitrary JavaScript, authentication management, and SSE/WebSocket subscriptions.
Related MCP server: FoundryMCP
Requirements
Node.js 20 or newer
A paired
foundry-rest-apimodule and relayA scoped API key with the required relay permissions:
clients:read,structure:read,structure:write,entity:read,entity:write,search,scene:read,scene:write,canvas:read,canvas:write,encounter:read,encounter:manage,effects:read,effects:write,roll:read,roll:execute,chat:read, andchat:write
Install in Codex directly from GitHub
Add the following to your user-level ~/.codex/config.toml:
[mcp_servers.foundry]
command = "npx"
args = [
"--yes",
"github:zagushka/foundry-rest-api-mcp#v0.2.0"
]
[mcp_servers.foundry.env]
FOUNDRY_REST_API_BASE_URL = "http://localhost:3011"
FOUNDRY_REST_API_KEY = "replace-with-a-scoped-secret"
# Optional. Omit when the key is bound to exactly one Foundry world.
# FOUNDRY_CLIENT_ID = "fvtt_..."Restart Codex after changing its configuration. Codex starts the stdio server automatically; do not start it separately.
To inherit values already present in the environment instead of writing them in config.toml, replace the [mcp_servers.foundry.env] table with:
[mcp_servers.foundry]
command = "npx"
args = [
"--yes",
"github:zagushka/foundry-rest-api-mcp#v0.1.0"
]
env_vars = [
"FOUNDRY_REST_API_BASE_URL",
"FOUNDRY_REST_API_KEY",
"FOUNDRY_CLIENT_ID"
]The Git tag pins the installed version. Change v0.2.0 when upgrading to a newer release.
Optional global installation
npm install --global github:zagushka/foundry-rest-api-mcp#v0.2.0After that, configure Codex with:
[mcp_servers.foundry]
command = "foundry-rest-api-mcp"
[mcp_servers.foundry.env]
FOUNDRY_REST_API_BASE_URL = "http://localhost:3011"
FOUNDRY_REST_API_KEY = "replace-with-a-scoped-secret"Local development
git clone https://github.com/zagushka/foundry-rest-api-mcp.git
cd foundry-rest-api-mcp
npm ci
npm testFor manual local runs, copy .env.example to .env, fill in the values, then run:
npm run build
npm run start:envThis is a stdio MCP server. It waits for an MCP client and does not open an HTTP port.
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
- Flicense-qualityAmaintenanceConnects 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.Last updated66
- Alicense-qualityBmaintenanceEnables direct interaction with FoundryVTT virtual tabletop servers via native WebSocket protocol. Supports retrieving, creating, modifying, and deleting game documents like actors, items, scenes, and journal entries without requiring additional modules.Last updated46MIT
- Flicense-quality-maintenanceIntegrates 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.Last updated4
- Flicense-qualityAmaintenanceEnables 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.Last updated
Related MCP Connectors
Manage TTRPG campaigns: NPCs, locations, factions, quests, sessions, lore, and knowledge graphs.
D&D 5e MCP — wraps the D&D 5th Edition API (free, no auth)
Control Unreal Engine to browse assets, import content, and manage levels and sequences. Automate…
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/zagushka/foundry-rest-api-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server