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.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 943f4349-7127-400b-9cd3-bbb8f67982a3 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
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.
常见问题
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.
引用来源 (3)
- DBHub GitHub— DBHub universal database MCP server
- MCP Documentation— Model Context Protocol server specification
- PostgreSQL Documentation— Database connectivity best practices
来源与感谢
讨论
相关资产
DBHub — Token-Efficient Database MCP Server
Database MCP server for Postgres/MySQL/MariaDB/SQL Server/SQLite. Includes execute_sql + schema search with guardrails: read-only, row limits, timeouts.
charlotte — Token-Efficient Browser MCP Server
Charlotte is a token-efficient browser MCP server: agents get a compact page summary by default, then query only the elements they need.
Universal DB MCP — 17 Databases, Read-Only Default
Universal DB MCP is a multi-DB MCP connector (stdio/http) with read-only default and caching; verified 782★ and documents 25x–100x speedups in README.
mcp2cli — Turn MCP Servers into CLI Tools, Zero Codegen
Convert any MCP server, OpenAPI spec, or GraphQL endpoint into a full CLI at runtime. Saves 96-99% of tokens wasted on tool schemas every turn.