DBHub MCP
DBHub is a minimal, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, and SQLite. It provides a single secure interface to connect, explore, and manage multiple databases simultaneously.
How to Install and Use DBHub MCP
DBHub MCP is a simple and lightweight server that helps you connect to different databases like Postgres, MySQL, SQL Server, MariaDB, and SQLite. It uses the Model Context Protocol (MCP) to make database access easy and efficient. Here’s how you can install and start using DBHub MCP quickly.
Step 1: Prepare Your Environment
Before installing DBHub MCP, make sure you have Docker or Node.js (with npm or npx) installed on your computer. These tools will help you run DBHub MCP easily.
Step 2: Quick Start with Docker
If you prefer using Docker, you can run DBHub MCP with just one command. This method is fast and does not require you to install anything else.
Here is the Docker command to start DBHub MCP:
docker run --rm --init \
--name dbhub \
--publish 8080:8080 \
bytebase/dbhub \
--transport http \
--port 8080 \
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
- Replace
user,password,localhost,5432, anddbnamewith your actual PostgreSQL database details. - This command runs the DBHub MCP server on port 8080 and connects to your database.
Step 3: Quick Start with NPM (Node.js)
If you want to run DBHub MCP without Docker, you can use npm or npx. This is useful if you already have Node.js installed.
Run this command to start the server:
npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
- Again, update the
dsnstring with your database connection details. - This command will launch the DBHub MCP server on your computer, accessible at port 8080.
Step 4: Try Demo Mode
If you want to explore DBHub MCP without connecting to a real database, you can run it in demo mode. This mode shows you how the server works with sample data.
Use this command to start demo mode:
npx @bytebase/dbhub@latest --transport http --port 8080 --demo
- This lets you test DBHub MCP features without any setup.
Step 5: Connect to Multiple Databases
DBHub MCP supports connecting to many databases at once using a configuration file in TOML format. This is helpful if you manage several databases like production, staging, or development.
To set this up, create a dbhub.toml file with your database details. Then start DBHub MCP with that config file.
For full instructions, visit the Multi-Database Configuration page.
Step 6: Development Setup (Optional)
If you want to develop or customize DBHub MCP, follow these steps:
-
Install dependencies with:
pnpm install -
Run in development mode:
pnpm dev -
Build and start for production:
pnpm build && pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"
This lets you work on the server code directly.
By following these steps, you can easily install and start using DBHub MCP to connect to your databases. Whether you use Docker, npm, or demo mode, DBHub MCP offers a simple and token-efficient way to explore your data.