Databridge Kit

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 7, 2026

Execute SQL and inspect tables, views, schemas and more on a configured database.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

本地 MCP 服务器,可对配置好的 PostgreSQL 数据库执行 SQL,并查看表、视图、模式、触发器、索引、序列和存储过程。

可以做什么
  • 对配置的 PostgreSQL 数据库执行单条 SQL 语句,并以 JSON 对象返回结果行
  • 列出基础表、视图和模式
  • 列出触发器、索引、序列和存储过程(例程)
  • 也可作为命令行工具使用,命令相同,结果以 JSON 输出
适用场景
适合让助手探索或查询某一个 PostgreSQL 数据库,例如了解陌生的库结构或执行临时查询。它是通用桥接工具,也适用于需要助手修改数据的场景。
运行要求
通过 npx 或 Docker 镜像以 stdio 在本地运行。需要 PostgreSQL 连接字符串,可作为命令行参数传入,或放在 DATABRIDGE_DATABASE_URL 环境变量中(DATABASE_URL 也可)。实际查询需要 PATH 中有 psql 客户端;缺少 psql 或连接字符串时服务器仍会启动,但调用会报错。
安装前请注意
连接字符串包含数据库凭据,会出现在命令行或环境变量中。语句类型不受限制,助手既能读取也能写入、修改或删除数据,只应指向允许此类操作的数据库。每次调用只接受一条语句,返回值是 psql 渲染出的字符串。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Databridge Kit,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

databridge-kit

databridge-kit is a small bridge between an agent (or a terminal) and one configured PostgreSQL database. It can run a single SQL statement and answer the seven inspection questions that come up constantly while exploring an unfamiliar database: which tables, views, schemas, triggers, indexes, sequences and stored procedures exist.

The toolset mirrors the documented prebuilt Postgres toolset of a config-defined database toolbox: the tools are fixed, the database is whatever the connection string points at. There is no bundled database driver — statements run through the psql command-line client, so a machine that wants live answers needs psql on its PATH. Without it — or without a connection string — the server still starts and lists its tools; only the calls themselves report the problem.

Install

bash
npx @reneturcios/databridge-kit list-tables postgres://user@localhost:5432/mydb

Or run the container image:

bash
docker run -i ghcr.io/cloudcorprecords/databridge-kit

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
# Run one SQL statement; rows print as JSONdatabridge-kit execute-sql postgres://alice@localhost/shop "SELECT id, name FROM products ORDER BY id"
# Inspection commands; each prints its rows as JSONdatabridge-kit list-tables postgres://alice@localhost/shopdatabridge-kit list-views postgres://alice@localhost/shopdatabridge-kit list-schemas postgres://alice@localhost/shopdatabridge-kit list-triggers postgres://alice@localhost/shopdatabridge-kit list-indexes postgres://alice@localhost/shopdatabridge-kit list-sequences postgres://alice@localhost/shopdatabridge-kit list-stored-procedures postgres://alice@localhost/shop
# Start the MCP server (connection string optional, see below)databridge-kit mcp postgres://alice@localhost/shop
databridge-kit --version

Exit codes: 0 on success, 1 when the statement, the connection string, or psql itself fails (the error says which), 2 for usage errors.

The connection string is a normal PostgreSQL URL: postgres:// or postgresql://, with host, optional port (default 5432), database name from the path, and optional user and password in the userinfo. For the mcp command the string can be left off the command line and supplied through the DATABRIDGE_DATABASE_URL environment variable instead (plain DATABASE_URL works too).

How statements and inspections work

execute_sql accepts exactly one statement per call. Semicolons inside string literals and comments do not count as statement boundaries, but a second real statement is rejected before anything reaches the database. The statement type is not restricted — this is a general bridge, so a caller who can reach it can write as well as read; point it only at databases where that is intended.

Each inspection tool runs one fixed catalogue query:

ToolCatalogue read
list_tablesinformation_schema.tables (base tables)
list_viewsinformation_schema.views
list_schemasinformation_schema.schemata
list_triggersinformation_schema.triggers
list_indexespg_indexes
list_sequencesinformation_schema.sequences
list_stored_procedureinformation_schema.routines

Statements run as psql -v ON_ERROR_STOP=1 --csv -c <sql> and the CSV output is parsed into row objects. Values come back as the strings psql rendered.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/databridge-kit mcp postgres://alice@localhost/shop

MCP client configuration:

json
{  "mcpServers": {    "databridge-kit": {      "command": "npx",      "args": ["-y", "@reneturcios/databridge-kit", "mcp"],      "env": { "DATABRIDGE_DATABASE_URL": "postgres://alice@localhost/shop" }    }  }}

Tools

ToolInputWhat it returns
execute_sqlsql (string, required) — one SQL statementThe result rows as a JSON array of objects keyed by column name.
list_tables—Rows describing the base tables in the configured source.
list_views—Rows describing the views in the configured source.
list_schemas—Rows describing the schemas in the configured source.
list_triggers—Rows describing the triggers in the configured source.
list_indexes—Rows describing the indexes in the configured source.
list_sequences—Rows describing the sequences in the configured source.
list_stored_procedure—Rows describing the stored procedures (routines) in the configured source.

A missing connection, a missing psql, a multi-statement execute_sql, and database errors all come back as tool errors — never as made-up rows.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network, no live databasenpm run dev     # run the CLI from source via tsx

The core logic sits behind an injectable executor interface, which is what the test suite drives: connection-string parsing, the single-statement check, pass-through execution, error propagation, and the exact catalogue SQL behind every inspection tool are all covered with a fake executor.

License

MIT — see LICENSE.

来源:README.md,提交 303fded

工具

8

execute_sql

Execute a SQL statement against the configured database source

输入参数sql必填

list_tables

List tables in the configured database source

无需输入参数。

list_views

List views in the configured database source

无需输入参数。

list_schemas

List schemas in the configured database source

无需输入参数。

list_triggers

List triggers in the configured database source

无需输入参数。

list_indexes

List indexes in the configured database source

无需输入参数。

list_sequences

List sequences in the configured database source

无需输入参数。

list_stored_procedure

List stored procedures in the configured database source

无需输入参数。

版本历史

1
  1. v0.1.0最新Oct 31, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分