MotherDuck Now Speaks Postgres! Our pg_endpoint is now live!Demo - April 21

Skip to main content

Restricting to read-only access

The remote MCP server exposes both the read-only query tool and the read-write query_rw tool. If you want to ensure your AI assistant can only read data, there are three approaches depending on your setup.

ApproachEnforcementSetupWorks with OAuth connectors
Block the tool at the clientClient-sideLow (UI toggle)Yes
Use a read scaling tokenServer-sideMedium (manual config)No (replaces OAuth)
Proxy filteringApplication-sideVariesN/A (custom backend)

Block the query_rw tool at the client

The simplest approach: keep using the OAuth connector, but configure your MCP client to never call the query_rw tool. The server still exposes the tool, but the client will never invoke it.

Most clients support this at the individual user level. ChatGPT also lets organization admins enforce tool restrictions across all workspace members.

Each user can block tools individually. Go to Settings → Connectors → MotherDuck, expand Write/delete tools, and select the blocked icon next to query_rw:

Blocking the query_rw tool in Claude's connector settings

note

Claude does not support org-level per-tool blocking. Team/Enterprise admins can remove a connector entirely from Organization settings → Connectors, but cannot selectively disable individual tools like query_rw for all members.

Claude connector permissions documentation

Use a read scaling token

For server-side enforcement, authenticate with a read scaling token instead of a regular access token. Read scaling tokens connect to dedicated read replicas that reject all write operations — even if the client calls query_rw, writes will fail. This requires manual configuration instead of the one-click OAuth connectors.

note

Read scaling connections are eventually consistent. Results may lag a few minutes behind the latest database state.

You can create a read scaling token from the MotherDuck UI under Settings → Access Tokens or through the REST API.

Read scaling tokens also unlock concurrent MCP sessions: each MCP instance that connects with a read scaling token is assigned to a read replica (duckling) from a pool. Up to the pool size (default 4, max 16), each connection gets its own duckling; once the pool is full, new connections are assigned to existing ducklings in round-robin. This means you can run many MCP sessions in parallel from the same account—for example, multiple AI agents or team members querying simultaneously. See Read Scaling for details on pool sizing and how replicas are assigned.

Claude's web connector only supports OAuth, so you need to use the desktop config instead. Open Settings → Developer → Edit Config and add:

{
"mcpServers": {
"MotherDuck": {
"command": "npx",
"args": [
"mcp-remote",
"https://api.motherduck.com/mcp",
"--header",
"Authorization: Bearer ${MOTHERDUCK_TOKEN}"
],
"env": {
"MOTHERDUCK_TOKEN": "<your_read_scaling_token>"
}
}
}
}

This uses mcp-remote to bridge the remote MCP server into Claude Desktop's local stdio transport.

Proxy filtering

If you're integrating the remote MCP server into a backend service or custom agent framework, you can restrict access at the application layer. When proxying MCP tool calls, omit or reject calls to the query_rw tool and only forward calls to the read-only query tool and schema exploration tools.

See Building Analytics Agents for patterns on building custom agent integrations with read-only access controls.