MCP Integration (--mcp)
Connect AI coding agents to Restic Tray's built-in 22-tool stdio MCP server with local Named Pipe authentication and opt-in destructive safeguards.
The same single binary ships with a built-in Model Context Protocol (MCP) stdio JSON-RPC 2.0 server invoked via restic-tray.exe --mcp. AI coding agents such as Claude Code, Claude Desktop, and Cursor can verify backup status before risky refactors, trigger dry-runs, diff snapshots, and restore files safely.
How Communication Works
Architecture
MCP Client
── stdio (JSON-RPC 2.0) ──▶ restic-tray.exe --mcp
── Named Pipe (256-bit mutual token) ──▶ Running Tray App
- Tray app running:
--mcpreads the ephemeral pipe name and 256-bit CSPRNG token from%LOCALAPPDATA%\io.github.nayuengin.restic-tray\agent-bridge.json, authenticates in constant time, and relays requests over a local Windows Named Pipe (reject_remote_clients(true)). Results appear immediately in the GUI and SQLite audit log. - Headless fallback: If the tray app is closed,
--mcpseamlessly falls back to a local controller so agents can still inspect status, edit settings, and run backups.
Registering with MCP Clients
Claude Code
PowerShell
claude mcp add --scope user restic-tray -- "$env:LOCALAPPDATA\Programs\Restic Tray\restic-tray.exe" --mcp
Claude Desktop / Cursor (mcpServers JSON)
JSON
{
"mcpServers": {
"restic-tray": {
"command": "C:\\Users\\<YourUser>\\AppData\\Local\\Programs\\Restic Tray\\restic-tray.exe",
"args": ["--mcp"]
}
}
}
If you installed via Portable ZIP, point command to the extracted restic-tray.exe path.
Security Model & Safety Defaults
All 22 MCP Tools
Tool descriptions returned inside the MCP protocol are currently in Japanese. This table provides the complete English reference for every tool and its parameters:
| Tool | Arguments | Description |
|---|---|---|
get_status |
None | Tray state, machine name, maintenance role, active targets, multi-PC sync summary, R2/DPAPI readiness, bundled restic version, next run, active progress, and active basic excludes. |
get_config |
None | Returns current non-secret config.json (R2 settings, targets, excludes, schedule, retention, and agent policy). Secrets are never returned. |
get_backup_history |
limit?: number |
SQLite backup runs (including deferred runs, topAdded, bytesDelta, filesDelta, excludesChanged) and audit logs. |
list_snapshots |
tag?, path?, projectKey?, host? |
Lists R2 snapshots with optional filtering by tag, path, shared projectKey, or lowercase host. |
list_snapshot_files |
snapshotId, prefix?, maxEntries? |
Lists files inside a specific snapshot. |
diff_snapshots |
snapshotA, snapshotB |
Computes diff statistics and changed paths between two snapshots. |
get_size_breakdown |
snapshotId?, limit? |
Aggregates file sizes by target root and up to 2 subfolder levels (defaults to latest snapshot, limit 30). |
run_backup |
targetIds?, projectKeys?, dryRun?, tags?, markHandoffReady? |
Runs 1-target-1-snapshot backup to R2. Supports dryRun: true and optional handoff release tagging. |
cancel_backup |
None | Cancels an active backup or takeover restore job immediately (including while waiting on --retry-lock). |
init_repository |
None | Initializes the configured R2 repository via restic init. |
check_repository |
readDataPercent?: number |
Runs restic check; pass 1–100 to download and verify that percentage of stored data. |
update_storage_config |
storageBackend?: "r2", r2?: object |
Validates and updates non-secret Cloudflare R2 settings in config.json (secrets and resticBinaryPath are rejected). |
add_backup_target |
path, label?, excludePatterns?, tags?, enabled?, projectKey?, writerState? |
Canonicalizes and adds/updates a folder target. Rejects projectKey on folders containing .git. |
remove_backup_target |
idOrPath: string |
Removes a backup target by ID or path from config.json. |
update_schedule |
enabled?, intervalMinutes?, dailyAt?, maintenanceAt?, runOnStartup?, autoPruneAfterBackup?, verifyEveryDays?, verifyReadPercent?, notifyOverdueHours? |
Updates schedule, periodic restore check, and overdue alert settings. Prune-affecting options require agent.allowPrune: true. |
update_retention_policy |
keepLast?, keepDaily?, keepWeekly?, keepMonthly? |
Updates snapshot retention counts. Blocked when agent.allowPrune is false. |
restore_snapshot |
snapshotId, targetDir, includePaths? |
Restores a full snapshot or specific includePaths into a separate validated targetDir (enabled by default: agent.allowRestore: true). |
forget_prune |
dryRun?, confirmPrune? |
Opt-in (agent.allowPrune: true). Defaults to dryRun: true; real prune requires both dryRun: false and confirmPrune: true. |
delete_r2_bucket |
scope: "prefixOnly"|"entireBucket", dryRun?, confirmBucketName? |
Opt-in (agent.allowDeleteStorage: true). Defaults to dryRun: true; real delete requires dryRun: false and exact confirmBucketName. |
get_project_sync_status |
projectKey?, refresh?, checkLocalChanges? |
(Experimental) Reports multi-PC shared project sync state (local_latest, remote_newer, not_local, diverged, standby, etc.). |
release_project |
projectKey, dryRun? |
(Experimental) Checks for .git and UnityLockfile, creates a handoff:released snapshot, and switches this PC to standby without deleting local files. |
takeover_project |
projectKey, localPath?, dryRun?, saveLocalBackupFirst?, confirmDiscardLocalChanges?, forceWhileRemoteActive?, deleteExtra?, confirmProjectKey? |
Opt-in (agent.allowHandoff: true, experimental). Defaults to dryRun: true; real takeover requires exact confirmProjectKey and backs up local edits first unless explicitly confirmed. |