DBHub MCP Server: Connect Claude to Your Database
DBHub by Bytebase is an MCP server that connects Claude to Postgres, MySQL, SQL Server, Oracle, MariaDB or SQLite. Setup, safe use, pros and cons.
By Claudekit Team Published 1 min read
- Type
- MCP Server
- Pricing
- Open Source
- Repository
- github.com
- GitHub stars
- 3,716
- Website
- dbhub.ai
DBHub, from Bytebase, is an MCP server that connects Claude to a relational database through a connection string. It is the example Anthropic’s own Claude Code docs use for querying a database in natural language. The project describes itself as token conscious and supports PostgreSQL, MySQL, SQL Server, Oracle, MariaDB and SQLite.
Install in Claude Code
Use a read-only database user in the DSN:
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
--dsn "postgresql://readonly:pass@host:5432/analytics"
Run /mcp and check that the db row shows a checkmark. To share the setup with a team, add it at project scope and reference the DSN through an environment variable in .mcp.json rather than committing the password. The MCP guide explains scopes and variable expansion.
Use cases
What's our total revenue this month?
Show me the schema for the orders table
Find customers who haven't made a purchase in 90 days
- Exploring an unfamiliar schema before writing a feature.
- Ad-hoc analytics without opening a SQL client.
- Checking that a migration Claude wrote produces the expected data.
- Pair with the SQL explainer prompt to review queries before running them.
Pros
- One server for six database engines.
- Open source (MIT) and documented in Anthropic’s own examples.
- Works in any MCP client.
Cons
- Powerful against real data: always use least-privilege credentials.
- Query results enter Claude’s context, so large result sets cost tokens.
- Not a substitute for a migration tool or reviewed SQL in production paths.
Frequently asked questions
Which databases does DBHub support?
PostgreSQL, MySQL, SQL Server, Oracle, MariaDB and SQLite, according to the project's repository.
Is it safe to connect Claude to production?
Only with a read-only database user. Claude runs the queries it writes, so the database permissions are your real safety boundary.
Can I share the DBHub config with my team?
Yes, with project scope in .mcp.json, but keep the connection string in an environment variable using the dollar-brace syntax instead of committing credentials.