Skip to main content
Glama
The OtterStax MCP Server

The OtterStax MCP Server

Official
by otterstax

OtterStax MCP server

An MCP server for OtterStax, the federated SQL server. It lets an AI agent (Claude Code, Claude Desktop, Codex, opencode, …) discover the data behind OtterStax — MySQL/MariaDB, PostgreSQL, ClickHouse, S3 and Kafka — and query it with SQL.

The server runs locally over stdio and talks to OtterStax over its PostgreSQL wire protocol.

Configuration

Variable

Default

OTTERSTAX_URL

postgresql://localhost:8817

PostgreSQL-wire address of the OtterStax server

OtterStax does not check credentials, so the URL needs only host and port. The server runs any SQL you send it: point it only at an OtterStax you are allowed to change.

Related MCP server: dbrex

Install

Requires Node.js 22 or newer (Claude Desktop ships its own).

Claude Desktop

Download otterstax-mcp.mcpb and open it: Claude Desktop installs it and asks for the OtterStax URL.

Or add it to claude_desktop_config.json:

{
  "mcpServers": {
    "otterstax": {
      "command": "npx",
      "args": ["-y", "@otterstax/mcp"],
      "env": { "OTTERSTAX_URL": "postgresql://localhost:8817" }
    }
  }
}

Claude Code

claude mcp add otterstax -e OTTERSTAX_URL=postgresql://localhost:8817 -- npx -y @otterstax/mcp

Codex

codex mcp add otterstax --env OTTERSTAX_URL=postgresql://localhost:8817 -- npx -y @otterstax/mcp

or in ~/.codex/config.toml:

[mcp_servers.otterstax]
command = "npx"
args = ["-y", "@otterstax/mcp"]
tool_timeout_sec = 600   # Codex stops a tool after 60 s by default; federated queries can take longer

[mcp_servers.otterstax.env]
OTTERSTAX_URL = "postgresql://localhost:8817"

opencode

In opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "otterstax": {
      "type": "local",
      "command": ["npx", "-y", "@otterstax/mcp"],
      "environment": { "OTTERSTAX_URL": "postgresql://localhost:8817" }
    }
  }
}

Tools

Tool

What it does

execute_sql(sql)

Runs any statement. Returns {columns, rows, row_count}; row_count is rows returned, or rows affected for DML.

explain_query(sql)

Runs EXPLAIN <sql>. OtterStax builds without EXPLAIN support return their error.

list_databases()

Connection aliases (kind: "connection") and local engine databases (kind: "local").

list_schemas(database)

<db> (MySQL/ClickHouse) or <db>.<schema> (PostgreSQL) inside a connection.

list_tables(database?, schema?)

Tables and views under the full names to use in SQL, e.g. sales.ops.orders.

describe_table(table)

Columns with SQL types and nullability.

search_objects(object_type, pattern, detail_level, limit)

Finds tables or columns by LIKE pattern. summary/full on tables also count rows (one COUNT(*) per match).

table_stats(table, columns?)

Row count and per-column distinct count, NULL count, MIN and MAX in one query.

Errors come back as tool errors (isError: true) with {error, code}, where code is the SQLSTATE OtterStax sent. If OtterStax goes down, the next call reconnects on its own.

The server also gives the agent OtterStax's SQL rules (table naming, date handling, query shapes that are known to crash the engine) as MCP server instructions.

Development

npm install
npm run build            # dist/index.js, one self-contained file
npm test                 # unit tests
npm run test:integration # against a live OtterStax, see below
npm run build:mcpb       # otterstax-mcp.mcpb

Integration tests expect the OtterStax quick start on localhost:8817:

cd otterstax/examples/quick_start && docker compose up -d

They restart the qs-otterstax container once to check reconnection.

License

Apache-2.0

Available Tools

8 tools
describe_tableB

Columns of a table with their SQL types and nullability.

Inputs: table (required).

execute_sqlA

Run any SQL statement on OtterStax (SELECT, DDL, DML, COPY, CREATE SOURCE/STREAM). Tables must be fully qualified: alias.db.table or alias.db.schema.table. Returns {columns, rows, row_count}; all values come back as text or JSON numbers.

Inputs: sql (required).

explain_queryB

Show the plan of a statement (EXPLAIN ). The OtterStax build you talk to may not support EXPLAIN yet; then this returns the server's error.

Inputs: sql (required).

list_databasesA

List OtterStax databases. kind 'connection' is a registered backend (MySQL/PostgreSQL/ClickHouse) whose tables are named .. or ...; kind 'local' is an engine database.

Inputs: no named parameters.

list_schemasA

List the schemas inside a database: '' for a MySQL/ClickHouse connection, '.' for a PostgreSQL one. A local database has none.

Inputs: database (required).

list_tablesB

List tables and views under the full SQL names to use in execute_sql.

Inputs: schema, database.

search_objectsA

Search tables or columns by name across all databases with a LIKE pattern. detail_level: names (minimal), summary (tables: column and row counts; columns: type), full (tables: also columns and indexes). summary/full on tables run COUNT(*) on each match.

Inputs: object_type (required), limit, pattern, detail_level.

table_statsA

Profile a table in one query: row count and, per column, distinct count, NULL count, MIN and MAX. Without columns every column is profiled, which scans the whole table on its backend.

Inputs: table (required), columns.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool has a fairly clear role: discovery (list_databases/list_schemas/list_tables/describe_table), execution (execute_sql), planning (explain_query), and profiling (table_stats). However, execute_sql can already run any statement including EXPLAIN, so explain_query overlaps, and search_objects versus list_tables/describe_table have partially overlapping lookup purposes.

    Naming Consistency4/5

    Seven of eight tools follow a clean verb_noun pattern (explain_query, execute_sql, list_databases, list_schemas, list_tables, describe_table, search_objects). table_stats deviates to a noun_noun form, a minor inconsistency but still readable.

    Tool Count5/5

    Eight tools is well-scoped for a SQL database engine, covering discovery, execution, planning, and profiling without redundancy. Each tool earns its place.

    Completeness4/5

    The surface covers exploration (databases, schemas, tables, columns, search) plus execution, explain, and profiling, which is strong for a query engine. Minor gaps like query cancellation or session/connection management are absent but not blocking for typical agent workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to execute SQL queries and introspect PostgreSQL schemas, tables, and indexes with read-only safety by default. Supports optional write operations and works with Claude, LangChain, and other agents via stdio or HTTP transports.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to query MySQL, ClickHouse, Trino, and S3-compatible object stores through the same local daemon used by VSCode, including running SQL from files and browsing buckets.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to query and explore PostgreSQL and MySQL clusters from a single main configuration, with dynamic per-database routing, automatic database discovery and sync, table/schema inspection, and hierarchical write-rule protection that can block or allow specific SQL mutation operations.
      158 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to explore and query Postgres, MySQL, and BigQuery databases—listing schemas and tables, describing columns, sampling rows, running read-only SQL, and, when permitted, executing writes—with schema allowlists, hidden columns, response budgets, and audit logging. Runs on Node/Docker over stdio or Streamable HTTP, or as a Cloudflare Worker with OAuth and Hyperdrive.
      264 npm
      MIT