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
{{ message }}
Repository navigation
Commit d88dd20
Browse filesBrowse the repository at this point in the historyBrowse files
fix(mcp): enforce source read-only queries and clean up server output
- Without `--allow-write`, every source query from the MCP tools requests
database-enforced read-only where the engine supports it (Postgres read-only
transaction, SQLite `query_only`, DuckDB read-only open). Engines without
database-level read-only are still served, but `warehouse_list`, a stderr
notice at start-up and the docs say plainly that stored functions with side
effects are not blocked and a read-only database user is recommended.
- Spill output goes to a private per-process directory that is removed when
the server closes, through the shared truncation service (user output
limits and failure wording preserved).
- MCP-facing text names only the exposed tools: no `lineage_check` tip from
`schema_inspect`, and client-neutral `full_text_columns` guidance.
- `--connections` uses the registry's path resolution and rejects the
reserved `scratch` name at start-up; docs state the file replaces
discovery. `--print-logs`/`--log-level` now apply to `mcp serve`.
- Tests: in-process MCP server tests need real drivers, so they run in a
dedicated CI step (`ALTIMATE_MCP_E2E=1`); the allow-write read-back and
middleware-skip regressions now fail when the behaviour regresses.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copy file name to clipboardExpand all lines: docs/docs/configure/mcp-servers.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,9 +31,13 @@ The server exposes exactly `warehouse_list`, `schema_inspect`, `sql_execute`, `s
31
31
}
32
32
```
33
33
34
-
Relative database paths resolve beside this file. Omit `--connections` to use normal connection discovery: global and project `.altimate-code/connections.json` files, followed by `ALTIMATE_CODE_CONN_*` environment overrides. Set your client's working directory to the project when using project discovery.
34
+
Relative database paths resolve beside this file. With `--connections`, this file is the only source of connections: global and project `connections.json` files and `ALTIMATE_CODE_CONN_*` overrides are ignored. Omit `--connections` to use normal connection discovery: global and project `.altimate-code/connections.json` files, followed by `ALTIMATE_CODE_CONN_*` environment overrides. Set your client's working directory to the project when using project discovery.
35
35
36
-
Source writes are refused by default. Add `--allow-write` to enable SQL write permissions; existing hard safety blocks still apply. `sql_materialize` always requires a read-only source query and writes only into the server session's temporary `scratch` warehouse. Scratch tables disappear when the server exits. Large results may include a local spill file path that your client can open with any file reader.
Source writes are refused by default. Without `--allow-write`, source queries request database-enforced read-only execution on PostgreSQL, SQLite and DuckDB. For other connection types, read-only is enforced by SQL classification only; stored functions with side effects are not blocked — use a read-only database user. The server prints this caveat on stderr at startup and includes it in `warehouse_list` for each affected connection. Add `--allow-write` to enable SQL write permissions; existing hard safety blocks still apply. `sql_materialize` always requires a read-only source query and writes only into the server session's temporary `scratch` warehouse. Scratch tables disappear when the server exits. Large results may include a local spill file path that your client can open with any file reader. Spill files use a private directory and are deleted when the server exits. Local `tool_output.max_lines` and `tool_output.max_bytes` settings control output limits; remote agent configuration is not loaded.
39
+
40
+
<!-- altimate_change end -->
37
41
38
42
The server writes only MCP protocol messages to stdout and sends logs to stderr. It does not initialize telemetry and honors `ALTIMATE_TELEMETRY_DISABLED`.
generate: ()=>Effect.die(newError("MCP data tools never generate agents or call a model")),
42
+
}),
43
+
),
44
+
Truncate.makeLayer({
45
+
directory,
46
+
limits: ()=>Effect.succeed(limits),
47
+
hint: (file,outcome)=>
48
+
`The tool call ${outcome==="error" ? "failed" : "succeeded"} but the output was truncated. Full output saved to: ${file}\nOpen this path with any file reader to inspect the remaining output.`,
return`${connection.name} (${connection.type}): read-only is enforced by SQL classification only; stored functions with side effects are not blocked — use a read-only database user`
0 commit comments