Connecting Your AI

Generate an API token, configure MCP, and start using your AI assistant with TxTavern.

Generate an API token

  1. Sign in to TxTavern
  2. Go to Account Settings (click your avatar in the sidebar)
  3. Scroll to API Tokens
  4. Click Generate Token
  5. Copy the token – you won’t see it again

Your token authenticates your AI as you. It has the same permissions as your browser session.

Configure your MCP client

Add TxTavern as an MCP server in your AI tool’s configuration file.

Claude Code

Add to your project’s .mcp.json or global ~/.claude/.mcp.json:

json { "mcpServers": { "txtavern": { "type": "url", "url": "https://txtavern.com/mcp", "headers": { "Authorization": "Bearer YOUR_TOKEN" } } } }

Cursor / Windsurf

Add the same MCP server block to your editor’s MCP settings. Check your editor’s documentation for the exact location.

Test the connection

Ask your AI to list your worlds:

“List my worlds in TxTavern”

It should call the list_worlds tool and return your world data. If it works, your AI now has structured access to your entire world.

What your AI can do

With MCP connected, your AI can:

  • Read – list and get worlds, campaigns, articles, characters, sessions, game elements
  • Write – create and update articles, characters, sessions, inventory items
  • Manage – invite players, assign rulesets, set calendar dates, manage currency
  • Search – full-text search across all your content

Over 111 tools are available. Your AI discovers them automatically through the MCP protocol.

The Archivist workflow

The most powerful use of MCP is the Archivist pattern – an AI agent that acts as your DM assistant. It:

  1. Reads your session recaps and updates wiki pages for every NPC, location, and plot thread mentioned
  2. Tracks what’s canon (happened at the table) vs. what’s planned (prep notes, ideas)
  3. Preps encounters by looking up stat blocks, referencing your world’s lore, and suggesting plot hooks
  4. Maintains a living overview of your world that stays current session to session

See Meet the Archivist for the full story.