foundry-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
foundry-mcp
An MCP server that lets AI assistants (Claude, Codex, Gemini CLI, Cursor and other MCP clients) read your Foundry VTT v14 world: actors, scenes, journals and compendiums. Write tools are coming next; see the implementation guide.
It runs as a small Node service next to Foundry. It logs in as a dedicated Foundry user, the same way a browser does, so no browser tab has to stay open.
Tools
Tool | What it returns |
| Actors, items, journals, scenes, roll tables and playlists whose name contains some text |
| One actor, with its system data and item list |
| One scene: background, size and tokens |
| One journal entry, with the plain text of its pages |
| The world's compendium packs, or the documents in one pack |
Related MCP server: FoundryVTT MCP Server
Requirements
Foundry VTT 14.x, with a world that launches at startup. The server can only connect while a world is running. Use
--world <id>, orFOUNDRY_WORLD=<id>with the felddy/foundryvtt image.A Foundry user for the server. In your world, go to Configure Players and add a user (for example
Claude) with a strong password. The Gamemaster role gives full access; a lower role limits what the AI can see and change.Docker, or Node.js 22+.
For claude.ai and Claude Desktop: a public HTTPS URL for the server, provided by a reverse proxy such as Caddy, nginx, Traefik or Cloudflare Tunnel. Local clients can use
http://localhost.
Run it
git clone https://github.com/PiotrMieszczak/foundry-mcp.git
cd foundry-mcp
cp .env.example .envFill in .env:
Variable | Meaning |
| Where clients reach this server, without |
| Turns on OAuth. This is the password you type on the sign-in page when a client connects. Required for claude.ai and Claude Desktop. |
| Turns on a static |
| Foundry as seen from this server (for example |
| Foundry's own public URL. Foundry rejects logins without it. |
| The Foundry user the server logs in as |
| Where OAuth registrations and hashed tokens are kept ( |
Set at least one of OWNER_PASSWORD and API_TOKEN. Generate them with openssl rand -base64 32.
With Docker Compose, next to a Foundry container on the network foundry-net:
docker network create foundry-netdocker network connect foundry-net <your-foundry-container>mkdir -p data && sudo chown 1000:1000 datadocker compose up -d --buildThe server listens on port 3000. Point your HTTPS proxy at it.
Without Docker:
npm cinpm run buildset -a; . ./.env; set +a; node packages/mcp-server/dist/main.jsCheck it:
curl http://localhost:3000/healthzset -a; . ./.env; set +a; npm run smoke -w @foundry-mcp/mcp-serverThe health check prints ok. The smoke test logs in to Foundry and prints how many actors, scenes and packs it found.
Connect your AI client
In the examples below, replace https://mcp.example.com/mcp with your PUBLIC_URL plus /mcp, and YOUR_API_TOKEN with your API_TOKEN. Each client can sign in with OAuth, which opens a browser where you enter OWNER_PASSWORD, or with the static token sent as a header.
Claude (claude.ai and Claude Desktop)
Custom connectors are set up on claude.ai and appear in Claude Desktop and mobile too. (docs)
On a personal plan, open Customize → Connectors → + Add → Add custom connector. On Team or Enterprise, an owner adds it under Organization settings → Connectors.
Enter a name (
Foundry) and the URLhttps://mcp.example.com/mcp.Choose Sign in (OAuth) and enter
OWNER_PASSWORDon the page that opens. Alternatively, putAuthorization: Bearer YOUR_API_TOKENunder Request headers.
The server must be reachable from the internet over HTTPS. claude_desktop_config.json only runs local stdio servers, so use connectors for this one.
Claude Code
(docs)
With OAuth: add the server, then run /mcp in Claude Code and sign in.
claude mcp add --transport http foundry https://mcp.example.com/mcpWith the static token:
claude mcp add --transport http foundry https://mcp.example.com/mcp --header "Authorization: Bearer YOUR_API_TOKEN"Add --scope user to make the server available in every project. When a header is set, Claude Code uses it instead of OAuth.
OpenAI Codex (CLI, IDE extension, ChatGPT desktop)
All three read ~/.codex/config.toml. (docs)
With OAuth:
codex mcp add foundry --url https://mcp.example.com/mcpcodex mcp login foundryWith the static token, kept in an environment variable:
[mcp_servers.foundry]
url = "https://mcp.example.com/mcp"
bearer_token_env_var = "FOUNDRY_MCP_TOKEN"export FOUNDRY_MCP_TOKEN=YOUR_API_TOKENGemini CLI
(docs)
gemini mcp add --transport http -s user foundry https://mcp.example.com/mcp --header "Authorization: Bearer YOUR_API_TOKEN"Or edit ~/.gemini/settings.json by hand. Use httpUrl (Streamable HTTP), not url (SSE):
{
"mcpServers": {
"foundry": {
"httpUrl": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer YOUR_API_TOKEN" }
}
}
}For OAuth, leave out headers, start Gemini CLI, and run /mcp auth foundry.
Cursor
Add the server to ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project). (docs)
{
"mcpServers": {
"foundry": {
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer ${env:FOUNDRY_MCP_TOKEN}" }
}
}
}Leave out headers to sign in with OAuth instead.
Other clients
Any client that supports remote MCP servers over Streamable HTTP works the same way: give it the URL, plus either OAuth or an Authorization: Bearer header. For example, VS Code with GitHub Copilot uses mcp.json with "type": "http" (docs).
Running everything locally
If your client and the server run on the same machine, skip HTTPS. Set PUBLIC_URL=http://localhost:3000 and API_TOKEN, then use http://localhost:3000/mcp with the header. claude.ai custom connectors can't reach localhost, so they need a public HTTPS URL.
Security
Anyone holding a valid token acts as your Foundry user. Keep
OWNER_PASSWORD,API_TOKENand.envsecret, use HTTPS, and give the Foundry user only the role it needs.OAuth sign-in locks for 15 minutes after five wrong passwords. Tokens are stored hashed.
Never put a token in a URL. Send it as a header.
Development
npm cinpm testdocs/IMPLEMENTATION.md covers the design, the Foundry protocol and the planned stages: widgets, then write tools.
Licence
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any AI to your Foundry VTT world: actors, combat, dice, journals, tokens, compendiums.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
D&D and TTRPG campaign manager for GMs: your AI reads and writes a live, typed campaign database.
Read-only search of 2,189 AI agent tools (MCP servers, x402 APIs) with daily automated trust scores.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides AI assistants with tools to query and explore the Azgaarnoth D\&D world repository, including searching content, retrieving stat blocks, spells, and browsing categories like races, classes, nations, and creatures across ~4,200 markdown files.-
- 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.7 npm-
- AlicenseNot gradedqualityFmaintenanceEnables 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.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to interact with Foundry Virtual Tabletop, supporting reading world data, managing combat, rolling dice, and updating actor attributes via a sidecar architecture.46 npmMIT