DBHub — Universal Database MCP Server, Zero Dependencies
Token-efficient database MCP server supporting Postgres, MySQL, MariaDB, SQL Server, and SQLite. Just two MCP tools, zero dependencies, read-only safe.
What it is
DBHub is a database MCP server that connects AI agents to PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite databases. It exposes only two MCP tools, keeping the interface minimal and token-efficient. The server has zero external dependencies and operates in read-only mode by default for safety.
This tool is for developers who want their AI agents to query databases without building custom integrations. It works with Claude Desktop, Claude Code, and any MCP-compatible client.
How it saves time or tokens
DBHub's two-tool design is intentionally minimal. Most database MCP servers expose dozens of tools, consuming context window space just to describe them. DBHub uses one tool to list tables and schemas, and another to run queries. This keeps every agent request token-efficient. Read-only mode eliminates the risk of accidental data modification.
How to use
- Install DBHub via npm or Docker.
- Configure it with your database connection string.
- Add it to your MCP client configuration.
- Your AI agent can now query your database.
# Run with npx (zero install)
npx @anthropic/dbhub --database-url 'postgresql://user:pass@localhost:5432/mydb'
# Or with Docker
docker run -p 8080:8080 anthropic/dbhub \
--database-url 'mysql://user:pass@localhost:3306/mydb'
Example
MCP client configuration:
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"@anthropic/dbhub",
"--database-url",
"postgresql://user:pass@localhost:5432/mydb"
]
}
}
}
Once configured, an agent can:
Agent: List all tables in the database
-> Tool call: list_tables
-> Result: users, orders, products, categories
Agent: Show the top 5 orders by total amount
-> Tool call: run_query('SELECT * FROM orders ORDER BY total DESC LIMIT 5')
-> Result: (table of 5 orders)
Related on TokRepo
- Database tools — More database management tools
- MCP SQLite — SQLite-specific MCP server
Common pitfalls
- Read-only mode is the default for safety, but it means agents cannot insert, update, or delete data. Enable write mode explicitly if needed.
- Connection strings contain credentials. Ensure they are stored securely, not committed to version control.
- Complex queries on large tables may time out. Set query timeout limits in the configuration.
- The two-tool interface is minimal by design. If you need schema introspection or data export, use a more full-featured database tool.
- Not all SQL dialects are handled identically. Test your specific database engine to ensure compatibility.
- Review the official documentation before deploying to production to ensure compatibility with your specific environment and requirements.
Frequently Asked Questions
DBHub supports PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, and SQLite. Each database is accessed through its standard connection string format.
By default, yes. DBHub operates in read-only mode to prevent accidental data modification by AI agents. You can enable write mode with a configuration flag if your use case requires it.
Fewer tools mean less context window consumption. Each MCP tool definition takes tokens to describe. By limiting to list_tables and run_query, DBHub keeps the token overhead minimal while covering the most common database operations.
No external dependencies. DBHub bundles its database drivers and runs with a single npx command. No separate driver installation or build step required.
Yes. Add the DBHub MCP server configuration to your Claude Desktop settings file. Claude can then query your database directly during conversations.
Citations (3)
- DBHub GitHub— DBHub universal database MCP server
- MCP Documentation— Model Context Protocol server specification
- PostgreSQL Documentation— Database connectivity best practices