Agents (MCP)
Requires Pro
ElyraSQL Client can act as an MCP server, the protocol AI agents such as
Claude Code use to reach tools. An agent can then read the databases you have
saved here: list tables, describe them, and run SELECTs. It does that through
the connection you already set up, without a connection string of its own.
Why this rather than giving the agent a password:
- The password stays in the keychain. The agent names a connection, for
example
Shop. The client looks up the password itself and never sends it to the agent. - Nothing is shared until you tick it. Each connection is opt-in.
- Reads only. Writes are refused, whatever the agent sends.
- You can see what it ran. Every agent query lands in your History, marked agent.
Set it up
- Open Settings (⌘/Ctrl + ,) → Agents (MCP).
- Tick the connections an agent may read. A production connection says so in red once ticked, because the agent can then read production data.
- Copy the setup line for your agent.
For Claude Code:
claude mcp add elyrasql -- "/Applications/ElyraSQL Client.app/Contents/MacOS/elyrasql-client" --mcp
For other MCP clients, the JSON form:
{
"mcpServers": {
"elyrasql": {
"command": "/Applications/ElyraSQL Client.app/Contents/MacOS/elyrasql-client",
"args": ["--mcp"]
}
}
}
The settings pane shows both with the path to your copy of the app filled in. If you move the app, copy the line again.
The app does not have to be running. The agent starts elyrasql-client --mcp
as a background process, with no window, and stops it when it is done.
Ticking or unticking a connection takes effect on the agent's next request, with
no restart.
What an agent can do
| Tool | What it returns |
|---|---|
list_connections |
The shared connections: id, name, engine, environment, and whether personal data is masked |
list_databases |
Databases on one of them |
list_tables |
Tables and views, with row estimates where the engine has them |
describe_table |
Columns (type, nullability, key, default) and declared foreign keys |
run_query |
The rows of one read, as JSON |
run_checks |
Runs your saved checks for a database: passed, failed with up to 10 offending rows, or error |
propose_sql |
Hands a change to you for review — see below. Runs nothing |
proposal_status |
Whether you ran it, and what came of it |
Rows per query in the settings pane caps what run_query returns. The
default is 100 and the maximum 1,000. The agent's context is the scarce
resource, so a small cap pushes it to aggregate in SQL instead of paging through
rows. Values longer than 500 characters are cut, and the result says so.
Masked personal data
An agent debugging against production-like data does not need to know who the customers are — only that the order and the invoice point at the same one. Tick Mask personal data under a shared connection, and every personal value a read returns is replaced by a pseudonym before it reaches the agent, so no real customer data leaves your machine for the agent's model.
A production connection is masked when you first share it. To mask every
connection, whatever is ticked, start the server with --mask-pii — the
settings pane has a checkbox that adds it to the setup command:
claude mcp add elyrasql -- "/Applications/ElyraSQL Client.app/Contents/MacOS/elyrasql-client" --mcp --mask-pii
What is masked. Columns whose names say they are personal — email, phone,
first/last/full name, username, address, national id, passport and card
numbers, birth date, IP address, passwords and tokens, free-text notes — in
the tables and views a query reads, found the same way as for a
masked slice. Each value becomes an HMAC of itself, in its own
format: an email stays an email (u3fa9c1d2e4@ex.invalid), a phone number
keeps its length and punctuation, a birth date keeps its year.
Still joinable. The key is drawn when the server starts and never stored,
so within a session the same value always gets the same pseudonym —
ola@example.no in customers.email and orders.customer_email shows up as
one address, and GROUP BY and joins line up. A new session gets new
pseudonyms, so two sessions' results cannot be linked.
What an agent may do with a personal column. Return it as it is (under its
own name, an alias, or *), count it, compare it with =, <>, IN or
IS NULL in WHERE, HAVING and ON, and use it plainly in GROUP BY and
JOIN … USING. Everything else is refused before it runs, with a message
saying so: LIKE, SUBSTR, LOWER, MIN, CASE, sorting on it, and a
UNION that sets it beside a literal — each of those can spell a value out
one question at a time. Because the database holds the real values, a
pseudonym cannot be used in a WHERE; the agent filters by a key column
instead, and the server's instructions tell it so.
Around the edges. On a masked connection a query reads one database (the
information_schema, performance_schema, mysql, sys and ClickHouse
system databases are refused — the process list and statement history carry
other sessions' values), generic SHOW statements such as SHOW PROCESSLIST
are refused, and ClickHouse table functions and dictionary lookups that read
tables by name are refused. Error messages lose any quoted value the agent
did not write itself, run_checks shows your saved checks with their
literals removed and their sample rows masked, and list_connections tells
the agent which connections are masked.
What it does not promise
Columns are found by name. A column called contact that holds phone
numbers, or a JSON document with an email inside, is not masked; neither
are values that identify someone only in combination (a postcode and a
birth year). An agent can still test whether a value it already has is
present (WHERE email = 'ola@example.no'). Masking keeps the people out
of what an agent reads; it does not make the data anonymous.
Proposals: changes the agent hands to you
When an agent has worked out what to change — delete the expired sessions,
add the missing index — it does not run it, and it does not have to paste the
SQL into the chat either. propose_sql hands the statement to you, with a
one-line title and the agent's reason:
- Nothing runs. The proposal is stored on your machine, and a Proposals (n) button appears in the toolbar within a few seconds.
- Open in a tab puts the statement in its own query tab, on the connection and database the agent wrote it for. A banner says it came from an agent. You can edit it like any other query.
- Run asks first, every time. Before a proposal that writes runs, the confirmation shows what each statement would touch — Deletes 2 rows from sessions, with the rows — on any connection, not only production. You did not write this statement, so you see its reach before it changes anything.
- It runs only where it was written for. If you switch to another
connection or database, Run refuses and says which one it belongs to. A
DELETEwritten against staging cannot run against production because production happened to be selected. - The agent learns the outcome.
proposal_statusreports ran (with the rows affected, and whether you edited it first), failed (with the error), or dismissed.
At most 20 proposals can wait at once, so an agent stuck in a loop cannot bury
the list. A proposal with an executable comment (/*! … */) is refused, because
you would read it as a comment and the server would run it.
How writes are kept out
Each layer below is enough on its own for the common case. They are stacked because an agent's input is not something to trust.
- The statement is parsed, not guessed. It must be exactly one
SELECT,WITH … SELECT,EXPLAIN,DESCRIBEorSHOW. It may not containINTO,FOR UPDATEor an executable comment (/*! … */,/*M! … */, which the server runs but every check would read as a comment), and it must also pass the same read check the app uses elsewhere. Functions that reach outside the database or take locks are refused by name, for exampleLOAD_FILE,GET_LOCK,SLEEPandNEXTVAL. On ClickHouse, only table functions that stay on the server are allowed:numbers,zeros,generateRandom,values,nullandmerge.url(),s3(),file(),remote()and the rest are refused. - The connection is opened read-only. The client's write rails refuse
everything on it. A SQLite file is opened read-only by SQLite itself, and
ClickHouse is asked for
readonly=2, so those engines refuse writes too. On ElyraSQL, MySQL and MariaDB the read-only flag is the client's own, and layer 3 is the protection on the server. - On ElyraSQL, MySQL and MariaDB, each read runs in a read-only transaction that is always rolled back. MySQL and MariaDB refuse a write inside it. ElyraSQL (1.12) accepts the syntax but does not enforce it, so there the rollback undoes a write that got past the layers above.
- Each read is bounded. It stops after 30 seconds, or sooner if the connection's own statement timeout is shorter.
The server's own privileges still apply on top. For the strictest setup, share
a connection whose database user can only SELECT.
Troubleshooting
"No connections are shared with agents yet." Tick at least one connection in Settings → Agents (MCP).
"This is a Pro feature." The server starts on any edition and answers every request with this message, so the agent can tell you why it got nothing.
A remote connection is refused. Remote connections and SSH tunnels need Pro, exactly as they do in the app.