MCPDBWizard

io.github.srmadscience由 GitHub 帳號 srmadscience 發布v2.0.29更新於 Oct 24, 2026

An Oracle MCP server built from the PL/SQL, tables and statements you select. No run-sql tool

已驗證STDIO僅桌面資料庫開發者工具

概覽

AI 產生的概覽

依你選定的 Oracle 物件產生專屬 MCP 伺服器,只把選中的 PL/SQL 常式、資料表和 SQL 敘述以具型別工具的形式提供給助理。

可以做什麼
  • 從選定的 Oracle 物件產生專用 MCP 伺服器,每個工具都依預存程序真實簽章產生 JSON Schema
  • 呼叫 PL/SQL 程序與函式,支援 OUT、IN OUT 參數、記錄、集合與 REF CURSOR
  • 依主鍵讀寫資料表列,並提供唯一鍵、索引與外鍵子表查詢,可依資料表限縮新增、查詢、更新、刪除範圍
  • 執行你事先測試過的自有 SQL 敘述(含具型別綁定參數),並使用序列
  • 支援 23ai 的 JSON 關聯式 duality 檢視,包含文件新增、查詢、更新、刪除與 etag 樂觀鎖定
  • 同時產生 DAO 工廠、可呼叫敘述封裝、資料表管理器,以及選用的 SOAP 或 JSON-RPC 層
適用情境
當助理需要受控存取真實 Oracle 結構,而通用的 run-SQL 工具風險過高或準確度不足時適用。適合能在產生階段就決定哪些程序、資料表與敘述可被呼叫的團隊,暴露範圍在產生時即固定。
執行需求
建置產生器需要 Java 21 與 Maven,Oracle JDBC 驅動程式從 Maven Central 取得。產生的 MCP 伺服器需要 Java 17+ 才能使用 MCP SDK,預設走 stdio,也可用 Streamable HTTP。需要可連線的 Oracle 執行個體(12c 至 26ai),以及設定檔或 Swing 工具來挑選物件。選用的 bearer token 驗證與 TLS 會在執行時從環境變數讀取密鑰。
安裝前請注意
產生的工具可以新增、更新與刪除資料表列,並對線上 Oracle 資料庫執行你的 SQL 敘述,應逐表限縮增刪改查範圍並謹慎挑選物件。選用的 bearer token 與 TLS 密鑰來自環境變數,未設定時會拒絕啟動。產生的程式碼與設定會列舉你的結構,不要放進公開儲存庫。部分資料型別(SDO_GEOMETRY、作為欄位的 TIMESTAMP WITH TIME ZONE 與 BFILE)不支援或被略過。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 MCPDBWizard,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MCPDBWizard

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.

[Listed on mcpservers.org]

[How MCPDBWizard works: at design time, objects selected against Oracle's data dictionary are saved as a config file and Java is generated for those objects only; at run time an MCP client calls a proxy that checks token, grant and rate limit, then forwards to the generated MCP server, which binds the arguments and calls Oracle.]

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.

oracle:  PROCEDURE order_summary(p_customer IN  NUMBER,                                 p_totals   OUT summary_rec,                                 p_lines    OUT SYS_REFCURSOR)
tool:    order_summary { "p_customer": <number> }      -> { "p_totals": { "orderCount": 12, "value": 4210.55 },           "p_lines":  [ { "sku": "AB-1", "qty": 3 }, ... ] }

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.

bash
mvn clean package

That produces two jars in target/: a plain one, and a self‑contained mcpdbwizard-app-<version>-shaded.jar with the driver bundled.

bash
# Interactive (Swing) -- pick objects and options, save a configjava -jar target/mcpdbwizard-app-*-shaded.jar <log_dir> myconfig.pb2
# Batch -- regenerate from a saved configjava -jar target/mcpdbwizard-app-*-shaded.jar <log_dir> build myconfig.pb2

<log_dir> is created if missing.

Changed in 2026-08: there used to be a leading <access_code> 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:

bash
java -cp target/mcpdbwizard-app-*-shaded.jar \     com.mcpdbwizard.schema.ConfigConverter myconfig.pb2 myconfig.json

What gets generated

DAO factoryone entry point per config, wiring connections and logging
PL/SQL wrappersa class per procedure/function — setParamX, executeProc, getParamY
Table managersrow CRUD by primary key, plus unique‑key, index and foreign‑key‑child lookups
SQL statement classesyour own SQL, with typed bind parameters
SOAP service layeroptional
JSON / JSON‑RPC connectorsoptional
MCP serveroptional (needs Java 17+ for the MCP SDK)

Generated code depends only on com.mcpdbwizard.pub, the runtime library in this repository.

The MCP server

A single generated <Factory>McpServer.java, speaking stdio by default or Streamable HTTP when started with http [port]. Optional bearer‑token auth and TLS both read their secrets from the environment at run time and fail closed if unset, so no secret is baked into the generated source.

It exposes PL/SQL routines, table row CRUD and secondary lookups, user SQL statements, sequences, and — on 23ai — JSON‑relational duality views with document CRUD and etag optimistic locking.

What is exposed is decided when you generate, not at run time. An object you did not select has no code generated for it at all, and TABLE_MCP_CRUD_<i> narrows a table to any subset of create/read/update/delete. An operation that is not exposed has no tool method emitted — it is absent from the binary, not merely unregistered.


Oracle datatype support

Beyond the ordinary scalars and LOBs: 12c identity columns and extended VARCHAR2/RAW; 21c native JSON; 23ai native BOOLEAN, VECTOR (dense, binary and sparse), and JSON‑relational duality views.

Known gaps: TIMESTAMP WITH [LOCAL] TIME ZONE and BFILE cross as procedure parameters but not yet as table columns; SDO_GEOMETRY has no JSON mapping, so a routine using one is skipped; FLOAT16 vectors are blocked server‑side.


Logging

Generated factories pick a LogInterface implementation from the config: console, text file, java.util.logging, Log4j 1.x, SLF4J, or Log4j 2. The SLF4J and Log4j 2 backends live in com.mcpdbwizard.pub and depend only on the facade jar, which is an optional dependency — supply the api plus a binding yourself if you use them.


Tests

The database‑free suite needs nothing and is green on a fresh clone:

bash
mvn test

Tests that need Oracle are gated: with no database reachable they skip rather than fail. To point them at your own instance, copy the templates — the real files are gitignored and never leave your machine:

bash
cp src/test/resources/test-boxes.properties.template src/test/resources/test-boxes.propertiescp Scripts/tns/tnsnames.ora.template                 Scripts/tns/tnsnames.oracp Scripts/boxes.env.template                        Scripts/boxes.env

Per setting, an environment variable (MCPDBWIZARD_TEST_HOST, …) always wins over the file, which is how a run selects one server over another.

A third tier links against generator output: Scripts/testrun_current.sh regenerates code from a set of configs and compiles it, and a family of harnesses then drives that code against a live database.

That tier is not part of this repository, and neither are the schemas it needs. The configs introspect Oracle schemas whose structure is not ours to publish — some of it came from customer work years ago — and a config enumerates the schema it points at, so the configs cannot ship either. The harnesses go with them: they name those schemas' tables and routines, and they only compile against a regenerated tree that cannot exist here.

What that costs you: nothing to run the generator, and nothing to run the suite. The database-free tests are complete and green on a fresh clone; the gated live tests skip. What you do not get is a ready-made corpus to regenerate against. Scripts/check_provisioning.sh stays, and will name the exact objects a config expects, which is the place to start if you build your own.

examples/generated-output/ shows what the generator emits, with no database at all.


Repository layout

PathWhat
src/main/java/com/mcpdbwizard/pubruntime library the generated code links against
src/main/java/com/mcpdbwizard/appthe generator — engine, Swing UI, shared helpers
src/main/java/com/mcpdbwizard/schematyped model of a config; .pb2 ↔ .json
src/main/java/com/mcpdbwizard/mcpdbwizardconnectorJSON / JSON‑RPC connector generator
examples/generated-outputa checked‑in example of generator output, regenerated 2026‑08‑07
Scripts/regeneration, provisioning checks, and the export gate
API docsgenerated javadoc for com.mcpdbwizard.pub, the library you link against

Contributor notes — architecture, conventions and accumulated gotchas — are in CLAUDE.md.


API documentation

API docs for com.mcpdbwizard.pub

That is the runtime library generated code links against, and the only package documented — the generator's own internals are implementation, and publishing them would bury the part you call. The package summary explains what to reach for, and carries the compatibility contract: signatures there are load-bearing for every program this generator has produced, so they gain methods and do not change them.

The same pages are on the project site at mcpdbwizard.com/javadoc. Both are regenerated from source on publish rather than copied from one another.

Locally, mvn javadoc:javadoc writes them to target/reports/apidocs/. It runs with failOnWarnings, so a broken @link fails the build rather than shipping a dead cross-reference.


Known issues

Known issues — what is wrong, what a caller actually sees when it bites, and the workaround for each. Most of them do not announce themselves: a record whose JSON keys are the generated field names rather than the column names, a VECTOR routine parameter that takes a dense array only, a config whose tool count outgrows Oracle's open_cursors.

Every open entry there is also an issue in this repository, linked from the page. Read it before filing — and if one of them is biting you, say so on its issue rather than opening a new one. Three of those entries are documented rather than fixed because nobody has asked, so a comment is the whole difference between "nobody has ever needed this" and "somebody does".


Contributing

See CONTRIBUTING.md. One thing to run before opening a pull request:

bash
Scripts/export/check-export-clean.sh

It fails if a private hostname, a credential or a jar has crept into the tree.

Security

Please report a suspected vulnerability privately, not in a public issue — see SECURITY.md.

Licence

Apache License 2.0 — see LICENSE and NOTICE.

Code this generator emits is your own work and carries no licence obligation from this project. It links at run time against com.mcpdbwizard.pub, which is in this repository and likewise Apache‑2.0, so you can ship generated applications under whatever terms you like.

來源:README.md,提交 f7ecc06

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v2.0.29最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分