---
ref: tool:metabase/run-sql-query
name: Run a SQL query
company: company:metabase
workflows: []
access: [mcp]
tags: [capability:track-product-usage, category:product-analytics, has:mcp]
docs: https://www.metabase.com/docs/latest/ai/mcp
updated: 2026-09-27
---

# Run a SQL query

Runs a native SQL query against a connected database and returns the rows.

Needs native-query permission on the target database.

## Set up

Use the first option your agent supports.

### MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "metabase": { "url": "https://{your-metabase-url}/api/metabase-mcp" } } }
```

Call the MCP tool `execute_sql`.

Server URL: https://{your-metabase-url}/api/metabase-mcp

Before doing anything else, make one read-only call to confirm access.

## Rules

- Ask the user before anything that sends messages, costs money, or changes data.
- Never print API keys.
