Skip to content

gridex/gridex

Gridex

AI-native database IDE for macOS and Windows.
One app for PostgreSQL, MySQL, SQLite, Redis, MongoDB, SQL Server, and ClickHouse — with a built-in MCP server and AI chat.

macOS 14+ Windows 10+ Swift 5.10 License

Gridex overview


Supported Databases

PostgreSQL MySQL SQLite Redis MongoDB SQL Server ClickHouse

Seven drivers in one native binary. All share the same DatabaseAdapter protocol (~50 methods) so every feature — grid, query editor, ER diagram, backup, MCP — works identically across engines.


Why Gridex

  • Native. AppKit on macOS, WinUI 3 on Windows. No Electron, no web views for the grid.
  • Multi-database. Seven drivers in one binary, each with the right primitives (SCAN for Redis, aggregations for MongoDB, stored procedures for SQL Server, sequences for Postgres, MergeTree mutations for ClickHouse).
  • AI that sees your schema. Claude, GPT, Gemini, and Ollama can read your tables, run read-only queries, and write SQL scoped to the connection you pick.
  • MCP server built in. Plug Gridex into Claude Desktop, Cursor, or any MCP client over stdio — 13 tools with a 3-tier permission model and audit trail.
  • Credentials stay local. macOS Keychain / Windows Credential Manager. No cloud sync, no telemetry, no proxy.

Driver Highlights

Database Driver Highlights
PostgreSQL PostgresNIO Parameterized queries, mTLS, sequences, full schema inspection
MySQL MySQLNIO Charset handling, parameterized queries, TLS, auto-reconnect with keepalive
SQLite System libsqlite3 File-based, WAL mode, zero config
Redis RediStack Key browser, SCAN filter, Server INFO dashboard, Slow Log viewer, rediss:// TLS
MongoDB MongoKitten Document editor, NDJSON backup/restore, aggregation pipeline
SQL Server CosmoSQLClient TDS 7.4 (no FreeTDS), native BACKUP DATABASE, stored procedures
ClickHouse Pure Swift (URLSession HTTP) HTTP/HTTPS on ports 8123/8443, full mTLS via PKCS#12, system.* introspection, version-aware fallbacks (CH 20.8+)

MCP Server

Expose any saved connection to MCP clients (Claude Desktop, Cursor, custom agents). Available on both macOS (stdio) and Windows (stdio + HTTP). Every tool call runs through a permission gate and is recorded in the audit log.

MCP Server configuration

13 tools across 3 permission tiers:

Tier Tools When it runs
Read (metadata) list_connections, list_schemas, list_tables, describe_table, list_relationships, get_sample_rows Always allowed for enabled connections
Read (query) query, explain_query, search_across_tables Allowed in read_only+ modes; SQL sanitizer rejects write statements
Write (mutations) insert_rows, update_rows, delete_rows, execute_write_query Only in read_write mode; row-count estimator flags bulk changes; user approval required

Security layers in macos/Services/MCP/Security/:

  • MCPPermissionEngine — per-connection mode (locked, read_only, read_write)
  • MCPSQLSanitizer — rejects DDL/DML that escape the declared tier
  • MCPIdentifierValidator — guards against SQL injection in identifiers
  • MCPRowCountEstimator — previews how many rows a mutation will touch
  • MCPRateLimiter — caps calls per tool per minute
  • MCPApprovalGate — prompts the user for destructive actions

MCP window — 5 tabs: Overview, Setup, Connections, Activity, Advanced.

MCP activity log

Every tool invocation lands in the activity log with tier, SQL, duration, row count, and approval state — so you can answer "what did the agent do last night?" without guessing.


ER Diagram

ER diagram canvas

  • macOS: custom NSView + CoreGraphics renderer. Windows: in-process Dagre layout + WebView. No external d2/Graphviz binary on either platform.
  • Auto-layout, pan, zoom, fit-to-view, FK relationship routing.
  • Reads live schema from the active adapter — no separate import step.
  • Click a column to jump to its table; double-click to open data.

AI Chat

Built-in chat that understands your schema and writes SQL scoped to the selected connection.

  • Anthropic Claude — streaming, tool use, extended thinking
  • OpenAI — GPT-4.x / 5.x, function calling
  • Google Gemini — Flash and Pro
  • Ollama — local LLMs, no API key needed

Requests go direct from your machine to the provider. Gridex never proxies prompts. API keys live in the macOS Keychain / Windows Credential Manager.


Editor & Grid

Data grid

  • Inline cell editing with type-aware parsing
  • Sort, filter, paginate, column resize, multi-column sort
  • Add/delete rows with pending-change tracking — commit as one transaction
  • Copy rows, export to CSV / JSON / SQL

Query editor

  • Multi-tab with Chrome-style tab bar grouped by database
  • Syntax highlighting (keywords, strings, numbers, comments, functions)
  • Execute selection or all
  • Redis CLI mode for Redis connections
  • Query history persisted via SwiftData — searchable, favoritable

Schema tools

  • Structure viewer: columns, indexes, foreign keys, constraints
  • Function and stored-procedure inspector (source + parameters)
  • Create Table / Create Database sheets with type-aware defaults

SSH Tunnel

Password, private-key, or key-with-passphrase auth. Local port forwarding via swift-nio-ssh. Managed by the SSHTunnelService actor — one tunnel per active connection, torn down on disconnect.

mTLS (Teleport-style)

Connections support sslKeyPath + sslCertPath + sslCACertPath for mutual TLS. Works end-to-end for PostgreSQL, MySQL, Redis, and ClickHouse — drop in the certs a tool like Teleport issues and connect as usual. ClickHouse accepts PKCS#12 client bundles with pinned CA (PEM or DER).

Backup & Restore

Database Backup
PostgreSQL pg_dump (custom / SQL / tar) + pg_restore
MySQL mysqldump + mysql
SQLite File copy
MongoDB NDJSON (one doc per line, pure Swift)
Redis JSON snapshot via SCAN (pure Swift)
SQL Server Native BACKUP DATABASE
ClickHouse SQL dump (SHOW CREATE TABLE + FORMAT Values, pure Swift)

Selective table backup, compression, and progress reporting for the CLI-backed formats.

Import

Connections import from TablePlus, Navicat (NCX with Blowfish decrypt), DataGrip, and DBeaver — including SSH configs and keychain-stored passwords.


Requirements

macOS

  • macOS 14.0 (Sonoma) or later
  • Swift 5.10+ / Xcode 15+

Windows

  • Windows 10 or later (64-bit)
  • Visual Studio 2022+, .NET 8 SDK, vcpkg

Build & Run

macOS

git clone https://github.com/gridex/gridex.git
cd gridex

# Debug (ad-hoc signed, fast local testing)
swift build
.build/debug/Gridex

# Or build .app bundle
./scripts/build-app.sh
open dist/Gridex.app

Release

# Apple Silicon
./scripts/release.sh                  # → dist/Gridex-<version>-arm64.dmg

# Intel
ARCH=x86_64 ./scripts/release.sh      # → dist/Gridex-<version>-x86_64.dmg

# Both architectures
./scripts/release-all.sh

Pipeline: swift build.app bundle → code sign → notarize → staple → DMG → sign DMG → notarize DMG.

Variable Description
ARCH arm64 or x86_64 (default: host)
SIGN_IDENTITY Developer ID certificate SHA-1 (or set in .env)
NOTARY_PROFILE notarytool keychain profile (default: gridex-notarize)
NOTARIZE Set to 0 to skip notarization

Auto-update is delivered via Sparkle. Release artifacts are signed, stapled, and advertised via an appcast feed.


Architecture

Clean Architecture, 5 layers. Dependencies point inward.

gridex/
├── macos/                    macOS app (Swift, AppKit + SwiftUI)
│   ├── App/                  Lifecycle, DI container, AppState
│   ├── Core/                 Protocols, models, enums — zero deps
│   │   ├── Protocols/        DatabaseAdapter, LLMService, SchemaInspectable, MCPTool
│   │   └── Models/           RowValue, ConnectionConfig, QueryResult, MCPAuditEntry
│   ├── Domain/               Use cases, repository protocols
│   ├── Data/                 Adapters + SwiftData persistence + Keychain
│   │   └── Adapters/         SQLite, PostgreSQL, MySQL, MongoDB, Redis, MSSQL, ClickHouse
│   ├── Services/             Cross-cutting
│   │   ├── QueryEngine/      ConnectionManager, QueryEngine, QueryBuilder
│   │   ├── AI/               Anthropic, OpenAI, Gemini, Ollama providers
│   │   ├── MCP/              MCPServer, StdioTransport, Tools (Tier1/2/3), Security
│   │   ├── SSH/              SSHTunnelService (NIOSSH)
│   │   └── Export/           ExportService, BackupService
│   └── Presentation/         AppKit views, SwiftUI settings, ViewModels
├── windows/                  Windows app (C++, WinUI 3)
├── scripts/                  Build and release automation
└── Package.swift             SPM manifest

Key protocols

  • DatabaseAdapter — connection lifecycle, queries, schema, CRUD, transactions, pagination. All 7 adapters conform.
  • LLMService — streaming AI responses via AsyncThrowingStream. All 4 providers conform.
  • SchemaInspectable — full schema snapshot for the AI context engine and ER diagram.
  • MCPTool — MCP tool contract with tier, input schema, and permission-checked execute.

Concurrency

  • actor for thread-safe services: QueryEngine, ConnectionManager, SSHTunnelService, BackupService, MCPServer.
  • async/await throughout — no completion handlers.
  • Sendable on all data models.

Dependency injection

DependencyContainer (singleton) composes services at launch. SwiftData ModelContainer is shared across windows. Services are injected via the SwiftUI environment.


Dependencies

Package Version Purpose
postgres-nio 1.21.0+ PostgreSQL driver
mysql-nio 1.7.0+ MySQL driver
swift-nio-ssl 2.27.0+ TLS for NIO-based drivers
swift-nio-ssh 0.8.0+ SSH tunnel support
RediStack 1.6.0+ Redis driver
MongoKitten 7.9.0+ MongoDB driver (pure Swift)
CosmoSQLClient-Swift main MSSQL via TDS 7.4
Sparkle 2.6.0+ macOS auto-update

System library: libsqlite3 (linked at build time). ClickHouse uses URLSession + Security.framework — no SPM dependency.


Contributing

Contributions are welcome. Please open an issue first to discuss what you'd like to change.

See CONTRIBUTING.md and CODE_OF_CONDUCT.md.

License

Licensed under the Apache License, Version 2.0.

Copyright © 2026 Thinh Nguyen.

You may use, modify, and distribute this software — including in commercial or closed-source products — provided you preserve the copyright notice and NOTICE file. See the LICENSE for full terms.

About

A native macOS / windows database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors