SQL Database
Run safe SQL queries, inspect tables, and read schemas.
| Family | Category | Sub-type | Auth type | Trending score |
|---|---|---|---|---|
| Developer Platform | database | sql | connection_string | 84 |
Overview
| Product URL | API docs | Supported features |
|---|---|---|
| https://www.postgresql.org/ | https://www.postgresql.org/docs/ | tool_discovery, health_check |
Setup
- Install the connector instance.
- Store the provider token or connection secret.
- Sync the tools and test the connection.
- Review approval-gated write tools before running them.
Auth & Configuration
| Field | Required | Type | Notes |
|---|---|---|---|
dialect | Yes | postgresql or mysql | |
ssl | No | boolean | |
statementTimeoutMs | No | integer | |
maxRows | No | integer |
Available Tools
| Tool | Requires approval | Description |
|---|---|---|
query | No | Execute a parameterized SQL query against the database. Returns up to 1000 rows. |
list_tables | No | List all user-created tables in the database with their schemas. |
describe_table | No | Get column names, types, and constraints for a table. |
Use query for the main execution example below because it is safe to run without approval.
Examples
Install
bash
chainabit connectors install sql-database --name "SQL Database"bash
curl -X POST "$BASE_URL/connectors/instances" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectorKey": "sql-database",
"displayName": "SQL Database"
}'javascript
const response = await fetch(`${BASE_URL}/connectors/instances`, {
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"connectorKey": "sql-database",
"displayName": "SQL Database"
}),
});Credentials
bash
chainabit connectors auth <instance-id>bash
curl -X POST "$BASE_URL/connectors/instances/<instance-id>/credentials" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"credType": "connection_string",
"credentials": {
"connectionString": "postgresql://user:password@host:5432/database?sslmode=require"
}
}'javascript
await fetch(`${BASE_URL}/connectors/instances/<instance-id>/credentials`, {
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"credType": "connection_string",
"credentials": {
"connectionString": "postgresql://user:password@host:5432/database?sslmode=require"
}
}),
});Execute
bash
chainabit connectors exec <instance-id> query --input '{}'bash
curl -X POST "$BASE_URL/connectors/instances/<instance-id>/tools/tool_query/execute" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"input": {}
}'javascript
const response = await fetch(
`${BASE_URL}/connectors/instances/<instance-id>/tools/tool_query/execute`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": {}
}),
},
);Security Notes
- Keep tokens, API keys, and connection strings in the encrypted credentials vault.
- Do not allow arbitrary server URLs for remote MCP connectors.
Troubleshooting
- If the health check fails, verify the token scope or credential payload and try again.
- If the tool list is empty, re-run sync-tools after storing the latest credentials.