You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): only register read-only tools in read-only mode
When read_only is enabled, the MCP server no longer registers the
service-mutating tools (create, fork, start, stop, resize,
update_password), so clients never see them and won't attempt them or
prompt for inputs that would only fail. Read tools and db_execute_query
(which connects read-only) stay registered.
A generic addTool wrapper skips registration for tools in
readOnlyGatedTools when the server is read-only; that slice is the single
source of truth, shared with the server instructions. The handler-level
common.CheckReadOnly guards are kept as a backstop for read_only being
toggled on mid-session.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Running the Tiger CLI from the agent is not allowed. Use the Tiger MCP tools instead of shelling out to the CLI."}}
base:="Tiger MCP provides tools for creating, managing, and querying Tiger Cloud database services (managed TimescaleDB/PostgreSQL). "+
40
-
"Use it to provision and fork services, start/stop/resize instances, rotate credentials, fetch service logs, execute SQL queries, and search Tiger documentation."
48
+
intro:="Tiger MCP provides tools for managing and querying Tiger Cloud database services (managed TimescaleDB/PostgreSQL). "
41
49
42
50
ifcfg==nil||!cfg.ReadOnly {
43
-
returnbase
51
+
returnintro+
52
+
"Use it to provision and fork services, start/stop/resize instances, rotate credentials, fetch service logs, execute SQL queries, and search Tiger documentation."
44
53
}
45
-
returnbase+" "+
46
-
"READ-ONLY MODE IS ENABLED. The following Tiger MCP tools will refuse to run: "+
47
-
strings.Join(readOnlyGatedTools, ", ") +". "+
48
-
"Before asking the user to provide inputs for any of these operations, tell them read-only mode is on."
54
+
// Read-only mode: announce the mode and the blocked operations so the model
55
+
// won't attempt them.
56
+
returnintro+
57
+
"READ-ONLY MODE IS ENABLED. Service-mutating tools are not registered, so do not offer to create, fork, start, stop, resize, or modify services. "+
58
+
"db_execute_query connects read-only, so writes and DDL are rejected by the server."
49
59
}
50
60
51
61
// NewServer creates a new Tiger MCP server instance. The caller-supplied cfg
-**Tiger MCP** — write tools (`service_create`, `service_fork`, `service_start`, `service_stop`, `service_resize`, `service_update_password`) are not registered, so they don't appear in `tools/list` and can't be called. Handlers still gate on `read_only` as a backstop for mid-session toggling.
67
67
-**Tiger CLI** — the matching `tiger service` subcommands (plus `service delete`) return an error.
68
68
-**Database sessions** — `tiger db connect`, `tiger db connection-string`, and the `db_execute_query` MCP tool open with `tsdb_admin.read_only_connection=true` even without `--read-only`.
69
69
70
70
Intended for AI agents that should be able to read Tiger Cloud resources without risk of mutation. `tsdb_admin.read_only_connection` is a Tiger Cloud GUC injected as a startup `options` parameter; it activates an immutable read-only connection so writes and DDL are rejected by the server itself and cannot be re-enabled with a `SET` statement.
71
71
72
72
To toggle: `tiger config set read_only true` / `tiger config unset read_only`.
73
73
74
-
When read-only mode is enabled, the MCP server includes a warning in its `initialize` response `instructions`field listing the gated tools and asking the LLM to inform the user before gathering inputs for them. The instructions are read at server start; if the user toggles `read_only` mid-session, the warning is stale until the MCP client restarts (the gate and the GUC injection are both unaffected because handlers reload config per call).
74
+
When read-only mode is enabled, the `initialize` response `instructions`announce that read-only mode is on but describe only the read tools, never naming the gated write tools. Both tool registration and instructions are evaluated once at server start, so toggling `read_only` mid-session leaves them stale until the MCP client restarts (the handler-level gate and GUC injection are unaffected, since handlers reload config per call).
0 commit comments