Nutho Preset Editor
A high-performance, concurrency-safe editor and Model Context Protocol (MCP) integration server for SillyTavern Chat Completion presets.
Nutho Preset Editor bridges visual prompt engineering in the browser with autonomous AI agent workflows in Claude Desktop, Cursor, Cline, Open Code, and Antigravity. It enables real-time collaborative preset authoring, structural validation, macro diagnostics, and non-destructive prompt ordering.
Architectural Highlights
- Dual-Transport MCP Architecture: Provides full Model Context Protocol server capabilities over both standard input/output (
stdio) and Streamable HTTP (SSE) on/mcp. - Live Session Auto-Bridge: When the web UI server runs on loopback port 4173,
stdioMCP clients transparently route commands to the live session, ensuring the browser UI and AI agents operate on the exact same in-memory state. - Optimistic Concurrency & Revision Safety: Every operation tracks integer revision counters. Concurrent edits from agents and users are safely sequenced, preventing accidental overwrites and silent data corruption.
- Real-Time Live Synchronization: Utilizes Server-Sent Events (SSE) on
/api/session/eventsto push mutations, external disk changes, and active prompt navigations instantly to connected browser tabs. - Always Auto-Navigate: When an external AI agent creates, updates, or moves a prompt via MCP, the web UI automatically switches focus to the affected prompt without manual user interaction.
- SillyTavern Schema Fidelity: Preserves all known and unknown fields, duplicate order references, marker rows, custom parameters, and format quirks across SillyTavern V1 and V2 specifications.
- Strict Aesthetic Design: Engineered with a zero-emoji interface, monospace data views, zero layout shift (CLS 0.00), and accessible high-contrast typography.
System Architecture
+-------------------------------------------------------------------+
| AI Coding Agents |
| Claude Desktop * Cursor * Cline * Open Code * AGY |
+---------------------------------+---------------------------------+
|
JSON-RPC 2.0 via | JSON-RPC 2.0 via
HTTP SSE (/mcp) | stdio (Auto-Bridge Proxy)
v
+-------------------------------------------------------------------+
| Nutho MCP Server & HTTP Service |
| (Loopback HTTP: 127.0.0.1:4173) |
+---------------------------------+---------------------------------+
|
Internal Session Bus (SSE)
v
+-------------------------------------------------------------------+
| Browser Web UI |
| Prompt Editor * Order Organizers * Diff & Diagnostics |
+---------------------------------+---------------------------------+
|
Filesystem I/O (Safe Backups)
v
+-------------------------------------------------------------------+
| SillyTavern OpenAI Settings Directory |
| (*.json Preset Files on Disk) |
+-------------------------------------------------------------------+
Key Capabilities
1. Visual Preset & Prompt Management
- Interactive editing of system prompts, jailbreaks, pre/post-history instructions, and author notes.
- Support for SillyTavern macros (e.g.,
{{char}},{{user}},{{input}},{{model}},{{lastMessage}}). - Drag-and-drop prompt reordering across generation contexts.
- Marker element isolation and read-only source preservation.
2. Comprehensive Sampling Parameters
Full support for updating and validating LLM sampling parameters:
temperature,top_p,top_k,min_p,typical_ppresence_penalty,frequency_penalty,repetition_penalty,repetition_penalty_rangemax_tokens,context_window,mirostat,mirostat_tau,mirostat_etacfg_scale,temperature_last, and custom sampler order arrays.
3. Diagnostics and Diff Engine
- Macro audit to identify undefined or malformed placeholders.
- Side-by-side comparative diffing between multiple preset files on disk.
- Prompt impact analysis showing which generation orders reference a target prompt.
- Automated repair routines (
apply_fix,doctor) for orphan entries and broken references.
4. Enterprise Concurrency Control
- Atomic multi-operation batch executions (
apply_batch) committing under a single revision step. - Dry-run validation mode allowing agents to verify mutations before disk commit.
- Deterministic undo and redo stack tracking preset history.
- Automatic byte-exact file backup before writing changes to disk.
Installation & Prerequisites
Prerequisites
- Node.js version 22.0.0 or higher
- Windows, macOS, or Linux
Setup
Clone the repository and install dependencies:
git clone https://github.com/nattaphat010447/nutho-preset-editor.git
cd nutho-preset-editor
npm install
Launching the Server
Option A: Windows Batch Launcher (Recommended for Windows)
Double-click run.bat or execute in terminal:
run.bat
This automatically initializes the server, sets the root directory to your SillyTavern OpenAI Settings path, and launches the Web UI in your default browser at http://127.0.0.1:4173.
Option B: PowerShell Launcher
.\start-server.ps1 -Root "C:\path\to\SillyTavern\data\default-user\OpenAI Settings"
Option C: Node CLI Direct Execution
node server.js --root "/path/to/SillyTavern/data/default-user/OpenAI Settings" --port 4173
Environment variables:
PORT: HTTP port to listen on (default:4173).NUTHO_MCP_TOKEN: Bearer token for authenticating HTTP SSE MCP requests (minimum 32 characters).
Model Context Protocol (MCP) Client Configuration
Nutho Preset Editor supports both Streamable HTTP (SSE) and standard stdio transports.
1. Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"nutho-preset-editor": {
"command": "node",
"args": [
"C:\\Users\\User\\Documents\\Code\\JS\\nutho-preset-editor\\src\\mcp\\stdio.js"
],
"env": {
"NUTHO_ROOT": "C:\\Users\\User\\Documents\\Code\\Phyton\\SillyTarvern\\data\\default-user\\OpenAI Settings"
}
}
}
}
2. Cursor / Cline
Add to cline_mcp_settings.json:
{
"mcpServers": {
"nutho-preset-editor": {
"command": "node",
"args": [
"C:/Users/User/Documents/Code/JS/nutho-preset-editor/src/mcp/stdio.js"
],
"env": {
"NUTHO_ROOT": "C:/Users/User/Documents/Code/Phyton/SillyTarvern/data/default-user/OpenAI Settings"
},
"disabled": false,
"autoApprove": []
}
}
}
3. Open Code
Add to opencode.jsonc:
{
"mcp": {
"servers": {
"nutho-preset-editor": {
"command": "node",
"args": [
"C:/Users/User/Documents/Code/JS/nutho-preset-editor/src/mcp/stdio.js"
],
"environment": {
"NUTHO_ROOT": "C:/Users/User/Documents/Code/Phyton/SillyTarvern/data/default-user/OpenAI Settings"
}
}
}
}
}
4. HTTP SSE Client Configuration
When integrating with an HTTP-based MCP client:
- SSE URL:
http://127.0.0.1:4173/mcp - Headers:
Authorization: Bearer nutho_preset_editor_secret_token_2026_key
MCP Tool Reference (40 Tools)
Session & Lifecycle Management
| Tool | Description |
|---|---|
get_session |
Retrieve active preset metadata, file path, revision counter, and dirty state. |
list_files |
List all .json preset files in the configured root directory. |
open |
Load a specified preset file into the active workspace. |
create_default_st_preset |
Instantiate a clean SillyTavern default preset template in memory. |
bind |
Bind an in-memory or imported document to a target file path on disk. |
save |
Persist active workspace changes to disk with automatic byte backup. |
reload |
Discard in-memory changes and reload the preset directly from disk. |
close |
Close the active preset session and release memory buffers. |
Prompt & Order Operations
| Tool | Description |
|---|---|
list_prompts |
Enumerate all prompt blocks with identifiers, roles, and content previews. |
get_prompt |
Retrieve full content and attributes of a prompt by identifier. |
create_prompt |
Insert a new prompt block into the preset. |
update_prompt |
Modify text, role, marker flags, or metadata of an existing prompt. |
delete_prompt |
Remove a prompt block and detach associated references across all orders. |
reset_prompt |
Revert a prompt to its original factory state if provided by default schemas. |
list_orders |
List all generation order profiles configured in the preset. |
get_order |
Retrieve the ordered prompt sequence for a specific context identifier. |
add_prompt_to_order |
Add an existing prompt reference into an order at a target index or anchor. |
move_prompt |
Reorder a prompt entry within a specific order context. |
detach_order_entry |
Remove a prompt reference from an order without deleting the prompt source. |
set_order_entry_enabled |
Toggle the active execution state of a prompt within an order. |
reorder_order_entry |
Move an entry to an explicit new index position in the sequence. |
replace_order |
Replace an entire order sequence atomically. |
reset_order |
Revert an order sequence to default baseline configuration. |
Sampling & Diagnostics
| Tool | Description |
|---|---|
update_settings |
Update generation settings (temperature, top_p, top_k, penalty parameters). |
get_prompt_impact |
Analyze which orders and execution contexts depend on a given prompt. |
validate |
Perform strict structural and schema validation on the active preset. |
diagnose |
Run comprehensive health check detecting invalid macros, orphans, and anomalies. |
doctor |
Automatically repair detected schema inconsistencies and dangling references. |
apply_fix |
Apply an explicit diagnostic recommendation directly to the session. |
compare_presets |
Perform detailed semantic diff between two preset files on disk. |
diff |
Generate unified diff comparing working draft against disk state. |
preview |
Generate projected output sequence simulating prompt insertion order. |
Transactional & Batch Tools
| Tool | Description |
|---|---|
apply_batch |
Execute multiple operations atomically with optional dry-run preview. |
undo |
Revert the most recent operation in the session history. |
redo |
Re-apply the previously undone operation in the session history. |
revert |
Reset the active document state to the latest saved disk revision. |
import_json |
Ingest external raw JSON preset data into the working draft. |
export_json |
Export the current document state as a formatted JSON payload. |
MCP Resources & Prompts
Available Resources
preset://active: Current active preset document JSON payload.preset://orders: Graph mapping of all generation orders and prompt references.preset://diagnostics: Real-time health diagnostic audit report.preset://files: Catalog of discovered preset files on the local root path.
Available Prompts
analyze-preset: Guided agent inspection of system prompts, ordering logic, and token budgets.compare-presets: Comparative prompt analyzing differences between two target presets.optimize-sampler-settings: Agent audit of temperature, min_p, repetition penalty, and CFG values.
Verification & Testing
Nutho Preset Editor includes an automated test suite verifying protocol conformance, concurrency safety, browser rendering, and schema fidelity.
To run all test suites:
npm test
Test coverage includes:
- Protocol Conformance: JSON-RPC 2.0 validation, strict schema guardrails, error code mapping.
- Concurrency Safety: Race condition simulation, revision collision rejection, atomic transactions.
- Aesthetic Consistency: DOM inspection verifying zero emoji characters and zero cumulative layout shift.
- Browser Automation: Headless Chromium testing covering splitter drag, order manipulation, and SSE updates.
License
This project is licensed under the MIT License. See the LICENSE file for details.