foundryvtt
A Model Context Protocol (MCP) server that integrates with FoundryVTT, allowing AI assistants to interact with your tabletop gaming sessions. Query actors, roll dice, generate content, and manage your game world through natural language.
claude mcp add --transport stdio laurigates-foundryvtt-mcp node server.js \ --env FOUNDRY_URL="URL to the FoundryVTT server" \ --env FOUNDRY_PASSWORD="FoundryVTT password for API access" \ --env FOUNDRY_USERNAME="FoundryVTT user for API access"
How to use
This MCP server integrates FoundryVTT with AI assistants, enabling natural language interactions with your tabletop sessions. It exposes a set of tools to query game data, manage the world state, perform dice rolls, and generate content, all through MCP client prompts. Typical use cases include asking the AI to roll dice with expressions like 2d6+3, search for NPCs in the current scene, retrieve journal entries, check combat initiative, or generate a random NPC merchant. The server also provides world-wide search capabilities and data access via FoundryVTT data endpoints (foundry:// URIs) for direct data access by MCP clients.
To use the tools, connect your MCP client to the server and invoke the available commands. For example, you can request search_actors to locate characters, get_actor_details for specific attributes, search_items for equipment or spells, or roll_dice with a formula. The World section lets you refresh data or view a summary of the current world state, while Game Mechanics includes lookup_rule for rules and spell descriptions. For content creation, you can generate_npc or generate_loot to produce assets on the fly. Diagnostics (when enabled with the REST API module) allows monitoring logs and health metrics.
How to install
Prerequisites:
- Node.js 18+ installed on your machine
- Access to a running FoundryVTT server with an active world
- A suitable MCP-compatible AI client
Installation steps:
- Clone the repository git clone <repository-url>
- Install dependencies cd foundry-mcp-server npm install
- Run the interactive setup wizard to detect FoundryVTT and generate configuration
npm run setup-wizard
- The wizard will attempt to locate your FoundryVTT server, test connectivity, and create a .env file with the necessary values.
- (Optional) Manually configure environment variables Copy .env.example to .env and set: FOUNDRY_URL, FOUNDRY_USERNAME, FOUNDRY_PASSWORD
- Build and start the server npm run build npm start
- Verify connectivity Use npm run test-connection or the diagnostics tools once REST API module is enabled
Additional notes
Tips and commonly used guidance:
- The server exposes FoundryVTT data via foundry:// URIs (e.g., foundry://actors, foundry://scenes) for quick data access by MCP clients.
- Diagnostics tools require the REST API module; ensure it is installed and configured if you need get_recent_logs, get_system_health, or diagnose_errors.
- Keep your FoundryVTT URL and credentials secure. Use environment variables to avoid embedding secrets in code.
- If you encounter connection issues, re-run the setup wizard or consult TROUBLESHOOTING.md for common problems and steps.
- The environment supports live world state on connect via Socket.IO; expect a full world state payload when clients establish a connection.
Related MCP Servers
obsidian -tools
Add Obsidian integrations like semantic search and custom Templater prompts to Claude or any MCP client.
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
mcp -arangodb
This is a TypeScript-based MCP server that provides database interaction capabilities through ArangoDB. It implements core database operations and allows seamless integration with ArangoDB through MCP tools. You can use it wih Claude app and also extension for VSCode that works with mcp like Cline!
CodeRAG
Advanced graph-based code analysis for AI-assisted software development
mcp-bundler
Is the MCP configuration too complicated? You can easily share your own simplified setup!