Oracle MCP server with no run-sql tool: generated tools for the PL/SQL, tables and tested SQL you choose
MCPDBWizard
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**An MCP server for Oracle, built from the objects you choose.** Tick the PL/SQL packages,
tables, sequences and your own tested SQL statements in a console, and it generates a
**Model Context Protocol server** exposing exactly those to an AI agent as typed tools —
each carrying a JSON Schema derived from the procedure's real signature.
**There is no run-sql tool.** Anything you did not select has no tool, no method and no
class: it is absent from the binary rather than refused at run time. Nothing composes a query
at run time either — the generated code is ordinary Java with fixed SQL statements and typed
binds, and the MCP server calls those wrappers rather than writing SQL for a model to run.
Generating that server means generating the whole calling layer, so you get it too: typed DAO
factories, callable-statement wrappers, table managers and an optional SOAP layer. They are
useful on their own, but the MCP server is the point.
Supports Oracle **12c through 26ai**, and is regression-tested against six live instances
spanning that range.
*How the full product fits together. This repository is the **generator** — the config file,
generate & compile, and the generated MCP server. The Design pages, Runtime page and proxy are the
web console in the Docker image; here you select
objects with the Swing tool or a config file instead, and the generated server can be run on its
own.*
---
The part that is hard
The usual way round is to hand the agent a run-sql tool, and it works until the
schema is real: published text‑to‑SQL accuracy falls sharply on enterprise‑scale schemas
compared with tidy benchmarks, and a wrong UPDATE is not a wrong answer, it is an incident.
The alternative is curated tools — but writing one per procedure by hand does not scale past a
few, and PL/SQL is unusually hostile to deriving them automatically:
- a procedure can have **any number of OUT and IN OUT parameters**, not a single return value
- parameters can be **records** (including records nested inside records), **collections**,
**%ROWTYPEs**, **REF CURSORs**, package types, and overloads
- Oracle's own data dictionary describes these differently between versions
This project does that derivation. Every generated MCP tool carries a real JSON Schema built
from the procedure's actual signature, so the agent is *told* what the parameters are rather
than inferring them from prose.
A record crosses as a JSON object, a REF CURSOR as an array of row objects, a DATE as an
ISO‑8601 string, RAW and binary vectors as base64, CLOB as text, BLOB as base64.
---
Quick start
Requires **Java 21** and Maven. The Oracle JDBC driver (com.oracle.database.jdbc:ojdbc11)
comes from Maven Central — nothing to install by hand.
That produces two jars in target/: a plain one, and a self‑contained
mcpdbwizard-app- -shaded.jar with the driver bundled.
is created if missing.
> **Changed in 2026-08:** there used to be a leading argument. It has been
> **removed**, and a command line that still passes one will be read as the log directory.
> It was validated for shape only — ≥19 characters, not a path, not the literal build —
> and then ignored, so it authenticated nothing. Drop it from any script that supplies it.
Configs are .pb2 (a flat properties file) or .json; both are accepted, and convert
losslessly either way:
---
What gets generated
| | |
|---|---|
| **DAO factory** | one entry point per config, wiring connections and logging |
| **PL/SQL wrappers** | a class per procedure/function — setParamX, executeProc, getParamY |
| **Table managers** | row CRUD by primary key, plus unique‑key, index and foreign‑key‑child lookups |
| **SQL statement classes** | your own SQL, with typed bind parameters |
| **SOAP service layer** | optional |