execute_sql
Execute a SQL statement against the configured database source
sql必填
io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 7, 2026
Execute SQL and inspect tables, views, schemas and more on a configured database.
本地 MCP 服务器,可对配置好的 PostgreSQL 数据库执行 SQL,并查看表、视图、模式、触发器、索引、序列和存储过程。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
参照 仓库 中的启动说明。
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.
Or run the container image:
The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.
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).
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:
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.
One bin serves both faces. The mcp subcommand starts a stdio MCP
server:
MCP client configuration:
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.
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.
MIT — see LICENSE.
来源:README.md,提交 303fded
Execute a SQL statement against the configured database source
sql必填List tables in the configured database source
无需输入参数。
List views in the configured database source
无需输入参数。
List schemas in the configured database source
无需输入参数。
List triggers in the configured database source
无需输入参数。
List indexes in the configured database source
无需输入参数。
List sequences in the configured database source
无需输入参数。
List stored procedures in the configured database source
无需输入参数。
已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
npx @reneturcios/databridge-kit list-tables postgres://user@localhost:5432/mydbdocker run -i ghcr.io/cloudcorprecords/databridge-kit# 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 --versionnpx -y @reneturcios/databridge-kit mcp postgres://alice@localhost/shop{ "mcpServers": { "databridge-kit": { "command": "npx", "args": ["-y", "@reneturcios/databridge-kit", "mcp"], "env": { "DATABRIDGE_DATABASE_URL": "postgres://alice@localhost/shop" } } }}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