Managing MongoDB through the terminal is fine when you know exactly what you're doing. mongosh is powerful, but navigating databases, checking replica set health, managing user permissions, and running queries all in a raw shell gets tedious fast — especially over SSH, in production environments where Compass can't be installed, or when you just want a quick overview without firing up a GUI.

We built MongoTUI to fill that gap. It's an open source terminal user interface for MongoDB that gives you a Compass-like experience in your terminal — keyboard-driven, fast, and secure over SSH. Available today on PyPI and GitHub.

What MongoTUI does

MongoTUI is a Python terminal application built on Textual and PyMongo. It connects to any MongoDB instance — standalone, replica set, or Atlas — and gives you a sidebar-driven interface to navigate your databases and collections, manage users and roles, inspect indexes, monitor live performance, and run queries and aggregation pipelines, all without a web browser.

The four main areas:

Database and document management

Browse databases and collections in a Compass-style sidebar tree. View collection stats — document count, storage size. Query documents with JSON filters. Run aggregation pipelines. Create and drop databases. It's the day-to-day MongoDB workflow, in your terminal.

User and role administration

This is where MongoTUI is particularly useful. Managing MongoDB users through mongosh means remembering the right command syntax, getting the JSON structure right, and running separate commands to view, create, and modify users. MongoTUI surfaces all of it in one screen: browse all users and their current roles, create and delete users, reset passwords, and grant or revoke roles through a built-in role picker that shows available built-in roles rather than requiring you to type them from memory.

If you manage MongoDB access for a team — onboarding engineers, rotating credentials, auditing who has what permissions — this is the workflow improvement MongoTUI was built around.

Index management

View existing indexes with their key info and storage size. Create and drop indexes. Full support for text and vector search indexes, including vector search with similarity options. As MongoDB's vector search capabilities have expanded, index management has gotten more complex — MongoTUI handles the full range.

Live monitoring

Live performance graphs for active connections, operations per second, and memory usage. Server stats: version, uptime, storage engine. Replica set status with member health — so you can see at a glance whether your replica set is healthy without running rs.status() and parsing the output.

Getting started

Install from PyPI:

pip install mongotui

Connect to a local MongoDB instance:

mongotui

Connect with a URI:

mongotui --uri "mongodb://admin:password@localhost:27017/?authSource=admin"

# Short form
mongotui -u "mongodb://admin:password@localhost:27017/?authSource=admin"

Running locally with Docker:

# Start a local MongoDB instance
docker compose up -d

# Connect
mongotui -u "mongodb://admin:admin@localhost:27017/?authSource=admin"

Requirements: Python 3.11+, MongoDB 4.4 or newer.

Why we built it

The trigger was a specific workflow problem at Pipoline. When working on client infrastructure — MongoDB deployments on servers without GUI access — the user management workflow through mongosh was slow and error-prone. Compass isn't always an option: air-gapped environments, servers without a display, quick SSH sessions where installing a GUI tool isn't justified. mongosh works but requires remembering the exact command syntax for operations you might only do every few weeks.

We wanted something that looked good in a terminal, worked over SSH, and handled the operations that are annoying to do in a raw shell — especially user and role management, where a built-in role picker beats typing readWriteAnyDatabase from memory.

Textual turned out to be the right framework. It handles keyboard navigation, mouse support, reactive layouts, and terminal graphs cleanly. PyMongo handles the MongoDB connection. The result is something that genuinely feels like a native terminal application rather than a Python script with a box drawn around it.

Tech stack

  • Python 3.11+
  • Textual — the TUI framework from Textualize
  • PyMongo — official MongoDB Python driver
  • textual-plotext — terminal performance graphs

What's next

MongoTUI is at an early stage. The core workflows — database browsing, user management, index management, and monitoring — are working. There's more to build: document editing directly in the TUI, better aggregation pipeline support, connection profiles for multiple environments, and expanded replica set management.

The project is open source under AGPL-3.0. If you're working with MongoDB and spending time in the terminal, try it out. If you run into something that doesn't work or a workflow that's missing, open an issue on GitHub — early feedback shapes where the project goes.

GitHub: github.com/DevOpsPack/mongotui
PyPI: pypi.org/project/mongotui


PIPOLINE · DEVOPS CONSULTING

Need help with your MongoDB infrastructure?

MongoTUI was built out of real production work — managing MongoDB deployments, user access, and replica sets for clients. If you need help with your MongoDB setup, access control, or ops tooling, that's exactly what Pipoline does.

Get in touch at pipoline.com →