Database connections
DataPorch
Guides

Database connections

Import PostgreSQL, SQLite, and MySQL sources without exposing credentials to MCP clients.

Connection imports happen over the local admin Unix socket. MCP clients cannot import sources and never receive the connection string.

Import a source

dataporch connections import --id finance --kind postgres

The command reads the connection string through a hidden terminal prompt. Supported URL shapes:

KindURL
PostgreSQLpostgres://user:password@host[:port]/database
MySQLmysql://user:password@host[:port]/database
SQLitesqlite:///absolute/path/database.db

The import validates the connection-string shape, normalizes it, and stores the definition without opening or testing the database. Re-importing the same ID updates it. The first schema, table, or column discovery call—or a query— opens the source and reports connectivity or permission failures. See the adapter pages for kind-specific parser and safety behavior:

Use the local plugin path

Bundled Codex and Claude Code plugins connect through dataporch mcp over stdio. They do not require an MCP token, token environment variable, or manual endpoint configuration. Keep the runtime running after importing the source, then install a client plugin.

Direct HTTP MCP authentication

dataporch mcp-token create
export DATAPORCH_MCP_TOKEN='dp-...'

The plaintext token is displayed only when it is created or rotated. The runtime stores its SHA-256 verifier, creation timestamp, and optional rotation timestamp at DATAPORCH_MCP_TOKEN_STORE_PATH, never the plaintext token.

This bearer-token flow is for direct HTTP clients. The endpoint is http://127.0.0.1:8080/mcp; bundled local plugins use the separate stdio adapter and runtime credential.

Confirm the boundary

At this point, the MCP surface can list the source ID and capabilities. It cannot list or retrieve the connection string. Keep the source ID stable; clients use it in every discovery and query request.

If you built from source, replace dataporch with ./bin/dataporch in these commands.