Skip to main content
Glama
silly-tavern-mcp

silly-tavern-mcp

Silly Tavern MCP

silly-tavern-mcp provides the st-mcp command and st.* MCP tools for controlling SillyTavern through agents.

It is intentionally shaped as a deep module:

Agent
  -> MCP tools/resources
  -> StControlPlane
  -> SillyTavern HTTP endpoints, source tree, plugin folders, snapshots

The MCP interface stays small. The control plane owns CSRF handling, endpoint selection, snapshot creation, and write confirmation.

Scope

Version 0.11.0 covers the core Agent-control layer: characters, chats, worldbooks, prompt/context assembly, chat metadata, regex/script injections, Quick Reply scripts, extension/plugin adaptation, codebase indexing, and a runtime browser bridge.

  • Configuration location index: st.config_locations

  • Runtime health: st.doctor

  • Standard resource reads: st.resource.read

  • Dry planning: st.plan_change

  • Parsed server config control: st.config.get, st.config.patch

  • Confirmed patches for character fields and worldbook data: st.resource.patch

  • Character registry/chat discovery: st.character.list, st.character.chats

  • Character core field inspection/control: st.character.inspect, st.character.configure

  • Worldbook registry/file control: st.worldbook.list, st.worldbook.inspect, st.worldbook.create_empty, st.worldbook.delete

  • Worldbook entry inspection/control: st.worldbook.entries, st.worldbook.entry.configure

  • MVU settings and state inspection/control: st.mvu.settings.get, st.mvu.settings.configure, st.mvu.entries, st.mvu.entry.set_enabled, st.mvu.chat_state.inspect, st.mvu.chat_state.patch

  • Snapshots and rollback: st.snapshot, st.rollback

  • Extension install and enable/disable: st.extension.install, st.extension.set_enabled

  • Extension registry and configuration: st.extension.registry, st.extension.configure

  • Server plugin install: st.plugin.install

  • Server plugin scaffold: st.plugin.scaffold

  • Server plugin registry and flags: st.plugin.registry, st.plugin.configure

  • Prompt/context inspection: st.prompt.inspect

  • Prompt injection control: st.prompt.set_injection

  • Regex script registry/control: st.regex.registry, st.regex.configure

  • Global variable registry/control: st.variables.registry, st.variables.set

  • Quick Reply script registry/control: st.quick_reply.registry, st.quick_reply.configure

  • Chat metadata/context control: st.chat.metadata.get, st.chat.metadata.patch

  • Chat transcript inspection/message control: st.chat.inspect, st.chat.message.append, st.chat.message.edit, st.chat.message.delete

  • Chat worldbook binding: st.chat.worldbook.bind

  • Current-chat Author's Note control: st.chat.authors_note.set

  • Local chat variable control: st.chat.variables.set

  • Persistent chat script injection control: st.chat.script_inject.configure

  • Source read/write within scoped roots: st.source.read, st.source.write

  • Controlled development commands: st.dev.run

  • Runtime lifecycle through configured commands: st.runtime.control

  • Runtime browser bridge install/read: st.bridge.install, st.bridge.health, st.bridge.read

  • Static upstream ST codebase index: st.index.refresh, st://index, st://index/markdown

  • Technical post-change read verification: st.verify

Product-specific protocols should build on top of this ST control layer rather than being mixed into the ST MCP surface.

Non-core user preferences are intentionally excluded from the public MCP interface. Do not add generic tools for themes, layout, UI preferences, or broad user-settings patching; add semantic tools only when the field participates in core roleplay execution, prompt/context assembly, scripting, plugins, or data assets.

Related MCP server: media-gen-mcp

Resource URIs

Supported first-pass resources:

st://status
st://config
st://config/current
st://config/default
st://config/schema
st://characters
st://characters/{avatar}
st://characters/{avatar}/raw
st://chats/recent
st://chats/recent/metadata
st://worldbooks
st://worldbooks/{name}
st://extensions
st://plugins
st://regex
st://quick-replies
st://variables
st://snapshots
st://index
st://index/markdown
st://routes
st://prompt-pipeline
st://prompt/inspect
st://extension-registry
st://plugin-registry
st://data-layout
st://logs/server
st://source/package

Codebase Index

The codebase index is generated from the target upstream SillyTavern source tree:

npm run index:upstream-st -- /absolute/path/to/SillyTavern ./docs

It captures server config keys, default user setting sections, backend routes, static getConfigValue usages, data layout, and known prompt/extension/plugin runtime seams. The index can mention user settings because ST stores core prompt features there internally, but the public MCP protocol should expose semantic core tools rather than generic user-setting patching.

Configuration Location Index

st.config_locations is the first tool an agent should call when it needs to understand where a setting actually lives. It maps user-facing domains to storage and semantic tools:

server_config       -> config.yaml
characters          -> default-user/characters plus /api/characters/*
worldbooks          -> default-user/worlds/*.json entries
chat_metadata       -> first record in chats/{avatar}/{file}.jsonl
mvu_global_settings -> extension_settings.mvu_settings
mvu_worldbook_entries -> worldbook entries with [InitVar], [mvu_update], [mvu_plot], stat_data macros, or variable-rule markers
mvu_chat_state      -> message.variables[].stat_data inside chat JSONL messages

This is the contract that keeps the MCP from being a pile of endpoint wrappers: the agent can ask for the configuration map, then use the semantic tool for the domain it found.

Configuration Control

Use dotted paths only for server config needed by core runtime control:

{
  "path": "enableServerPlugins"
}

Confirmed patches create a snapshot before writing:

{
  "updates": {
    "enableServerPlugins": true
  },
  "confirm": true
}

st.config.patch writes config.yaml and returns restartRequired: true.

Characters And Worldbooks

st.character.list lists existing imported character cards, and st.character.chats lists chat files under one character avatar. These tools are for Tavern management/discovery only; they do not create role cards.

st.character.inspect and st.character.configure expose character-card core fields without making the agent understand PNG card internals or ST's mirrored root/data fields. This is still management of an existing imported card, not a card-authoring protocol.

Core editable fields:

name
description
personality
scenario
first_mes
mes_example
system_prompt
post_history_instructions
alternate_greetings

Example:

{
  "avatar": "default_Seraphina.png",
  "fields": {
    "scenario": "The forest sanctuary is quiet, but something watches from the old road.",
    "system_prompt": "Write {{char}} with warmth, restraint, and strong continuity."
  },
  "confirm": true
}

st.worldbook.list lists worldbook files. st.worldbook.inspect reads one complete worldbook. st.worldbook.create_empty creates an empty shell, and st.worldbook.delete removes a worldbook after a snapshot.

st.worldbook.entries lists one worldbook's entries. st.worldbook.entry.configure creates, updates, enables/disables, or deletes exactly one entry instead of forcing the agent to rewrite an entire worldbook.

Example:

{
  "book": "Eldoria",
  "comment": "shadowfang tactics",
  "fields": {
    "key": ["shadowfang", "ambush"],
    "content": "Shadowfangs hunt by circling silently before the first strike.",
    "position": 0,
    "depth": 4,
    "order": 80
  },
  "enabled": true,
  "confirm": true
}

MVU Configuration

MVU has three separate storage locations:

Global MVU configuration:
  extension_settings.mvu_settings

MVU declaration/rule entries:
  worldbook entries, usually tagged [InitVar], [mvu_update], [mvu_plot],
  variable-rule text, or stat_data macros.

Runtime MVU variable values:
  chat messages, at message.variables[].stat_data and initialized_lorebooks.

Use st.mvu.settings.get and st.mvu.settings.configure for global MVU model and auto-request settings. Use st.mvu.entries to find MVU-related worldbook entries and st.mvu.entry.set_enabled to enable or disable exactly one entry. Use st.mvu.chat_state.inspect to inspect runtime stat_data snapshots in a chat, and st.mvu.chat_state.patch only when intentionally editing live MVU state.

Example: find disabled MVU entries in a worldbook:

{
  "book": "ONEPIECE mvu测试",
  "includeContent": false
}

Example: enable an [InitVar] entry:

{
  "book": "ONEPIECE mvu测试",
  "uid": 0,
  "enabled": true,
  "confirm": true
}

Extension And Plugin Registries

st.extension.registry joins frontend extension discovery with settings.extension_settings, infers likely config keys, and reports enabled state. st.extension.configure can enable/disable an extension and patch its extension settings in one confirmed write.

st.plugin.registry reports installed server plugin manifests plus enableServerPlugins and enableServerPluginsAutoUpdate. st.plugin.configure patches those config flags and returns restartRequired: true.

Prompt Inspection

st.prompt.inspect reads the static codebase index, live prompt-related ST state, and optionally the runtime bridge snapshot. It is a read-only map of the current prompt/context assembly surface; write tools should build on this instead of exposing generic user settings.

Prompt Injection Control

st.prompt.set_injection is the semantic write layer for ST prompt placement. It translates agent-friendly fields into the current ST internal schema and then uses a confirmed snapshot/write flow.

Supported targets:

authors_note  -> extension_settings.note.default/defaultPosition/defaultDepth/defaultRole/defaultInterval/allowWIScan
persona       -> power_user.persona_description and persona_description_position/depth/role
world_info    -> world_info_settings depth/budget/budget_cap/recursive/matching flags
system_prompt -> power_user.sysprompt enabled/content/name/post_history
instruct      -> power_user.instruct enabled/preset plus relative updates
context       -> power_user.context.story_string and story_string_position/depth/role

Readable positions are normalized to ST enums. Extension prompt positions are none, in_prompt, in_chat, and before_prompt; persona also supports top_an, bottom_an, and at_depth. Roles are system, user, and assistant.

Example:

{
  "target": "persona",
  "text": "{{user}} is a tired detective with a hidden agenda.",
  "position": "at_depth",
  "depth": 2,
  "role": "system",
  "confirm": true
}

Regex, Variables, And Quick Reply Scripts

st.regex.registry and st.regex.configure manage global ST regex scripts in extension_settings.regex. The MCP tool accepts readable placements: user_input, ai_output, slash_command, world_info, and reasoning, then stores the numeric ST enum.

Example:

{
  "name": "Normalize OOC brackets",
  "findRegex": "/\\((.*?)\\)/g",
  "replaceString": "[$1]",
  "placements": ["ai_output", "slash_command"],
  "enabled": true,
  "confirm": true
}

st.variables.registry and st.variables.set manage global slash/macro variables stored at extension_settings.variables.global.

st.quick_reply.registry and st.quick_reply.configure manage the Quick Reply V2 setting plus saved Quick Reply sets. Quick Replies are slash-command scripts: the set is saved through /api/quick-replies/save, while global enable/active set state is saved through /api/settings/save.

Example:

{
  "enabled": true,
  "activeSet": "Agent",
  "set": "Agent",
  "reply": {
    "label": "Daily setup",
    "message": "/setvar key=scene_mode calm | /echo Ready"
  },
  "confirm": true
}

Chat Metadata Control

Chat-level metadata is part of core context because ST stores current-chat Author's Note overrides, local slash variables, selected chat world info, and persistent /inject data in chat_metadata.

The chat tools require explicit avatar and fileName; they do not guess the active browser chat:

st.chat.inspect
st.chat.metadata.get
st.chat.metadata.patch
st.chat.worldbook.bind
st.chat.message.append
st.chat.message.edit
st.chat.message.delete
st.chat.authors_note.set
st.chat.variables.set
st.chat.script_inject.configure

st.chat.inspect returns the chat header, chat_metadata, and transcript messages with zero-based message indexes. Message tools append, edit, or delete caller-provided transcript messages; they do not generate roleplay content. st.chat.worldbook.bind sets or unsets chat_metadata.world_info, which is the native ST selected-chat worldbook key.

Example:

{
  "avatar": "default_Seraphina.png",
  "fileName": "Seraphina - 2023-5-12 @21h 32m 29s 224ms",
  "text": "Keep the current scene grounded and intimate.",
  "position": "chat",
  "depth": 4,
  "role": "system",
  "confirm": true
}

Setup

cd /path/to/st-mcp
npm install
npm run build

When the four sibling projects use the standard workspace layout, st-mcp automatically targets ../tavern and its embedded SillyTavern engine. Override the paths below only for a different checkout layout.

Default runtime target:

ST_MCP_BASE_URL=http://127.0.0.1:8000

Useful environment variables:

ST_MCP_PROJECT_ROOT=/absolute/path/to/SillyTavern
ST_MCP_ST_ROOT=/absolute/path/to/SillyTavern
ST_MCP_CONFIG_PATH=/absolute/path/to/config.yaml
ST_MCP_USER_DATA_ROOT=/absolute/path/to/default-user
ST_MCP_SNAPSHOT_ROOT=/absolute/path/to/snapshots
ST_MCP_TIMEOUT_MS=30000
ST_MCP_RUNTIME_STATUS_CMD=...
ST_MCP_RUNTIME_START_CMD=...
ST_MCP_RUNTIME_STOP_CMD=...
ST_MCP_RUNTIME_RESTART_CMD=...

Runtime commands run from ST_MCP_PROJECT_ROOT. Mutating runtime actions require confirm: true; status can run without confirmation.

Runtime Bridge

st.bridge.install installs two matching pieces into the target ST source tree:

  • plugins/st-mcp-runtime-bridge

  • public/scripts/extensions/third-party/st-mcp-runtime-bridge

The frontend extension publishes sanitized browser runtime snapshots to the server plugin. st.bridge.read then exposes that state to external Agents.

The bridge requires server plugins to be enabled and a browser reload after installation.

Client Config Example

{
  "mcpServers": {
    "st-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/st-mcp/dist/server.js"],
      "env": {
        "ST_MCP_BASE_URL": "http://127.0.0.1:8000",
        "ST_MCP_PROJECT_ROOT": "/absolute/path/to/SillyTavern",
        "ST_MCP_ST_ROOT": "/absolute/path/to/SillyTavern",
        "ST_MCP_CONFIG_PATH": "/absolute/path/to/config.yaml",
        "ST_MCP_USER_DATA_ROOT": "/absolute/path/to/default-user"
      }
    }
  }
}

Safety Model

Write operations require confirm: true. Confirmed writes create a snapshot before changing ST state. Rollback also requires confirm: true.

The first version avoids direct mutation of user data when ST has an endpoint for the operation. Direct filesystem control should be added only behind the same snapshot and verification flow.

License

MIT

Available Tools

60 tools
st.bridge.healthA

Read the runtime bridge server plugin health endpoint.

Inputs: no named parameters.

st.bridge.installC

Install the ST MCP runtime bridge server plugin and frontend extension. Requires confirm: true.

Inputs: confirm.

st.bridge.readB

Read the latest browser runtime snapshot published by the ST MCP runtime bridge.

Inputs: history.

st.character.chatsC

List chat files for one character avatar.

Inputs: avatar (required), simple, metadata.

st.character.configureB

Patch core character card fields such as description, personality, scenario, greetings, and prompts. Requires confirm: true.

Inputs: avatar (required), fields (required), confirm, snapshotLabel.

st.character.inspectA

Read one character card with the core editable field list.

Inputs: avatar (required).

st.character.listA

List existing SillyTavern characters. This reads imported cards but does not create cards.

Inputs: no named parameters.

st.chat.authors_note.setB

Set the current-chat Author's Note override fields in chat_metadata. Requires explicit avatar/fileName and confirm: true.

Inputs: avatar (required), fileName (required), role, text, +7 more.

st.chat.inspectB

Read a chat file header, chat_metadata, and messages. Requires explicit avatar and fileName.

Inputs: avatar (required), fileName (required).

st.chat.message.appendA

Append a caller-provided message to a chat transcript. Requires confirm: true; does not generate message content.

Inputs: avatar (required), message (required), fileName (required), force, +2 more.

st.chat.message.deleteA

Delete one existing chat message by zero-based transcript index. Requires confirm: true.

Inputs: index (required), avatar (required), fileName (required), force, +2 more.

st.chat.message.editA

Edit one existing chat message by zero-based transcript index. Requires confirm: true.

Inputs: index (required), avatar (required), fileName (required), force, +4 more.

st.chat.metadata.getB

Read chat_metadata from a specific ST chat file. Requires explicit avatar and fileName.

Inputs: avatar (required), fileName (required).

st.chat.metadata.patchC

Patch chat_metadata dotted paths in a specific ST chat file. Requires confirm: true.

Inputs: avatar (required), fileName (required), force, unset, +3 more.

st.chat.script_inject.configureB

Create, update, or delete a persistent slash-command-style prompt injection in chat_metadata.script_injects. Requires confirm: true.

Inputs: id (required), avatar (required), fileName (required), role, +9 more.

st.chat.variables.setA

Set or unset a local slash/macro variable stored in a specific chat's chat_metadata.variables. Requires confirm: true.

Inputs: name (required), avatar (required), fileName (required), force, +5 more.

st.chat.worldbook.bindA

Bind or unbind a worldbook to one chat through chat_metadata.world_info. Requires confirm: true.

Inputs: avatar (required), fileName (required), book, force, +3 more.

st.config.getB

Read parsed config.yaml or one dotted config path with default value and code usage hints.

Inputs: path, includeDefault.

st.config_locationsB

Map high-level SillyTavern configuration domains to their real storage locations and semantic tools.

Inputs: no named parameters.

st.config.patchA

Patch config.yaml by dotted paths. Requires confirm: true, snapshots first, and usually requires ST restart.

Inputs: unset, confirm, updates, allowUnknown, +1 more.

st.dev.runC

Run a controlled development command in project-root, st-root, or st-mcp. Requires confirm: true.

Inputs: scope (required), command (required), args, confirm, +1 more.

st.doctorB

Check whether the target SillyTavern runtime is controllable.

Inputs: no named parameters.

st.extension.configureB

Configure a frontend extension through extension_settings and/or enabled state. Requires confirm: true.

Inputs: name, unset, confirm, enabled, +4 more.

st.extension.installA

Install a SillyTavern frontend extension from a Git URL via the ST extension endpoint.

Inputs: url (required), branch, global, confirm.

st.extension.registryA

List discovered frontend extensions with enabled state, inferred extension_settings config keys, and current config.

Inputs: no named parameters.

st.extension.set_enabledA

Enable or disable a discovered SillyTavern frontend extension. Requires confirm: true.

Inputs: name (required), enabled (required), confirm.

st.index.refreshA

Regenerate the static upstream ST codebase index used by st://index and st://index/markdown. Requires confirm: true.

Inputs: confirm.

st.mvu.chat_state.inspectB

Inspect MVU runtime variable snapshots stored in chat message variables[].stat_data.

Inputs: avatar (required), fileName (required).

st.mvu.chat_state.patchA

Patch MVU runtime stat_data on one chat message, defaulting to the latest message. Requires confirm: true.

Inputs: avatar (required), fileName (required), force, index, +4 more.

st.mvu.entriesB

List MVU-related worldbook entries and their exact disable/enabled storage field.

Inputs: book, includeContent.

st.mvu.entry.set_enabledB

Enable or disable one MVU-related worldbook entry. Requires confirm: true.

Inputs: book (required), enabled (required), uid, comment, +2 more.

st.mvu.settings.configureC

Configure MagVarUpdate/MVU global settings through semantic fields. Requires confirm: true.

Inputs: apiKey, apiUrl, confirm, enabled, +8 more.

st.mvu.settings.getA

Read MagVarUpdate/MVU global settings and report their exact extension_settings storage path.

Inputs: no named parameters.

st.plan_changeB

Plan a controlled ST change without writing. Use this before any destructive or complex action.

Inputs: goal (required), targetUri (required), changes.

st.plugin.configureB

Configure SillyTavern server plugin flags in config.yaml. Requires confirm: true and restart.

Inputs: confirm, snapshotLabel, enableServerPlugins, enableServerPluginsAutoUpdate.

st.plugin.installA

Install a SillyTavern server plugin from a Git URL into the plugins directory. Requires confirm: true.

Inputs: url (required), name, branch, confirm, +1 more.

st.plugin.registryA

List server plugin runtime state, installed plugin manifests, and server plugin config flags.

Inputs: no named parameters.

st.plugin.scaffoldA

Create a loadable SillyTavern server plugin skeleton. Requires confirm: true.

Inputs: id (required), name, confirm, description.

st.prompt.inspectB

Inspect the prompt/context assembly surface: indexed seams, live prompt-related settings, and optional runtime bridge state.

Inputs: includeRuntime.

st.prompt.set_injectionB

Change prompt injection semantics without knowing raw ST setting paths. Requires confirm: true and snapshots first.

Inputs: target (required), name, role, scan, +18 more.

st.quick_reply.configureC

Enable Quick Reply, activate a set, create/update/delete a set, or upsert/delete a slash-command quick reply. Requires confirm: true.

Inputs: set, reply, confirm, enabled, +5 more.

st.quick_reply.registryA

List Quick Reply V2 settings and saved slash-command quick reply sets.

Inputs: no named parameters.

st.regex.configureB

Create, update, enable/disable, or delete a global ST regex script. Requires confirm: true.

Inputs: name (required), action, confirm, enabled, +11 more.

st.regex.registryB

List global ST regex scripts with normalized placement metadata.

Inputs: no named parameters.

st.resource.patchB

Patch a supported ST resource. Requires confirm: true and creates a snapshot before writing.

Inputs: uri (required), patch (required), confirm, snapshotLabel.

st.resource.readB

Read a standard ST resource by URI, for example st://characters or st://extensions.

Inputs: uri (required).

st.rollbackC

Restore a snapshot created by st.snapshot or a confirmed write operation.

Inputs: id (required), confirm.

st.runtime.controlA

Run configured SillyTavern runtime status/start/stop/restart commands. Mutating actions require confirm: true.

Inputs: action (required), confirm.

st.snapshotC

Create a filesystem snapshot of important ST config, user data, extension, and plugin paths.

Inputs: label.

st.source.readB

Read a source file from project-root, st-root, or st-mcp without leaving that scope.

Inputs: path (required), scope (required), maxBytes.

st.source.writeA

Write a source file within project-root, st-root, or st-mcp. Requires confirm: true and snapshots first.

Inputs: path (required), scope (required), content (required), confirm, +1 more.

st.variables.registryA

List global ST slash/macro variables stored in extension_settings.variables.global.

Inputs: no named parameters.

st.variables.setA

Set or unset a global ST slash/macro variable. Requires confirm: true.

Inputs: name (required), unset, value, asJson, +2 more.

st.verifyB

Verify that a resource can be read after a change. This is a technical check, not a UX proof.

Inputs: targetUri.

st.worldbook.create_emptyA

Create an empty worldbook shell for later entry management. Requires confirm: true.

Inputs: name (required), confirm, overwrite, snapshotLabel.

st.worldbook.deleteB

Delete a worldbook file. Requires confirm: true and snapshots first.

Inputs: name (required), confirm, snapshotLabel.

st.worldbook.entriesA

List entries from one worldbook with core trigger and insertion fields.

Inputs: book (required).

st.worldbook.entry.configureB

Create, update, enable/disable, or delete a single worldbook entry. Requires confirm: true.

Inputs: book (required), uid, action, fields, +4 more.

st.worldbook.inspectA

Read one worldbook including entries and extension metadata.

Inputs: book (required).

st.worldbook.listA

List existing worldbooks.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 60 tools

    Disambiguation3/5

    Most tools are namespaced by concrete resource and action, but generic st.resource.read and st.resource.patch overlap with the many typed list/inspect/configure/patch tools, and st.doctor, st.bridge.health, and st.runtime.control all touch runtime status. The descriptions help clarify intent, but at 60 tools there are still several near-boundary choices an agent must disambiguate.

    Naming Consistency4/5

    The dominant st.<domain>.<action> convention is consistent and readable, with clear verb choices like list, inspect, read, write, patch, configure, and registry. A few names such as st.doctor, st.config_locations, st.snapshot, and st.plan_change break the pattern, and some tools differ in granularity, but the overall naming system is still predictable.

    Tool Count1/5

    60 tools is far above the typical well-scoped 3-15 tool surface and falls explicitly in the 50+ extreme range. Even though the tools are organized across SillyTavern subdomains, the sheer count will burden model selection and make the tool surface hard to navigate efficiently.

    Completeness4/5

    The server covers nearly every major SillyTavern subsystem: characters, worldbooks, chats, config, extensions, plugins, MVU, regex, variables, quick replies, snapshots, and runtime control. The main gaps are lifecycle operations such as explicit character creation/deletion and chat creation/deletion, but the rest of the surface is unusually comprehensive.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers