Skip to main content

DBHub

Description

Provides a universal database gateway for connecting to PostgreSQL, MySQL, SQLite, and DuckDB, enabling table browsing, schema inspection, and read-only SQL queries with built-in safety checks

Visit the server homepage (↗) for more information about how to use this MCP server.

Authorisation

This server does not require any extra authentication to use.

Usage

To use this MCP server in your Portia project, you need to create an McpToolRegistry instance and pass it to the Portia constructor.

McpToolRegistry.from_stdio_connection(
server_name="dbhub-postgres-docker",
command="npx",
args=[
"-y",
"@bytebase/dbhub",
"--transport",
"stdio",
"--dsn",
"<connection_string>",
],
)

Complete example

Equip your Portia instance with the tools from the MCP server, in addition to the default tools from the DefaultToolRegistry:

from portia import DefaultToolRegistry, McpToolRegistry, Portia, Config

config = Config.from_default()
tool_registry = DefaultToolRegistry(config) + McpToolRegistry.from_stdio_connection(
server_name="dbhub-postgres-docker",
command="npx",
args=[
"-y",
"@bytebase/dbhub",
"--transport",
"stdio",
"--dsn",
"<connection_string>",
],
)


portia = Portia(config=config, tools=tool_registry)
Copy to clipboard

Click the "copy" icon in the top right corner of the code block to copy the code to your clipboard.

See more information about integrating MCP servers here (↗).