Writing ·
LLMs for fun and profit - Why this product exists
So what is “MCP DB Wizard”, and why should you trust it?
In the beginning…
The core code behind MCP DB Wizard was written in 2002 and 2003. The author had noticed that there was a big disconnect between what you could express in Oracle’s PL/SQL and what you could move across a wire with JDBC.
Conventional JDBC thinks in terms of scalar variables and cursors. Oracle’s PL/SQL has a whole zoo of data types:
- %ROWTYPE, a record matching a database table row
- Ref cursors tied to a table row structure
- Ref cursors that could be anything
- Records that can include %ROWTYPEs as attributes
and so on…
It is always possible to use these with JDBC. But it’s never fun.
This, in his mind, created an opportunity.
This turned into a product called “OrindaBuild”. It added DAO functionality, as well as the ability to call arbitrary, but predefined SQL statements. It sold reasonably well, but for various reasons the author took it off the market and took a normal job instead.
LLMs enter that chat…
20 years later, and all of a sudden the entire world wants to connect agentic AI to databases. This goes just as badly as you think it could, possibly worse. Handing an unconstrained SQL prompt to an agent seems like an obvious thing to do, but it almost always ends badly. On the other hand, hand coding an application to expose only the needed functionality is time consuming and error prone.
Why can’t I just connect SQL?
Three reasons.
Firstly, in a career spent working with databases I have never once seen a database who contents were a literal description of the table and column names. There are many reasons why, but to start with:
- Enterprise schemas can be very complex (hundreds of tables!), and also very abstract. Look at your production system and see what proportion of the ‘tables’ refer to real world things you can point at, pick up and hold. Not that many. And once we move into the realm of the abstract, you need more knowledge than you can squeeze into a column name to understand how to use the data.
- Real world systems invariably have exceptions or oddball bits of data. For example: a ‘Bookings’ table for a software company might mostly be rows referring to products that were sold, but also contains intra-company transfers for historical reasons. As a result, a specific, and complicated SQL statement may be needed to get ‘real’ numbers.
- Real world systems can react badly to poorly written, or overly broad. This bot only burns resources but can break some production systems.
The bottom line is you need ‘something’ between a SQL prompt and a hand-coded application. You need MCP DB Wizard.
MCP DB Wizard closes the gap
The original product took a list of PL/SQL procedures, tables and SQL statements and made them accessible via a Data Access Object. The new version exposes each of those components as a seperate tool in a custom MCP server. The developer can also add tool level descriptions that make it clear to the LLM which tool to use for which purpose.
- Only things you asked for become tools - there is no SQL prompt.
- All code is written properly. Prepared Statements. Connection pools. Parameter checking.
- The full version has extensive audit trail functionality, which can’t bypassed.
- All versions export prometheus metrics, and we also have a Grafana dashboard.
How do I get MCP DB Wizard?
Currently it’s available via our GitHub Repo as a docker image.