mcli

TUI Workbench for Multi-Workspace Data Analyst Work Across Database Systems

mcli is a keyboard-first terminal workbench for SQL development, data exploration, import/export, and AI-assisted database work — one self-contained binary across many databases. Its central idea is the workspace: a named, task-oriented context that restores your current server, database, SQL files, import/export folders, and history when you enter it, so you can jump between unrelated jobs without losing your place.

Highlights

  • Many databases, one interface. PostgreSQL, MySQL/MariaDB, SQL Server, and Oracle work out of the box; DB2 is available behind a build tag. Every database implements one common adapter, so behavior is uniform.
  • Pure-Go by default. The standard build needs no C toolchain and cross-compiles cleanly to Linux, macOS, and Windows; CGo-only drivers stay quarantined behind build tags.
  • Keyboard-first REPL. Single-line input where Enter executes, a scrollable alt-screen grid for result sets, and multi-line editing in your $EDITOR or the optional built-in SQL editor with syntax highlighting and run-statement-under-cursor.
  • Import/export, write once. CSV, TSV, pipe-delimited, Excel .xlsx, and fixed-width flat files — implemented against a streaming row interface, so every database gets the same formats.
  • Safety guardrails in the core. Dangerous-SQL detection, read-only mode, and production write guards live in the core, so both the TUI and the MCP server inherit identical protection.
  • SQL linter. .lint checks statements for safety, syntax, and style without running them, and with a connection it validates queries against the live schema via EXPLAIN.
  • AI assistance and MCP server. Ask, explain, or fix SQL via any OpenAI-compatible endpoint (hosted or local) — the AI only suggests, never auto-executes — and expose the same capabilities to AI agents over a stdio MCP server, under the same safety controls.

A taste

.server add               # register a server (interactive wizard)
.connect myserver         # connect
use mydb                  # switch database
.list tables              # explore
select * from customers   # run SQL — Enter executes
.grid                     # open the last result in a scrollable grid
.export query report to out.csv   # export results

Installation

Requires Go 1.25 or newer. With GOTOOLCHAIN=auto the toolchain is fetched automatically — no system install or sudo needed:

git clone https://github.com/Solifugus/mcli.git
cd mcli
go build -o mcli ./cmd/mcli
./mcli                 # launch the interactive TUI

The build is pure Go, so it cross-compiles directly (GOOS=windows GOARCH=amd64 go build -o mcli.exe ./cmd/mcli). The optional DB2 adapter is built with go build -tags db2 -o mcli ./cmd/mcli.

Downloads & installation

Builds are coming soon. Grab the source from GitHub for now.