Mason
Open-source Postgres read-replica replacement that syncs chosen tables into DuckDB for fast analytical queries, with per-agent RBAC and built-in MCP.
At a Glance
About Mason
Mason is an open-source (Apache-2.0) drop-in replacement for a Postgres read replica, built by the team behind Embeddable and Trevor.io. It syncs selected Postgres tables into DuckDB's columnar engine and answers the same SQL, aimed at analytical queries such as counts, sums and group-bys. It runs as a single Node.js process installed through an npm CLI, and a hosted Mason Cloud option is also offered.
What It Is
Mason sits beside a Postgres database as a lightweight read replica. You choose which tables and columns to sync and how each stays current: on demand, by polling or by logical replication. Mason keeps its config and synced data locally in the folder where it runs. It matches Postgres syntax and behavior rather than DuckDB's, and rewrites incoming Postgres queries into the form DuckDB runs fastest. Clients connect with standard Postgres tools such as psql.
Workflow
After installing the CLI, you run mason init with a Postgres connection string, mason add to pick tables, and mason start and mason wait to complete the first sync. mason user add creates a connection URL for a Postgres client or a coding agent through mason mcp. mason stop and mason destroy remove Mason and its synced copy of your data.
Built for AI Agents and Access Control
Each tool, agent or customer can get its own login, with role-based access control limiting readable tables and columns. Row-level security can restrict a user to its own rows and follows foreign keys to related tables. Every query is logged with the user, SQL, duration and, if refused, how to fix it. Mason includes a built-in MCP server so agents like Claude Code and ChatGPT can inspect tables and run queries within their role's permissions. IP allowlists and TLS are also supported.
Performance Tradeoffs
Mason's own benchmarks (AWS m7g.xlarge, cold start) show an 81x speedup on a group-by over 10M rows, and 16x to 467x on other aggregate and join queries. The site states that single-row lookups by primary key are slower than Postgres (2.8x to 6.0x), since Mason is fastest when reading many rows across few columns.
Operations
Mason exposes Prometheus metrics at /metrics, a health check at /healthz, and logs to stdout. mason logs and mason usage show query and sync history, and mason ui opens a web UI for tables, users, queries and sync events. Generated tables work like self-maintaining materialized views without extra load on the source database.
Collections
Popular collections
- Give Your AI Agent the Meaning Behind Your Database
Collection by @danielokafor
- Black Friday 2026: Learn with AI
Collection by @evtuff
- Black Friday 2026: Coding Agent Tools
Collection by @samofcode
- Black Friday 2026: AI APIs and Creative Tools
Collection by @priyashah
Add Mason to one of your collections.
Community Discussions
Be the first to start a conversation about Mason
Share your experience with Mason, ask questions, or help others learn from your insights.
Pricing
Open Source (Self-hosted)
Apache-2.0 licensed Mason core, self-hosted via npm CLI.
- Apache-2.0 license
- npm CLI (@mason-data/cli)
- Role-based access control
- Row-level security
- Built-in MCP server
Capabilities
Key Features
- Drop-in Postgres read replica backed by DuckDB
- Selective table and column sync
- Sync on demand, by polling or logical replication
- Postgres query rewriting for DuckDB
- Role-based access control
- Row-level security following foreign keys
- Generated tables (self-maintaining materialized views)
- Built-in MCP server
- Query logging and usage monitoring
- Prometheus metrics and health endpoint
- IP allowlists and TLS
- Web UI via mason ui
