Music and Madness Sync Bridge MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/CaptainCurso/music-madness-sync-bridge
cd music-madness-sync-bridge

Then follow the repository README for any remaining dependency or build steps before continuing.

2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "FOUNDRY_BASE_URL=${FOUNDRY_BASE_URL}" -e "NOTION_API_KEY=${NOTION_API_KEY}" -e "NOTION_STORY_BIBLE_PAGE_ID=${NOTION_STORY_BIBLE_PAGE_ID}" -e "FOUNDRY_BRIDGE_TOKEN=${FOUNDRY_BRIDGE_TOKEN}" music-madness-sync -- node "<FULL_PATH_TO_MUSIC_MADNESS_SYNC_BRIDGE>/dist/index.js"

Replace <FULL_PATH_TO_MUSIC_MADNESS_SYNC_BRIDGE>/dist/index.js with the actual folder you prepared in step 1.

Required:FOUNDRY_BASE_URLNOTION_API_KEYNOTION_STORY_BIBLE_PAGE_IDFOUNDRY_BRIDGE_TOKEN
README.md

Synchronize and manage FoundryVTT journal entries within a Notion Story Bible.

Music and Madness Sync Bridge

This project implements Stage 1 of your plan:

  • FoundryVTT -> Notion Story Bible journal mirroring
  • Manual-run sync commands
  • MCP tool surface for Codex/LLM orchestration
  • Full media copy to durable local storage
  • Conflict tracking with manual resolution
  • Non-destructive writes under Music and Madness Story Bible with a top-level Journals wiki tree

Project layout

  • /Users/nicholasmcdowell/Documents/Codex Projects/Music and Madness/music-madness-sync-bridge/src
    • Bridge service, CLI, MCP server, Foundry/Notion adapters.
  • /Users/nicholasmcdowell/Documents/Codex Projects/Music and Madness/music-madness-sync-bridge/foundry-module/music-madness-bridge
    • Foundry module scaffold exposing authenticated journal read events.
  • /Users/nicholasmcdowell/Documents/Codex Projects/Music and Madness/music-madness-sync-bridge/data
    • Runtime state (state/bridge.sqlite), media copies (media/), logs (logs/audit.log).

Definitions

  • MCP: Model Context Protocol. Lets Codex call bridge tools like sync.foundry_to_notion.apply.
  • Mirror block: Generated section under ## Foundry Mirror in a Notion page.
  • Journals wiki tree: A top-level Story Bible child page named Journals, with sub-pages matching Foundry folders.
  • Conflict: Source and target changed since last sync, requiring manual decision.

Setup

  1. Copy env template.
cd '/Users/nicholasmcdowell/Documents/Codex Projects/Music and Madness/music-madness-sync-bridge'
cp .env.example .env
  1. Fill .env values:
  • Foundry URL/tokens
  • Notion key
  • Story Bible root page ID (NOTION_STORY_BIBLE_PAGE_ID)
  1. Typecheck.
npm run typecheck

Operator commands

Preview changes (no writes):

npm run sync:preview

sync:preview auto-starts the local proxy when FOUNDRY_BASE_URL is local (127.0.0.1 / localhost / ::1) and FOUNDRY_AUTO_PROXY=1. Preview/write targets are wiki pages under Journals, not Notion databases.

Apply mirror updates:

npm run sync:apply

sync:apply has the same auto-proxy behavior and stops the proxy afterward only if this command started it. When creating a page, it mirrors Foundry folder structure under the Journals wiki tree. Media download/linking is enabled by default; disable with --no-include-media.

List conflicts:

npm run sync:conflicts

Resolve one conflict:

npm run sync:resolve -- --conflict-id <id> --resolution manual_merge --notes "Reviewed and merged"

Health check:

tsx src/cli.ts health

MCP server

Run stdio MCP server:

npm run mcp:start

Exposed tools:

  • foundry.health_check
  • foundry.list_journals
  • foundry.get_journal
  • foundry.export_journal_media
  • sync.foundry_to_notion.preview
  • sync.foundry_to_notion.apply
  • sync.diff
  • sync.conflicts.list
  • sync.conflicts.resolve

Guardrails enforced

  • Only writes to Notion pages in NOTION_ALLOWED_DATABASE_IDS.
  • Existing prose preserved by appending/updating generated mirror block.
  • Legacy Music and Madness section is untouched by default because database scope is explicit.

Known limitations in this initial implementation

  • Foundry HTTP routes are expected at /health, /journals, /journals/:id, etc.
  • The Foundry module included here is an authenticated socket/event scaffold. If you need direct HTTP routes from Foundry itself, run a small local proxy (or use an API module) that maps those routes to module events.
  • Media is copied to local durable files. To render media directly inside cloud Notion reliably, set MEDIA_PUBLIC_BASE_URL to a reachable static host.

Local test bridge API (optional)

If your Foundry module routes are not live yet, run the mock API that implements:

  • GET /health
  • GET /journals
  • GET /journals/:id
  • GET /journals/:id/media
  • GET /assets/:assetId
  • GET /changes?since=

Command:

npm run foundry:mock-api

Fixture data file:

  • /Users/nicholasmcdowell/Documents/Codex Projects/Music and Madness/music-madness-sync-bridge/fixtures/foundry-fixture.json

Real Foundry proxy (Socket.IO -> HTTP routes)

Use this when your Foundry world and music-madness-bridge module are running.

Why this exists

Your sync client expects HTTP routes (/journals, /health, etc.). The Foundry module communicates via socket events in-world. This proxy translates HTTP calls to socket event calls.

Start order

  1. Start Foundry and open the target world.
  2. Ensure module music-madness-bridge is enabled.
  3. In Foundry world settings, set Bridge Token to the same value as .env FOUNDRY_BRIDGE_TOKEN.
  4. Populate in .env:
    • FOUNDRY_SITE_URL
    • FOUNDRY_WORLD
    • FOUNDRY_SESSION_COOKIE
    • FOUNDRY_BRIDGE_TOKEN
  5. Start proxy:
npm run foundry:proxy
  1. In another terminal, run bridge operations:
npm run sync:preview
npm run sync:apply

Session cookie note

`FOUNDRY_S

Tools (9)

foundry.health_checkChecks the health status of the FoundryVTT connection.
foundry.list_journalsLists available journal entries from FoundryVTT.
foundry.get_journalRetrieves a specific journal entry by ID.
foundry.export_journal_mediaExports media assets associated with a journal entry.
sync.foundry_to_notion.previewPreviews changes between FoundryVTT and Notion without applying them.
sync.foundry_to_notion.applyApplies mirror updates from FoundryVTT to the Notion Story Bible.
sync.diffShows the differences between source and target.
sync.conflicts.listLists current synchronization conflicts.
sync.conflicts.resolveResolves a specific synchronization conflict.

Environment Variables

FOUNDRY_BASE_URLrequiredThe base URL for the FoundryVTT instance.
NOTION_API_KEYrequiredThe API key for Notion integration.
NOTION_STORY_BIBLE_PAGE_IDrequiredThe root page ID for the Story Bible in Notion.
FOUNDRY_BRIDGE_TOKENrequiredAuthentication token for the bridge module.

Configuration

claude_desktop_config.json
{"mcpServers": {"music-madness-sync": {"command": "node", "args": ["/path/to/music-madness-sync-bridge/dist/index.js"], "env": {"FOUNDRY_BASE_URL": "...", "NOTION_API_KEY": "...", "NOTION_STORY_BIBLE_PAGE_ID": "..."}}}}

Try it

Check the health of my FoundryVTT connection.
List all my current journal entries in Foundry.
Preview the sync changes from Foundry to my Notion Story Bible.
Apply the pending mirror updates to Notion.
List any conflicts currently blocking the sync process.

Frequently Asked Questions

What are the key features of Music and Madness Sync Bridge?

FoundryVTT to Notion Story Bible journal mirroring. Full media copy to durable local storage. Conflict tracking with manual resolution tools. Non-destructive writes using a top-level Journals wiki tree. MCP tool surface for LLM orchestration.

What can I use Music and Madness Sync Bridge for?

Keeping tabletop RPG campaign notes synced between FoundryVTT and Notion.. Archiving FoundryVTT journal entries into a searchable Notion Story Bible.. Managing media assets from TTRPG sessions in a local durable storage folder.. Resolving data conflicts when both Foundry and Notion entries are modified..

How do I install Music and Madness Sync Bridge?

Install Music and Madness Sync Bridge by running: npm run mcp:start

What MCP clients work with Music and Madness Sync Bridge?

Music and Madness Sync Bridge works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Music and Madness Sync Bridge docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare