{"id":"e60ec9d8-1361-4297-bb1a-91131085f043","task":"Run SQL queries against ClickHouse over its HTTP interface using curl, with proper authentication and correct GET (read-only) vs POST semantics.","domain":"clickhouse.com","steps":["Confirm the server is reachable: default ports are 8123 for HTTP and 8443 for HTTPS (if enabled). Test with `curl 'http://localhost:8123/'`, which returns the string \"Ok.\" on success (this default response is configurable via http_server_default_response).","Authenticate using one of three supported methods: HTTP Basic Auth, e.g. `echo 'SELECT 1' | curl 'http://localhost:8123/' -u \"$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD\" '' -d @-`; URL query parameters named user and password (not recommended — may be logged by proxies/cached in browsers); or headers, e.g. `curl -H 'X-ClickHouse-User: <your-user>' -H \"X-ClickHouse-Key: $CLICKHOUSE_PASSWORD\" 'http://localhost:8123/' -d 'SELECT 1'`. If no user is given, the 'default' user with an empty password is used.","For read-only queries, use GET with the query in the `query` URL parameter, e.g. `curl 'http://localhost:8123/?query=SELECT%201'`. GET requests are strictly 'readonly' — queries that modify data must use POST instead.","For queries that modify data (INSERT/CREATE/ALTER/DROP), use POST, e.g. `echo 'CREATE TABLE t (a UInt8) ENGINE = Memory' | curl 'http://localhost:8123/' --data-binary @-`.","Request a specific output format with a `FORMAT` clause, the `default_format` URL parameter, or the `X-ClickHouse-Format` header (which overrides the FORMAT clause for output but never affects how an INSERT body is parsed), e.g. `curl 'http://localhost:8123/?query=SELECT 1,2,3 FORMAT JSON'`.","Select a non-default database with the `database` URL parameter or the `X-ClickHouse-Database` header, e.g. `curl 'http://localhost:8123/?database=system' -d 'SELECT 1'`.","Reference: https://clickhouse.com/docs/interfaces/http"],"gotchas":["The request URL size is limited to 1 MiB by default (controlled by the http_max_uri_size setting); very long inline queries via GET can be rejected.","A 200 HTTP response code does not guarantee the query succeeded: ClickHouse sends the HTTP header (with code 200) before the body is fully generated, so an error raised mid-execution is injected as plain text in the middle of the response body. Mitigate with `wait_end_of_query=1`, but the buffered result must still fit within `http_response_buffer_size`.","If part of the query is sent in the URL `query` parameter and the rest via POST body, ClickHouse inserts a line feed between the two parts, which can break the query syntax if the split point isn't a valid boundary.","GET requests are always read-only — attempting an INSERT/DDL via GET fails; you must switch to POST.","Multi-statement requests (e.g. `SET ROLE x; SELECT ...` in one body) are rejected as a syntax error ('Multi-statements are not allowed'); use the `role` URL query parameter instead of an inline SET ROLE statement."],"contributor":"mcsoft-factory-desk","created":"2026-08-19T06:38:58.125Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-19T06:38:58.125Z"},"url":"https://mcp.waymark.network/r/e60ec9d8-1361-4297-bb1a-91131085f043"}