Database MCP server for AI agents: live SQL across all your databases
Otterstax is an open-source MCP server for databases that gives AI agents one endpoint to every data source your company runs: MariaDB, PostgreSQL, ClickHouse, S3 and Kafka. The agent sends plain SQL. The federated query engine your apps already use runs it where the data lives, including joins across databases. You don't copy data or build a warehouse snapshot, and the agent doesn't need a separate MCP server for each database.
It works with Claude Code, Claude Desktop, Codex, opencode and any MCP client. Frameworks that speak SQL, Arrow Flight SQL or ADBC can connect directly.
What breaks with one connector per database
An agent can only answer from the data it can reach. In most companies that data is spread across five or more systems: customers in MariaDB, billing in PostgreSQL, events in ClickHouse, files in S3, streams in Kafka.
Teams usually give the agent one MCP connector per database. A question that needs two databases, such as “revenue by country from last month’s signups”, then becomes a chain: the agent queries one database, pastes thousands of IDs into a query to the next, and joins the results in its own context window. This causes three problems:
Results are inconsistent.
The model does the join instead of a database. Limits truncate rows or rows get matched wrong, and nothing reports an error. Two agents, or two runs of the same agent, give different numbers.
Answers are slow.
Every hop adds a tool call, a round trip and thousands of tokens. A dashboard built this way takes minutes or hours to answer.
Warehouse copies are stale.
If you load everything into a warehouse with ETL for the agents, they work with yesterday’s data and you maintain one more pipeline.
To the agent, Otterstax looks like one database: it explores one schema and writes one SQL dialect, and the joins run inside Otterstax.
Connect an agent in three steps
Connect your sources once.
Register MariaDB, PostgreSQL, ClickHouse, S3 or Kafka in the Otterstax catalog. Your apps and agents share the same catalog, so an agent sees exactly the tables your application sees. A source you add appears for every agent at once.
Point the agent at Otterstax.
Use the open-source MCP server, or SQL, Arrow Flight SQL or ADBC if your agent framework speaks them. The agent needs one connection instead of one connector per database.
Query across all sources with one tool.
The agent sends one SQL statement through one endpoint. Otterstax pushes filters down to each source, moves only the rows it needs, runs the joins and aggregations itself, and returns the final result. The agent receives only the answer rows and doesn’t join anything in its context.
Per-database MCP servers vs one federated MCP server
Every major engine has its own MCP server, and multi-connection servers exist too. They’re a good fit when an agent works with one database at a time.
| Per-database server (PostgreSQL, MariaDB, ClickHouse MCP servers) | Multi-connection server (DBHub, MCP Toolbox for Databases) | Otterstax | |
|---|---|---|---|
| Databases per server | 1 | Many | Many |
| Join across databases in one query | No | No: each query goes to one connection | Yes |
| Where the join happens | In the agent’s context | In the agent’s context | In the query engine |
| Same catalog as your apps | No | No | Yes |
| Sources beyond SQL databases | No | Some | S3, Kafka |
If you only need a PostgreSQL MCP server for one database, a dedicated server is enough. The same goes for a ClickHouse MCP server or a MariaDB MCP server: ClickHouse and MariaDB both publish official ones. Otterstax is useful once your agent’s questions need data from more than one database.
Set up the database MCP server
Run Otterstax (quickstart: docker compose up -d brings up MariaDB, two PostgreSQL databases, ClickHouse, S3-compatible storage and Kafka with demo data). Then add the MCP server to your agent. It runs locally and talks to Otterstax over the PostgreSQL wire protocol, so the only setting is OTTERSTAX_URL.
Claude Code
claude mcp add otterstax -e OTTERSTAX_URL=postgresql://localhost:8817 -- npx -y @otterstax/mcpClaude Desktop: open the otterstax-mcp.mcpb bundle, or add this to claude_desktop_config.json:
{
"mcpServers": {
"otterstax": {
"command": "npx",
"args": ["-y", "@otterstax/mcp"],
"env": { "OTTERSTAX_URL": "postgresql://localhost:8817" }
}
}
}Codex (~/.codex/config.toml). Raise the tool timeout: Codex stops a tool after 60 seconds by default, and federated queries over large tables can take longer.
[mcp_servers.otterstax]
command = "npx"
args = ["-y", "@otterstax/mcp"]
tool_timeout_sec = 600
[mcp_servers.otterstax.env]
OTTERSTAX_URL = "postgresql://localhost:8817"The config for opencode and the source code are on GitHub. Requires Node.js 22+.
Tools the agent gets
| Tool | What it does |
|---|---|
list_databases |
Every registered source and local database |
list_tables, list_schemas |
Tables under the full names to use in SQL, e.g. sales.ops.orders |
search_objects |
Find tables or columns by pattern across all sources |
describe_table |
Columns, types, nullability |
table_stats |
Row count, distinct and NULL counts, min and max per column |
explain_query |
Query plan before running |
execute_sql |
Runs the query, returns columns and rows |
The server also passes the agent Otterstax’s SQL rules (table naming, date handling) as MCP instructions, so its first query is right more often.
Example: a revenue query across MariaDB and ClickHouse
Ask the agent “What’s our revenue by country in the last hour?”. Users live in MariaDB and payments in ClickHouse. The agent finds both tables with list_tables, reads their schemas, and sends one query:
-- one query, two databases
SELECT u.country, SUM(e.amount) AS revenue
FROM mariadb_prod.app.users u
JOIN clickhouse_events.analytics.payments e ON e.user_id = u.id
WHERE e.ts > now() - INTERVAL 1 HOUR
GROUP BY u.country;Otterstax sends the time filter to ClickHouse, reads only the matching payments, joins them with users from MariaDB and returns one row per country. The agent makes a single tool call, and repeated runs return the same number.
Other protocols: SQL, Arrow Flight SQL and ADBC
The same federated endpoint speaks several protocols, so you can connect it to any agent framework:
| Protocol | Use it for |
|---|---|
| MCP | Claude Code, Claude Desktop, Codex, opencode and other MCP clients |
| PostgreSQL and MariaDB wire protocols | LangChain, LlamaIndex and any framework with a SQL database tool; existing drivers and ORMs |
| Arrow Flight SQL, ADBC | Python and data tools that read columnar results fast (pandas, Polars, DuckDB) |
All of them are open source and use the same catalog and query engine. The open-source quickstart and the MCP server run locally in about ten minutes.
An executive dashboard that went from hours to seconds
A company ran a 360° dashboard for its C-level on AI agents. Each data source had its own agent and its own MCP connection, so the dashboard was slow and its numbers didn’t match. Delays added up along the chain of agents, and each agent read the same data in its own way. Collecting everything through ETL instead would have left the dashboard stale.
With Otterstax, all sources connect to one catalog and the agents use one MCP connection. An agent sends one query, and Otterstax runs the joins and aggregations and returns a single result. With fewer agents in the chain, the dashboard also uses fewer tokens.
Hours → seconds
Time to insights on the dashboard.
N → 1
MCP connections: one endpoint instead of one agent per source.
Agents get the same permissions as your apps
An agent with SQL access should get the same controls as a new teammate with database access.
Least privilege at the source.
Otterstax connects to each database with the credentials you put in its catalog. If those users are read-only, every agent that queries through Otterstax is read-only too.
Read replicas for exploration.
Point the catalog at read replicas, so an agent’s exploratory full scan never slows down your customers.
Data stays in your network.
Otterstax is self-hosted and on-premise, with no telemetry. The MCP server runs next to the agent over stdio, and your data doesn’t pass through any third-party service.
Per-user access and audit.
Per-user credentials via LDAP or Vault mean an agent sees only what its user may see. Every query is logged with the user, the query text and the time.
What is a database MCP server?
A program that connects an AI agent to a database through the Model Context Protocol. It gives the agent tools to list tables, read schemas and run SQL, while database credentials stay in the server's config. Otterstax is a database MCP server for many databases at once.
Can AI agents query Otterstax?
Yes. Otterstax has an open-source MCP server. Agents query all connected sources through the same federated query engine as your apps, with the same source permissions. Per-user access and a full audit log come with Enterprise.
Can one MCP server connect to multiple databases?
Yes. Otterstax connects to MariaDB, PostgreSQL, ClickHouse, S3 and Kafka through one endpoint, and one SQL query can join tables from several of them.
Do I still need a PostgreSQL, ClickHouse or MariaDB MCP server?
Not if the databases are registered in Otterstax. The agent then reaches all of them through one server. A dedicated server still makes sense for a single database that nothing else needs to join with.
Does it work with MySQL?
Yes. Otterstax registers MySQL databases the same way as MariaDB and also speaks the MySQL wire protocol.
How do I connect Claude to my databases?
Add the Otterstax MCP server to Claude Code with one claude mcp add command, or to Claude Desktop with the .mcpb bundle or claude_desktop_config.json. Claude then sees every database registered in Otterstax.
Is it a text-to-SQL agent?
No. Your agent (Claude, Codex or your own) turns questions into SQL. Otterstax gives it one schema to explore and runs the query across your databases.
Does Otterstax support ADBC?
Yes, in open source, alongside Arrow Flight SQL and the MariaDB / MySQL and PostgreSQL wire protocols.
Does my data leave my infrastructure?
No. Otterstax is self-hosted, with no telemetry. Queries run inside your network, and only the result goes back to the agent you run.
See Otterstax on your own data sources
In a 30-minute call we'll map your stack and show a working query across your data sources.