TF

thestranjer/foundry-vtt-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 6 forks 质量 69 趋势 29

A lightweight MCP (Model Context Protocol) server for FoundryVTT that communicates directly via WebSockets.

概览

A lightweight MCP (Model Context Protocol) server for FoundryVTT that communicates directly via WebSockets. Unlike other FoundryVTT MCP servers that require: - Installing a custom module on your Foundry server - Running a headless browser This server with FoundryVTT and exchanges WebSocket messages directly using the same protocol as the official Foundry client. This makes it: - - No browser overhead, just direct WebSocket communication - - No modules to install on your Foundry instance - - Uses the same authentication flow as the official client Works with . The server detects the Foundry generation automatically (via GET /api/status) and uses the correct session-binding method for that version — v14 changed how the WebSocket session is authenticated, and both are handled transparently with no configuration needed. Grant that user only the permissions you want the MCP server to have.

README

以下为原文 README 节选,完整内容请查看原文。

FoundryMCP

A lightweight MCP (Model Context Protocol) server for FoundryVTT that communicates directly via WebSockets.

Why This Server?

Unlike other FoundryVTT MCP servers that require:

  • Installing a custom module on your Foundry server
  • Running a headless browser

This server natively authenticates with FoundryVTT and exchanges WebSocket messages directly using the same protocol as the official Foundry client. This makes it:

  • Lightweight - No browser overhead, just direct WebSocket communication
  • Zero server-side setup - No modules to install on your Foundry instance
  • Secure - Uses the same authentication flow as the official client

Compatibility

Works with FoundryVTT v13 and v14. The server detects the Foundry generation automatically (via GET /api/status) and uses the correct session-binding method for that version — v14 changed how the WebSocket session is authenticated, and both are handled transparently with no configuration needed.

Security Recommendation

Create a dedicated FoundryVTT user for each game world you want the MCP server to access. Grant that user only the permissions you want the MCP server to have. This provides:

  • Fine-grained access control
  • Clear audit trail of MCP actions
  • Easy revocation if needed
  • Isolation between different games/worlds

Installation

npm install
npm run build

Skills

The ./skills directory contains LLM skills for this project. Currently the only skill there is MAIN.skill, and all users should install it because it includes the FoundryVTT-specific guidance and workflows. We welcome PRs that add skills for specific game systems, FoundryVTT modules, or other targeted use cases.

Configuration

Credentials File

Create a file at config/foundry_credentials.json:

[
  {
    "_id": "my-campaign",
    "hostname": "your-foundry-server.com",
    "userid": "your-user-id",
    "password": "your-password"
  },
  {
    "_id": "test-world",
    "hostname": "test.foundry-server.com",
    "username": "Gamemaster",
    "password": "test-password"
  }
]

Fields:

  • _id - A user-defined identifier for this credential entry (used to switch between instances)
  • hostname - The domain/IP of your FoundryVTT server
  • userid - Your Foundry user document ID (find by inspecting Users in Foundry admin panel)
  • username - Your Foundry user name
    • Give userid, username, or both. If only one is given, the other is looked up from the world’s user list before logging in. If both are given, they are used as-is. Name lookup is exact first, then case-insensitive.
  • password - Your Foundry user password
  • allow_insecure_tls - Optional. Set to true only for a trusted Foundry server with a self-signed certificate. Defaults to false.

Disabling TLS verification makes the connection vulnerable to interception. Prefer a trusted certificate when one is available.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "foundry": { "command": "node", "args": ["/path/to/FoundryMCP/build/server.js"] } } }