MySQLHow to serve MySQL or MariaDB as a REST API and MCP server

Open MySQL or MariaDB to apps and agents, permissioned per table.

Register it once as type mysql or mariadb. Every table is served as REST routes and as MCP tools.

Every role, decided on the table. Every call, on the record. The rows stay in your database; nothing is copied out of it.

Free licence: 50,000 requests a month, for any use, commercial included, no card. Need more? See pricing.

acme / people / mysql / acme / employee

Request

GET /minimal/api/rest/auto/v1/acme/people/mysql/acme/employee?fc=id,full_name,department_id&oy=id.as&ps=5&pg=0
Host: api.acme.example
LB-Access-Token: <your-access-token>

Response · 200

[
  { "id": 1, "full_name": "Rafael Delacroix", "department_id": 11 },
  { "id": 2, "full_name": "Rafael Müller", "department_id": 7 },
  { "id": 3, "full_name": "Rafael Novak", "department_id": 8 },
  { "id": 4, "full_name": "Kwame Haddad", "department_id": 6 },
  { "id": 5, "full_name": "Rafael Haddad", "department_id": 6 }
]

Four things that are specific to MySQL and MariaDB.

Two names: mysql and mariadb

mysql and mariadb are the path segments, and the db_type you register each database with. The short codes ms and ma also work in the path and as the MCP type argument.

Writes are transactional

A multi-row insert lands in one transaction, and a PUT or DELETE that matches many rows runs as one statement, atomic the same way. A Custom API definition’s logic steps run in one transaction, so a failure partway rolls back what already ran.

Schema changes are not

Schema statements are transactional on Postgres only. A multi-statement run on MySQL or MariaDB can leave some statements applied and later ones failed. The run’s status partial is the only warning, so read each statement’s own status in the run record.

Statements refused on this family

DROP combined with SCHEMA, and PREPARE, EXECUTE, DEALLOCATE and CALL, are refused outright on MySQL, MariaDB and the databases that speak the MySQL protocol. Postgres and ClickHouse do not refuse them.

Change one word. Get the same answer.

The Book’s worked Acme database runs on Postgres. Move the same table to MySQL or MariaDB and the call changes in one place: postgres becomes mysql or mariadb. The request, the role checks and the response stay the same, so moving a database is a configuration change, not a rewrite of the code that calls it.

acme / people / mariadb / acme / employee

Request

DELETE /minimal/api/rest/auto/v1/acme/people/mariadb/acme/employee?id=eq.5
Host: api.acme.example
LB-Access-Token: <token · roles hr-analyst · key_type -r-->

Response · 403

{
  "code": 403,
  "status": "Forbidden",
  "message": "insufficient permissions for this operation on this table, got [hr-analyst]"
}

Acme’s employee table, as printed for Postgres in the Book of Minimal. The read goes to MySQL (mysql) and the refused delete to MariaDB (mariadb); only the database engine segment differs. Vol. I, Chapter 5 is the full query language.

One table per call.

The Auto API reads and writes one table per call: no joins, no subqueries, no aggregate functions. A join belongs in a view, or in a Custom API definition. Sign-in comes from Zitadel in the Docker Compose setup, which can sign in your customers too, or from the gateway you already run; third-party services stay where they already are.

Also: Postgres · ClickHouse · All of Minimal Core · Pricing

Put it in front of a MySQL or MariaDB database.