MCPDBWizard

Writing  · 

MCP DB Wizard now generates MCP servers for MariaDB

MCP DB Wizard for MariaDB is available now, for MariaDB 11.4, 11.8, 12.3 and 13. Every release is tested against all four, and against 11.4 and 13.0 with lower_case_table_names=1 as well. It is the same generator as the Oracle product: you choose the tables, views, procedures, functions, package members, sequences and your own curated, tested SQL statements an agent may use, and it generates an MCP server that exposes exactly those as typed tools. Nothing you did not select has a tool, and every call binds its values. There is no “run SQL” tool.

docker pull ghcr.io/srmadscience/mcpdbwizard-mariadb:2.0.44

The console, the authenticating proxy, accounts and tokens, the access grid, the audit trail and Context Pinning all work as they do on Oracle, and one licence covers every product. What follows is what is different, which matters most if you are bringing PL/SQL across.

Packages, read from source

MariaDB’s Oracle mode (sql_mode=ORACLE) runs a good deal of PL/SQL, including packages, and so do default-mode packages from 11.4. The catalog does not help: a package’s members do not appear in information_schema, and a ROW parameter’s fields are recorded only in the routine’s source. So MCP DB Wizard parses the package specification and the routine text to find them. Each member becomes its own tool, and a ROW or ROW TYPE OF parameter crosses as a JSON object keyed by field name. (This is also why 10.11 is not supported: there, a login that did not create a routine cannot read its source.)

What else becomes a tool

ObjectOver MCP
Table or view with a primary keyget_by_pk, insert, update, delete, plus a lookup per unique key, index and foreign key
Procedure that returns result setsits tool returns them as result_sets, each with its columns
SYS_REFCURSOR output (12.3+)rows, with each column typed where it is a table’s column
Sequencenextval

Generated columns are never written, and a SPATIAL, FULLTEXT or VECTOR index gets no lookup, since equality cannot use it. On the type side, geometry crosses as EWKT (SRID=4326;POINT(1 2)), and is checked on the way in, so bad text is refused rather than becoming NULL as ST_GeomFromText would make it. vector(n) (11.8+) is an array of numbers, json is JSON text, and binary types are base64. MariaDB has no object or collection types, so the generator never creates shadow types in your database.

Where the runtime differs

An object belongs to a database, not a schema. The login is not part of an object’s name, and “your own objects” means those of the database you connect to, whatever the login is called.

Each tool call is one transaction, and the session is reset after it. A MariaDB session carries state that commit and rollback do not clear: package variables, user variables and temporary tables. On a pooled connection that state would pass to the next caller. So after every call the server resets the session (COM_RESET_CONNECTION, about half a millisecond). The consequence to know: package state lasts one tool call. A package’s initialisation section runs again on each call that uses it, and a routine that needs state between calls has to keep it in a table.

Context Pinning uses user variables instead of SYS_CONTEXT. A pinned URL parameter such as CUSTOMER_NAME is set as @mcp_customer_name at the start of each call, after every @mcp_ variable is cleared. Unset reads NULL. Nothing needs installing in the database.

Every parameter is required. A routine parameter’s default is read, but not applied: the tool asks for every argument.

A statement timeout stops queries, not SLEEP(). Past DAO_QUERY_TIMEOUT_SECONDS a query fails with error 1969. An interrupted SLEEP() or BENCHMARK() inside a routine returns early without an error, so the routine carries on.

Bringing Oracle code across

Oracle-mode PL/SQL compiles readily, and then a few things behave differently. The ones that surprised us while porting our own test schemas:

Try it

Pull the image and point it at a database you are happy for an agent to read:

docker pull ghcr.io/srmadscience/mcpdbwizard-mariadb:2.0.44

Quickstart: MariaDB takes you from that to a working server. If you would rather start on a schema built for the purpose, the MariaDB hotel demo has one, with a customer-facing config that uses Context Pinning. The full reference is MCP DB Wizard for MariaDB.