explaingit

nonanti/narwhal

Analysis updated 2026-05-18

28RustAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A Rust terminal database client with Vim-style editing that connects to five database types and exposes an MCP server for AI tools.

Mindmap

mindmap
  root((narwhal))
    What it does
      Terminal database client
      Vim style editor
      MCP server
    Tech stack
      Rust
      Postgres
      MySQL
      SQLite
    Use cases
      Query multiple databases
      Let AI tools read schemas
      Tunnel into private databases
    Audience
      Developers
      Ops devops

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Manage connections to Postgres, MySQL, SQLite, DuckDB, and ClickHouse from one terminal tool

USE CASE 2

Use Vim-style keybindings and schema-aware completion to write SQL queries

USE CASE 3

Let AI tools like Claude Desktop or Cursor read schemas and run read-only queries via MCP

USE CASE 4

Connect to a private-network database through a built-in SSH tunnel

What is it built with?

RustPostgreSQLMySQLSQLiteDuckDBClickHouse

How does it compare?

nonanti/narwhalreekta92/pinstarxqnode/claude-code-helper
Stars282828
LanguageRustRustRust
Setup difficultyeasyeasy
Complexity3/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Install via Cargo, Homebrew, AUR, Nix, or a prebuilt binary.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Narwhal is a terminal-based database client written in Rust that lets you connect to and query five different types of databases from a single interface: PostgreSQL, MySQL, SQLite, DuckDB, and ClickHouse. Instead of switching between separate tools for each database, you manage all your connections in one place and use a consistent keyboard-driven interface regardless of which database you are talking to. The editor inside narwhal behaves like the Vim text editor, meaning it uses the same keyboard shortcuts and modes that Vim users already know: Normal mode for navigation, Insert mode for typing, and Visual mode for selecting text. It also offers schema-aware completion, so when you start typing a query the tool can suggest table and column names from the connected database. One notable feature is a built-in MCP server. MCP, short for Model Context Protocol, is a standard that AI tools like Claude Desktop and Cursor use to call external tools and read structured data. Running narwhal with the mcp flag exposes the database to those AI tools, letting them list connections, look up table schemas, and run read-only queries. The connection configuration includes safety controls for this: you can mark connections as read-only, require typed confirmation before any write statement runs, and color-code connections so production databases are visually distinct from development ones. Connections are stored in a plain text configuration file. You can also extend narwhal's behavior by writing Lua scripts and dropping them into a plugins directory. SSH tunnel support is built in, so connecting through a bastion host to a database on a private network works without setting up the tunnel manually. Installation is available through Cargo (Rust's package manager), Homebrew on macOS, the Arch Linux package manager via the AUR, and Nix, as well as prebuilt binary downloads. The project is licensed under MIT or Apache-2.0.

Copy-paste prompts

Prompt 1
Show me how to install narwhal with Cargo and connect it to a PostgreSQL database.
Prompt 2
Explain how narwhal's MCP server lets Claude or Cursor list tables and run read-only queries.
Prompt 3
Walk me through setting up an SSH tunnel connection to a database on a private network in narwhal.
Prompt 4
Explain the read-only and typed-confirmation safety controls for database connections in narwhal.

Frequently asked questions

What is narwhal?

A Rust terminal database client with Vim-style editing that connects to five database types and exposes an MCP server for AI tools.

What language is narwhal written in?

Mainly Rust. The stack also includes Rust, PostgreSQL, MySQL.

What license does narwhal use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is narwhal to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is narwhal for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.