Database Connections

Database connections let your AI agents query real data and embed live charts directly in documents. When you connect a database, it serves two purposes:

  1. MCP server for AI agents — agents can query the database during conversations to answer questions with real data
  2. Live data for documents — markdown reports can include charts and tables that query the database on every view

Supported Databases

DatabaseTypeStatus
PostgreSQLpostgresqlFull support
Cloud SQL (PostgreSQL)cloud-sql-postgresFull support
AlloyDBalloydbFull support
MySQLmysqlMCP only (direct query coming soon)
Cloud SQL (MySQL)cloud-sql-mysqlMCP only
BigQuerybigqueryMCP only
ClickHouseclickhouseMCP only
SnowflakesnowflakeMCP only
Microsoft SQL ServermssqlMCP only
Neo4jneo4jMCP only

“Full support” means the database works both as an MCP server for agents AND as a direct query source for chart blocks. “MCP only” databases work with agents but don’t yet support the direct query API for chart blocks.

Setting Up a Connection

1. Go to Integrations

Navigate to your organization’s Integrations page (/{orgId}/integrations). You’ll see available database connectors in the grid.

2. Configure Credentials

Click on a database type (e.g., PostgreSQL) and fill in the connection details:

  • Name — A human-readable name like production-db or belenka-analytics. This name is used to reference the connection in chart blocks.
  • Host — Database server hostname
  • Port — Connection port (default: 5432 for PostgreSQL, 3306 for MySQL)
  • Database — Database name
  • User — Database username
  • Password — Database password (encrypted at rest)

3. Enable in Spaces

After creating the connection at the org level, add it to specific Spaces:

  1. Open a Space
  2. Go to the MCPs panel
  3. Click Add MCP and select your database connection
  4. Toggle it to enabled

The connection is now available to agents in that Space and to chart blocks in any document within that Space.

How It Works

For AI Agents

When an agent runs in a Space with a database connection, it can use SQL tools provided by the MCP server to query your data. The agent decides what to query based on the conversation context.

Example conversation:

You: What were our top 10 products by revenue last month?

Agent: Let me query the database… (runs SQL via MCP)

Here are the top 10 products by revenue for March 2026: …

For Documents (Chart Blocks)

Agents can write markdown documents with embedded chart blocks that query the database live. When anyone views the document, the charts render with fresh data.

See the Interactive Charts guide for the full chart block syntax.

Security

  • Credentials are encrypted at rest using AES-256 encryption
  • Read-only enforcement — the direct query API blocks INSERT, UPDATE, DELETE, DROP, ALTER, and other mutation statements
  • Query timeout — all queries have a 5-second timeout to prevent runaway queries
  • Row limits — results are capped at 1,000 rows
  • Space-scoped access — connections must be explicitly enabled in each Space
  • Authentication required — only authenticated org members can execute queries

Best Practices

  • Use a read-only database user for connections. Never use an admin account.
  • If possible, connect to a read replica instead of the primary database.
  • Consider creating a dedicated database user for TeamDay with access only to the tables you want agents to query.

API Reference

For programmatic access, see the Connections Query API.