aifordatabase-mcp

v0.1.2
io.github.dann26parr69/aifordatabase-mcp Checked 5 hours ago Published 4 months ago

Query any database in plain English or SQL through a guardrailed, read-only data layer.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_connections

List the database connections available to this API key. Returns id, name, type (POSTGRES/MYSQL/MARIADB/MSSQL/MONGODB/SQLITE), host, database, isActive. Use the returned id as connectionId in other tools.

ParameterTypeDescription
pagenumberPage number (default 1)
pageSizenumberItems per page (default 20)

get_schema

Get the cached schema (tables, columns, relationships) of a database connection. Call this once before writing SQL — no discovery queries needed.

ParameterTypeDescription
connectionId *stringConnection id from list_connections

run_query

Run a SQL query directly against a database connection. Deterministic, no AI in the loop, no credits consumed. Returns columns, rows, rowCount, executionTime. On a SQL error the database's own message is returned — fix the SQL and retry. Rows cap at 500, so aggregate in SQL rather than pulling raw tables.

ParameterTypeDescription
connectionId *stringConnection id from list_connections
sql *stringThe SQL statement to execute

ask

Ask a question about a database in plain English. The API's own agent translates it to SQL, runs it, and returns the answer (content), the SQL used (sqlQuery), and the results (queryResult). For follow-up questions, pass the conversationId from the previous response. Consumes AI credits — for repeated/known queries prefer run_query.

ParameterTypeDescription
connectionId *stringConnection id from list_connections
message *stringThe question in plain English, e.g. 'Top 10 customers by revenue in the last 30 days'
conversationIdstringOptional: conversationId from a previous ask response, to keep context for follow-ups

list_workflows

List workflows (scheduled database alerts / reports). Returns each workflow with its trigger type and step/action counts.

ParameterTypeDescription
pagenumberPage number (default 1)
pageSizenumberItems per page (default 20)

create_workflow

Create a workflow: SQL steps + EMAIL/WEBHOOK actions, run manually or on a cron schedule. To make an alert, write a step query that only returns rows when the condition fires and set stopIfEmpty=true — actions then run only when rows come back. Step results are auto-appended to the email/webhook payload. Point a WEBHOOK at a Slack incoming-webhook URL for Slack alerts. Free plan allows 3 workflows.

ParameterTypeDescription
name *stringWorkflow name
triggerType *stringMANUAL (run on demand) or SCHEDULE (cron)
actionsarrayActions fired after steps complete
connectionIdstringConnection id the step queries run against
descriptionstringOptional description
stepsarraySQL steps, run in order
triggerConfigstringFor SCHEDULE: JSON string with a cron expression, e.g. {"cron": "0 9 * * *"}

run_workflow

Run a workflow immediately (regardless of its schedule) and return the run record with its status.

ParameterTypeDescription
workflowId *stringWorkflow id from list_workflows or create_workflow

list_dashboards

List dashboards. Dashboards re-run their widget queries on schedule server-side. To create one, the fastest path is the ask tool: 'create a dashboard showing revenue by month' with a connectionId.

ParameterTypeDescription
pagenumberPage number (default 1)
pageSizenumberItems per page (default 20)

get_usage

Get the current AI-credit budget: included, topUp, used, and remaining (in cents) for the current billing period. Check this to self-throttle ask calls before hitting a 402.