AnythingLLM Integration Guide¶
This document describes how to set up and manage AnythingLLM workspaces for RPG campaigns.
Architecture¶
AnythingLLM Workspace (1:1) Campaign Vault
─────────────────────────────────────────────
Seagate DM → campaigns/seagate/
Shadows of Ashwick DM → campaigns/shadows-of-ashwick/
Mojave Courier DM → campaigns/mojave/
Each workspace:
- Maps to exactly one campaign
- Has a system prompt declaring CAMPAIGN_ID
- Embeds only that campaign's files
- Uses MCP tools with the correct campaign_id
MCP Configuration¶
AnythingLLM connects to palimpsest via streamable-http transport.
Config file: /app/server/storage/plugins/anythingllm_mcp_servers.json
{
"mcpServers": {
"palimpsest": {
"type": "streamable",
"url": "http://palimpsest.palimpsest.svc.cluster.local/mcp"
}
}
}
Creating a New Campaign Workspace¶
1. Create Campaign in Vault¶
# Create directory structure
mkdir -p campaigns/{campaign_id}/{canon/{pcs,npcs,locations,items,factions,threads},_gm/{secrets,plots},sessions}
# Add required files
touch campaigns/{campaign_id}/canon/timeline.md
touch campaigns/{campaign_id}/canon/open-threads.md
touch campaigns/{campaign_id}/canon/current-state.md
2. Create AnythingLLM Workspace¶
Via API:
curl -X POST 'http://anythingllm:80/api/v1/workspace/new' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Campaign Name DM"}'
3. Set System Prompt¶
The system prompt MUST include:
- CAMPAIGN_ID: {campaign_id} at the top
- Instructions to use this campaign_id for all MCP tool calls
- Campaign-specific tone and setting guidance
Template:
CAMPAIGN_ID: {campaign_id}
You are the Dungeon Master for {Campaign Name} - {brief description}.
## MCP TOOLS
You have access to palimpsest MCP tools. ALWAYS use campaign_id="{campaign_id}" when calling these tools:
**State Management:**
- list_pcs, get_pc, update_pc, take_rest - Player character state
- roll_dice - Dice rolling with standard notation
**World Data:**
- list_entities, get_entity, create_entity, update_entity - NPCs, locations, items, factions
- search_entities - Search across all entity types
**GM Information:**
- list_gm_secrets, get_gm_secret - Hidden NPC motivations and truths
- list_gm_plots, get_gm_plot - Story hooks and future events
**Story Tracking:**
- list_threads, add_thread, resolve_thread - Active plot threads
- get_timeline, add_timeline_events - Campaign timeline
**Session Management:**
- get_session_context - Get full context at session start
- apply_closeout - Save session changes
## TONE
{Campaign-specific tone guidance}
## CAMPAIGN CANON
The attached documents are your source of truth.
## RESPONSE FORMAT
- 500-3000 characters
- Vivid descriptions
- End with 5 potential actions: {1. Action} {2. Action} etc.
4. Embed Campaign Files¶
Upload and embed files from the campaign's vault directory:
- canon/*.md - World state files
- canon/npcs/*.md - NPC files
- canon/locations/*.md - Location files
- _gm/secrets/*.md - GM secrets (for DM context)
- _gm/plots/*.md - Plot hooks
Do NOT embed: - Files from other campaigns - Session logs (too much noise)
5. Configure Workspace Settings¶
- Chat Mode:
agent(required for MCP tools) - Agent Provider:
deepseek(or your LLM provider) - Agent Model:
deepseek-chat(or your model)
Thread Management¶
Per-Session Threads¶
Create a new thread for each game session:
- Thread name: Session {N} or date-based
- Keeps context focused
- Prevents cross-contamination from old conversations
When to Create New Thread¶
- Starting a new session
- After a major story arc completes
- If agent seems confused about campaign state
Archiving¶
Old threads are kept for reference but not actively used. The MCP tools provide canonical state; thread history is for conversation context only.
Troubleshooting¶
MCP Tools Not Working¶
- Check workspace is in
agentmode - Verify MCP server config has
type: "streamable" - Check palimpsest logs:
kubectl logs -n palimpsest deploy/palimpsest - Check AnythingLLM logs for MCP errors
Wrong Campaign Being Used¶
- Verify system prompt has correct
CAMPAIGN_ID - Create a fresh thread (old context may have wrong campaign)
- Explicitly mention campaign in your message: "@agent use campaign seagate"
Tools Returning Errors¶
- Check campaign exists in vault:
campaigns/{campaign_id}/ - Verify required files exist (timeline.md, open-threads.md)
- Check palimpsest health:
curl http://palimpsest/health
Current Workspaces¶
| Workspace | Slug | Campaign ID | Status |
|---|---|---|---|
| Seagate DM | rpg | seagate | Active |
| Shadows of Ashwick DM | shadows-of-ashwick-dm | shadows-of-ashwick | Setup |
| Mojave Courier DM | mojave-courier-dm | mojave | Setup |