Repository navigation
feat(db-connector): add read-only MySQL/PostgreSQL/MongoDB connector plugin - #184
Open
mojianjjun wants to merge 1 commit into
Open
mojianjjun wants to merge 1 commit into
mojianjjun wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin type / 插件类型
Affected plugin name(s) / 涉及的插件名称:
db-connectorWhat / 改动内容
Adds db-connector v0.1.2 — a read-only database access plugin for ZCode.
Problem it solves / 解决的问题:lets the AI query MySQL/MariaDB, PostgreSQL and MongoDB directly in the session, with zero write/DDL surface. Today users hand-write one-off scripts or paste dumps to explore data; this plugin makes it conversational and safe by default.
Capabilities / 能力:
db_add_connection/db_remove_connection/db_list_connections/db_set_active_environment), connectivity test, table & schema browsing, read-only SQL with mandatory parameter binding (MySQL?/ PG$1), Mongofind/aggregate($out/$mergerejected)protectedbanners for production, cross-environmentenv/namereferences, workspace/user config mergemaxRowLimitceiling${ENV_VAR}references resolved from.envfiles — plaintext passwords are rejected at write time; all tool output maskedSelf-contained runtime / 自包含运行时:the server ships as a single esbuild bundle (
mcp/dist/db-connect-server.bundle.cjs, ~3 MB, dependencies inlined with their license notices) so an installed plugin runs with zeronpm install. TypeScript sources are included undermcp/src.How to test / 测试方式
~/.zcode/db-connector/.env(DB_DEV_PW=...), then ask: "Use db-connector to add a MySQL connection: environment dev, name mysql-main, database shop, password in DB_DEV_PW"db_test_connection→db_list_tables→db_describe_table→db_querywithparamsbindingcd mcp && npm install && npm test(26 smoke cases, no real database needed; injection payloads and write statements must all be rejected);mcp/test/real-mysql.mjsran 19/19 against a real MySQL 8 instanceSelf-check / 自查清单
external_plugins/<name>/categoryis set independently of publisher ownership(developer-tools)versionconsistent in BOTHplugin.jsonandmarketplace.json(0.1.2,new plugin first release)README.md(EN) andREADME_CN.md(中文) both present and equivalentdescription_i18nhas bothenandzh-CNnodestdio process; writes only~/.zcode/db-connector/*and workspacedb-connections.json/.env)python3 scripts/validate.pyandpython3 scripts/build_dist.pypass locally — note: this contribution comes from a network-restricted environment where cloning the full repo was not feasible. A rule-by-rule equivalent of validate.py is bundled atmcp/test/check-official-rules.py(kebab-case name,./external_plugins/<name>source, description/description_i18n(en,zh-CN)/semver/category whitelist, dir-name match, symlink sweep, 5000-file / 256 MB caps, manifest↔entry consistency) and passes locally; upstream CI running the original scripts should confirm.Third-party code bundled / 内联的第三方代码:mysql2(MIT)、node-postgres(MIT)、MongoDB Node driver(Apache-2.0),inlined via esbuild
--legal-comments=inlinewith license notices preserved. Upstream development repo: mojianjjun/zcode-plugins.