MCP ConfigsApr 6, 2026·2 min read

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.

TL;DR
DBHub connects AI agents to Postgres, MySQL, SQLite, and more with just two MCP tools.
§01

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.

§02

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.

§03

How to use

  1. Install DBHub via npm or Docker.
  2. Configure it with your database connection string.
  3. Add it to your MCP client configuration.
  4. 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'
§04

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)
§05

Related on TokRepo

§06

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

Which databases does DBHub support?+

DBHub supports PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, and SQLite. Each database is accessed through its standard connection string format.

Is DBHub read-only?+

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.

Why only two MCP tools?+

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.

Does DBHub require any dependencies?+

No external dependencies. DBHub bundles its database drivers and runs with a single npx command. No separate driver installation or build step required.

Can I use DBHub with Claude Desktop?+

Yes. Add the DBHub MCP server configuration to your Claude Desktop settings file. Claude can then query your database directly during conversations.

Citations (3)
🙏

Source & Thanks

Created by Bytebase. Licensed under MIT.

dbhub — ⭐ 2,500+

Thank you for making database access safe and efficient for AI agents.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.