Skip to content

πŸ›‘οΈ Synology MCP Server v1.9.0 - Safety Hardening & Published Image

Latest

Choose a tag to compare

@atom2ueki atom2ueki released this 21 Nov 07:52
278eac3

πŸ›‘οΈ Safety release. Destructive calls now pass an HMAC-bound confirmation form, every call lands in an append-only audit trail, delete prefers a same-share trash folder, and File Station writes can be confined to chosen folders per NAS or globally. MCP_TOOL_PROFILE turns "monitor only" and "no destructive tools" into real deployment modes. The first multi-arch container image is published to GHCR. Two behaviour changes matter on upgrade β€” destructive tools require confirmation by default, and writes whose target is a share/volume root are refused β€” read Backward Compatibility before upgrading.

✨ Added

  • Published multi-arch container image at ghcr.io/atom2ueki/mcp-server-synology, built for linux/amd64 and linux/arm64 on release tags. Stable releases get X.Y.Z, X.Y and latest; manual branch builds publish edge. The image carries no credentials β€” pass them at run time. 1.9.0 is the first release with an image. (#143)
  • MCP_TOOL_PROFILE (server.tool_profile): full (default), no_destructive or read_only. Filtering happens at registration, so a withheld tool is absent from tools/list and cannot be called; a spec cannot exist without annotations, and synology_login/synology_logout stay available in every profile so a read-only deployment can still establish a session. (#144)
  • MCP_FILESTATION_WRITE_PATHS (synology.<name>.filestation_write_paths per NAS): a comma-separated allow-list for create_directory, create_file, copy_file, move_file, rename_file and delete. Moves check both ends (removing the source is a write); copies check only the destination. Out-of-list targets fail with path_outside_roots before any NAS call. Empty by default. (#140, #145, #146)
  • password_env per-NAS setting names an environment variable to read the NAS password from when settings.json loads, so a launcher can source it from a secret manager and the file never stores it. An entry that sets both password and password_env, or whose variable is unset or empty, is skipped with a warning. (#138)
  • Login Portal reverse proxy tools β€” synology_reverse_proxy_list, _get, _create, _update, _delete, plus synology_access_control_profile_list. Updates layer the given fields over the stored entry; writes are serialized per NAS because each one reloads nginx, and a timed-out write is reported outcome_unknown rather than retried. (#128)
  • DSM/package update and security posture tools β€” read-only synology_update_status and synology_security_posture, plus confirm-gated synology_dsm_update_download, synology_dsm_update_install (dry-runs DSM's own prechecks without confirm=true), synology_terminal_set, synology_autoblock_set, synology_autoblock_allow_add/_remove and synology_https_redirect_set. Each setting write changes only the fields asked for, reads back, and reports outcome: unknown instead of retrying a possibly-applied change. (#130)
  • skills/synology-recovery/ β€” a snapshot-restore runbook distilled from a real incident: inventory, snapshot-vs-live diff, missing-only restore with cp --reflink=always, checksum verification, the stale-mount trap, and the rule that rm -rf must never touch a mount point. (#142)

πŸ”’ Security

  • Per-call audit trail. Every tool call appends one JSON line to logs/audit.jsonl (configurable): run id, tool, risk tier, masked arguments, outcome, duration and error. Before a destructive call the server writes and flushes an intent record and refuses the call with audit_unavailable if it cannot; after any call the append is best effort, because the action already happened. Rotation by size; MCP_AUDIT=false disables it. (#142)
  • Destructive tools require confirmation, bound to the exact call. On an MCP 2026-07-28 connection the first call returns an InputRequiredResult carrying a form and an HMAC-signed, single-use, expiring requestState; only the retry with approval executes. Unsupported clients fail closed. overwrite=true escalates copy/move/create through the same gate. MCP_CONFIRM=mrtr|off. (#142)
  • Capability-detected soft delete. delete moves the target into <share>/#trash/<date>/ first β€” a same-share move with no extra space β€” and falls back to a normal delete only when the share cannot host it. MCP_TRASH=auto|always|never, MCP_TRASH_DIR for an absolute template, placement recorded in the audit trail. Move failures never fall through to a hard delete. (#142)
  • Container environment values no longer leak. synology_container_get returns env_keys (variable names only) for Config.Env and profile.env_variables; credential-shaped keys are dropped at any depth. get_project uses the same sanitizer, which now also recognises env_variables. (#139)
  • MCP annotations on every tool, and untrusted output is fenced. 54 read-only, 18 additive and 35 destructive tools (plus the conditional login/logout pair), declared on each tool's ToolSpec; an omitted destructiveHint stays destructive. Every successful result is wrapped in a random-id <untrusted-data> block so file names, contents, logs and download names read as data, not instructions; the Xiaozhi bridge applies the same fence and uses MCP wire field names. (#134)
  • delete refuses a share root. File Station paths are share-relative and directories delete recursively, so delete("/photos") could remove the whole shared folder. The item's type is read first and a one-segment directory is refused before any delete task starts; a one-segment path whose type cannot be read is refused too. Files inside a share still delete normally, and DSM receives the same normalized path the guard checked. (#136)

πŸ› Fixed

  • Group membership changes now apply. synology_add_user_to_group / synology_remove_user_from_group sent join_groups/leave_groups; DSM accepts those with a task id but never applies them, and the #90 read-back then reported "queued, not applied". They now send join_group and leave_group (singular), both on every call with the unused side as [], matching DSM's own user dialog and the community synology-api client. Reported on DSM 7.3.2 and 7.4.1. (#147, #151)
  • A DSM success: false now sets isError for health, NFS, Container Manager and user-management tools. Previously a refused synology_delete_user or a failed synology_set_user_permissions reached the client flagged as success; the JSON body is preserved on the stdio and HTTP transports. (#135)
  • repository is required in the container pull/download/tags schemas. The handlers already read it unconditionally, so a call without it failed with a bare KeyError. (#142)

πŸ”§ Changed

  • One declaration per tool. Descriptions, JSON schemas, handlers and MCP annotations now live together on a ToolSpec in src/tools/; the tool_safety name tables, annotations_for() and unclassified() are gone. tools/list returns the same 107 tools with the same descriptions, schemas and annotations β€” verified against the old registry β€” with only synology_health_summary moving to sit with the health tools. A tool cannot be declared without a classification, and an unknown handler fails at registration.
  • File Station handlers share _base_url_for/_filestation_for. Write handlers still admit the target before resolving a session, so a refused path is reported before a missing login.
  • The release image and package version are 1.9.0. The README now points at the pre-built image instead of implying none exists.

🧭 Backward Compatibility

Destructive tools no longer execute on the first call. delete, deletes of shares/users/tasks, service stops/restarts, config replacements and other destructive operations return a confirmation form, or confirmation_required for clients without elicitation support. Set MCP_CONFIRM=off to restore the single-call behaviour; the audit trail still records every call.

File Station writes refuse share, volume and filesystem roots. This applies to every write now, not just delete; dot-segments are normalized first. A client that previously asked to write to /photos or /volume1 now gets invalid_write_path. Writes below a share are unaffected, and an empty MCP_FILESTATION_WRITE_PATHS keeps every other path allowed.

Deletes prefer the trash. With the default MCP_TRASH=auto, delete moves the target into <share>/#trash/<date>/ instead of unlinking it; the result reports soft_delete, trash_path and original_path. MCP_TRASH=never restores the old behaviour.

The audit trail is on by default. A path that cannot be written refuses destructive calls with audit_unavailable; point MCP_AUDIT_LOG at a writable location or set MCP_AUDIT=false to run without a trail.

Internal classification names are gone. tool_safety.TOOL_ANNOTATIONS, annotations_for() and unclassified() were removed; annotations now come from each ToolSpec. These were not part of the documented API.

Everything else keeps working. The default profile is still full, the write allow-list is empty, stdio/HTTP/Xiaozhi transports and all existing tools are unchanged, and the container image still contains no credentials.

πŸŽ‰ New Contributors

πŸ“š Full Changelog

1.8.0...1.9.0