# AI Data Bridge: Multi-Database Connector (`the.beast/ai-data-bridge`) Actor

Stop juggling 7 different database tools. AI DataBridge connects PostgreSQL, MySQL, MongoDB, Airtable, Notion, and Google Sheets through a single MCP interface. Ask questions in plain English—get answers from any database instantly.
AI database connector, multi-database integration

- **URL**: https://apify.com/the.beast/ai-data-bridge.md
- **Developed by:** [mr beast](https://apify.com/the.beast) (community)
- **Categories:** AI, MCP servers, Developer tools
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## AI DataBridge - Multi-Database Connector

**One unified interface to query ALL your data sources with natural language.**

Stop juggling 7 different database tools. AI DataBridge connects PostgreSQL, MySQL, MongoDB, Airtable, Notion, and Google Sheets through a single MCP interface. Ask questions in plain English—get answers from any database instantly.

***

### The Problem

Your data lives everywhere:

- Customer records in **PostgreSQL**
- Analytics in **Google Sheets**
- CRM data in **Airtable**
- Project tracking in **Notion**
- User sessions in **MongoDB**

**Before AI DataBridge:** Switch between 5+ tools, write different query languages, manually combine results.

**After AI DataBridge:** "Show me customers from Postgres who haven't been contacted in Airtable" → Done.

***

### Key Features

#### Multi-Database Connectivity

| Database | Status | Query Type |
|----------|--------|------------|
| **PostgreSQL** | ✅ Full Support | SQL |
| **MySQL** | ✅ Full Support | SQL |
| **SQLite** | ✅ Full Support | SQL |
| **MongoDB** | ✅ Full Support | JSON Filter |
| **Airtable** | ✅ Full Support | API-based |
| **Notion** | ✅ Full Support | API-based |
| **Google Sheets** | ✅ Full Support | Range-based |

#### Natural Language Queries

Ask questions in plain English. The AI translates to the right query syntax automatically.

**Examples:**

- "Get all orders over $100 from last week"
- "Show me active customers who signed up in January"
- "Find products with less than 10 items in stock"
- "List all tasks marked as urgent in Notion"

#### Schema Discovery

Automatically detect tables, columns, and data types. No manual configuration needed.

#### Unified Output Format

Every query returns the same JSON structure, regardless of source. Perfect for AI agents and downstream processing.

***

### Quick Start

#### 1. Query PostgreSQL

```json
{
    "operation": "query",
    "dataSource": "postgresql",
    "connectionString": "postgresql://user:pass@host:5432/mydb",
    "sqlQuery": "SELECT * FROM customers WHERE status = 'active'"
}
```

#### 2. Natural Language Query

```json
{
    "operation": "natural_language_query",
    "dataSource": "postgresql",
    "connectionString": "postgresql://user:pass@host:5432/mydb",
    "naturalLanguageQuery": "Show me all orders over $100 from last month",
    "aiApiKey": "your-openrouter-key"
}
```

#### 3. Query Airtable

```json
{
    "operation": "query",
    "dataSource": "airtable",
    "airtableApiKey": "pat...",
    "airtableBaseId": "appXXXXXXXXXXXXXX",
    "airtableTableName": "Customers"
}
```

#### 4. Query Notion Database

```json
{
    "operation": "query",
    "dataSource": "notion",
    "notionToken": "ntn_...",
    "notionDatabaseId": "your-database-id"
}
```

#### 5. Query Google Sheets

```json
{
    "operation": "query",
    "dataSource": "google_sheets",
    "googleSheetsCredentials": "{...service account JSON...}",
    "googleSpreadsheetId": "1ABC...",
    "googleSheetName": "Sheet1"
}
```

***

### Who Uses AI DataBridge?

#### AI Agent Developers

Connect Claude, GPT, or custom agents to any database through MCP. No database-specific code needed.

#### Data Analysts

Query multiple sources with one tool. Export unified JSON for BI dashboards.

#### Startup Teams

Your data is scattered across free tools (Sheets, Notion, Airtable). Now query it all professionally.

#### Automation Engineers

Build n8n/Make/Zapier workflows that pull from any database with consistent output.

***

### Operations

#### `query`

Execute a direct query on the specified data source.

#### `natural_language_query`

Ask your question in plain English. AI generates and executes the appropriate query.

#### `describe_schema`

Get table names, column definitions, and row counts for any data source.

#### `test_connection`

Verify that your credentials and connection string are valid.

#### `list_sources`

List all supported data source types.

***

### Output Format

All queries return data in a unified format:

```json
{
    "_source": "postgresql",
    "_table": "customers",
    "_id": "123",
    "_queriedAt": "2026-01-12T10:30:00Z",
    "name": "John Doe",
    "email": "john@example.com",
    "status": "active"
}
```

**Summary (Key-Value Store):**

```json
{
    "success": true,
    "source": "postgresql",
    "table": "customers",
    "rowCount": 150,
    "executionTimeMs": 45
}
```

***

### MCP Integration

#### With Apify MCP Server

Add to your `mcp.json`:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com/"
        }
    }
}
```

Then use this Actor through Apify's MCP tools.

#### Direct API Usage

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('the.beast/ai-data-bridge').call({
    operation: 'query',
    dataSource: 'postgresql',
    connectionString: 'postgresql://...',
    sqlQuery: 'SELECT * FROM users LIMIT 10'
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

***

### Pricing

**Pay Per Event** - Only pay for what you query.

| Event | Price | Description |
|-------|-------|-------------|
| **Actor Start** | $0.0001 | Per run initialization |
| **Query Result** | $0.0001 | Per row/record returned |
| **Schema Describe** | $0.001 | Per schema inspection |
| **AI Query Generation** | $0.002 | Per natural language translation |

#### Example Costs

| Use Case | Estimated Cost |
|----------|----------------|
| Query 100 rows from PostgreSQL | ~$0.01 |
| Daily Airtable sync (500 records) | ~$0.05 |
| Natural language query + 50 results | ~$0.01 |
| Schema discovery for 10 tables | ~$0.01 |

***

### Security

- **Connection strings are encrypted** and marked as secrets
- **Read-only by default** - Only SELECT queries for SQL databases
- **No data storage** - Data flows through, never persisted on Apify
- **SSL/TLS** - All database connections use encryption when available

***

### Comparison with Alternatives

| Feature | AI DataBridge | Database MCP Server | Individual Connectors |
|---------|---------------|---------------------|----------------------|
| PostgreSQL | ✅ | ✅ | ✅ |
| MySQL | ✅ | ✅ | ✅ |
| MongoDB | ✅ | ❌ | Separate tool |
| Airtable | ✅ | ❌ | Separate tool |
| Notion | ✅ | ❌ | Separate tool |
| Google Sheets | ✅ | ❌ | Separate tool |
| Natural Language | ✅ | ❌ | ❌ |
| Unified Output | ✅ | ❌ | ❌ |
| Single Config | ✅ | ✅ | ❌ (5+ tools) |

***

### Roadmap

#### v1.1 (Coming Soon)

- Cross-database JOINs ("Join Airtable customers with PostgreSQL orders")
- Supabase support
- Firebase/Firestore support

#### v1.2

- Query caching for repeated requests
- Scheduled queries with webhooks
- Write operations (INSERT/UPDATE)

***

### Support

- **Issues:** [GitHub Issues](https://github.com/your-username/ai-data-bridge)
- **Docs:** [Apify Actor Page](https://apify.com/the.beast/ai-data-bridge)
- **Contact:** Open an issue for feature requests

***

### Changelog

#### v1.0.0 (2026-01-12)

- Initial release
- PostgreSQL, MySQL, SQLite support with full SQL
- MongoDB support with JSON filter queries
- Airtable support with API-based queries
- Notion support with database queries
- Google Sheets support with range-based queries
- Natural language query processing via OpenRouter
- Schema discovery for all sources
- Unified JSON output format

***

### License

MIT License - Use freely in personal and commercial projects.

***

**Keywords:** AI database connector, multi-database integration, natural language SQL, Airtable API, Notion API, Google Sheets API, PostgreSQL connector, MySQL connector, MongoDB connector, MCP server, Claude database, GPT database, AI data integration, unified data access, cross-platform data bridge, database query tool, AI-powered data retrieval, semantic data search, federated data querying

# Actor input Schema

## `operation` (type: `string`):

The database operation to perform.

## `naturalLanguageQuery` (type: `string`):

Ask your question in plain English. Example: 'Show me all customers who signed up last month' or 'Get the top 10 products by sales from my Airtable'.

## `dataSource` (type: `string`):

The type of database or data source to connect to.

## `connectionString` (type: `string`):

Database connection string. For PostgreSQL: postgresql://user:pass@host:5432/db. For MySQL: mysql://user:pass@host:3306/db. For MongoDB: mongodb+srv://user:pass@cluster.mongodb.net/db

## `airtableApiKey` (type: `string`):

Your Airtable Personal Access Token. Get it from airtable.com/account

## `airtableBaseId` (type: `string`):

The ID of your Airtable base (starts with 'app...'). Find it in your base URL.

## `airtableTableName` (type: `string`):

The name of the table within your Airtable base.

## `notionToken` (type: `string`):

Your Notion integration token (starts with 'ntn\_' or 'secret\_'). Create one at notion.so/my-integrations

## `notionDatabaseId` (type: `string`):

The ID of your Notion database. Find it in the database URL after the workspace name.

## `googleSheetsCredentials` (type: `string`):

The JSON content of your Google Service Account credentials. Create one in Google Cloud Console > IAM > Service Accounts.

## `googleSpreadsheetId` (type: `string`):

The ID of your Google Spreadsheet. Find it in the URL: docs.google.com/spreadsheets/d/{SPREADSHEET\_ID}/edit

## `googleSheetName` (type: `string`):

The name of the specific sheet within the spreadsheet (e.g., 'Sheet1').

## `sqlQuery` (type: `string`):

Direct SQL query to execute (for SQL databases). Example: SELECT \* FROM users LIMIT 10

## `mongoQuery` (type: `string`):

MongoDB query as JSON. Example: {"status": "active"}

## `mongoCollection` (type: `string`):

The name of the MongoDB collection to query.

## `tableName` (type: `string`):

The name of the table or collection to describe (for describe\_schema operation).

## `limit` (type: `integer`):

Maximum number of rows/records to return.

## `aiApiKey` (type: `string`):

OpenRouter API key for natural language query processing. Get it from openrouter.ai

## `aiModel` (type: `string`):

The AI model to use for natural language processing.

## Actor input object example

```json
{
  "operation": "natural_language_query",
  "naturalLanguageQuery": "Show me the first 5 records from my database",
  "dataSource": "postgresql",
  "googleSheetName": "Sheet1",
  "limit": 100,
  "aiModel": "google/gemini-2.0-flash-exp:free"
}
```

# Actor output Schema

## `queryResults` (type: `string`):

No description

## `schema` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "naturalLanguageQuery": "Show me the first 5 records from my database"
};

// Run the Actor and wait for it to finish
const run = await client.actor("the.beast/ai-data-bridge").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "naturalLanguageQuery": "Show me the first 5 records from my database" }

# Run the Actor and wait for it to finish
run = client.actor("the.beast/ai-data-bridge").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "naturalLanguageQuery": "Show me the first 5 records from my database"
}' |
apify call the.beast/ai-data-bridge --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,the.beast/ai-data-bridge"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jKf8fE1Nkf6hfrx1e/builds/o86HWq7d5ZedFGN9r/openapi.json
