Dbmcp

ai.haymon由 haymon.ai 發布v0.17.0更新於 Nov 8, 2026

Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite with PII redaction and write-prevention

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

讓 AI 助理連線 MySQL/MariaDB、PostgreSQL 或 SQLite 的 MCP 伺服器,可瀏覽資料庫結構、執行唯讀查詢、視需要寫入並檢視執行計畫。

可以做什麼
  • 列出資料庫、資料表、檢視表、觸發程序、函式、預存程序與具體化檢視,可選擇回傳詳細中繼資料並支援搜尋
  • 執行唯讀 SQL 查詢(SELECT、SHOW、DESCRIBE、USE、EXPLAIN),結果支援游標分頁
  • 僅在關閉唯讀模式時執行寫入查詢與 DDL,例如建立或刪除資料庫、刪除資料表
  • 檢視查詢執行計畫,PostgreSQL 與 MySQL/MariaDB 可選擇附上 analyze 統計
  • 可選擇對查詢輸出做 PII 去識別化,使用正規表達式規則或使用者自備的 NER 模型
適用情境
適合讓助理梳理關聯式資料庫結構、依即時資料回答問題,或針對 MySQL、MariaDB、PostgreSQL、SQLite 撰寫並執行 SQL,包括只能經 SSH 跳板主機存取的資料庫。
執行需求
以本機程序執行(單一執行檔或已發佈的容器映像),透過 stdio 或 HTTP 通訊。需要目標資料庫的連線設定(後端、主機、連接埠、使用者、密碼、資料庫名稱),可用 DBMCP_* 環境變數或 YAML 設定檔提供;DBMCP_TRANSPORT 為必填。HTTP 模式使用 DBMCP_HTTP_HOST 與 DBMCP_HTTP_PORT,綁定非回送位址需在 DBMCP_HTTP_AUTH_TOKEN 提供 Bearer 權杖。SSH 通道需 SSH 主機、使用者及金鑰或密碼。
安裝前請注意
資料庫憑證透過環境變數或設定檔傳入,README 的快速開始範例以明文寫入密碼。寫入工具(writeQuery、createDatabase、dropDatabase、dropTable)可修改或刪除資料;唯讀模式預設開啟,除非確實需要寫入否則應保持開啟。綁定非回送位址會把資料庫暴露給能存取該連接埠的人,Host/Origin 允許清單並非身分驗證。PII 去識別化預設關閉,且僅作用於查詢輸出。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

Database MCP

[CI] [Release] [License: MIT] [Docs]

A single-binary MCP server for SQL databases. Connect your AI assistant to MySQL/MariaDB, PostgreSQL, or SQLite with zero runtime dependencies.

Website · Documentation · Releases

[demo]

Features ✨

  • Multi-database — MySQL/MariaDB, PostgreSQL, and SQLite from one binary
  • MCP tools — schema discovery (listDatabases, listTables, listViews, listTriggers, listFunctions, listProcedures, listMaterializedViews), data access (readQuery, writeQuery), DDL (createDatabase, dropDatabase, dropTable), and explainQuery. Read-only mode hides the write tools (writeQuery, createDatabase, dropDatabase, dropTable). See MCP Tools for per-backend availability.
  • Single binary — ~7 MB, no Python/Node/Docker needed
  • Multiple transports — stdio (for Claude Desktop, Cursor) and HTTP (for remote/multi-client)
  • Layered config — DBMCP_* environment variables, an env file, and an optional YAML config file with ${} interpolation, with sensible defaults per backend
  • SSH tunnel — reach MySQL/MariaDB/PostgreSQL through an SSH bastion with an embedded client: password or key auth, known_hosts verification, automatic reconnect

Install 📦

macOS, Linux, WSL:

bash
curl -fsSL https://dbmcp.haymon.ai/install.sh | bash

Windows PowerShell:

powershell
irm https://dbmcp.haymon.ai/install.ps1 | iex

Windows CMD:

batch
curl -fsSL https://dbmcp.haymon.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

See the installation docs for Docker, Cargo, and other methods.

Quick Start 🚀

Using .mcp.json (recommended)

Add a .mcp.json file to your project root. MCP clients read this file and configure the server automatically.

Stdio transport — the client starts and manages the server process:

json
{  "mcpServers": {    "dbmcp": {      "command": "dbmcp",      "env": {        "DBMCP_DB_BACKEND": "mysql",        "DBMCP_DB_HOST": "127.0.0.1",        "DBMCP_DB_PORT": "3306",        "DBMCP_DB_USER": "root",        "DBMCP_DB_PASSWORD": "secret",        "DBMCP_DB_NAME": "mydb"      }    }  }}

HTTP transport — you start the server yourself, the client connects to it:

bash
# Start the server firstDBMCP_TRANSPORT=http DBMCP_DB_BACKEND=mysql DBMCP_DB_USER=root DBMCP_DB_NAME=mydb dbmcp
json
{  "mcpServers": {    "dbmcp": {      "type": "http",      "url": "http://127.0.0.1:9001/mcp"    }  }}

Note: The "type": "http" field is required for HTTP transport. Without it, clients like Claude Code will reject the config.

To require a bearer token, start the server with DBMCP_HTTP_AUTH_TOKEN and send it from the client:

bash
DBMCP_HTTP_AUTH_TOKEN="$(openssl rand -hex 32)" DBMCP_TRANSPORT=http DBMCP_DB_BACKEND=mysql DBMCP_DB_USER=root DBMCP_DB_NAME=mydb dbmcp
json
{  "mcpServers": {    "dbmcp": {      "type": "http",      "url": "http://127.0.0.1:9001/mcp",      "headers": { "Authorization": "Bearer ${DBMCP_TOKEN}" }    }  }}

Using environment variables

bash
# MySQL/MariaDBDBMCP_DB_BACKEND=mysql DBMCP_DB_HOST=localhost DBMCP_DB_USER=root DBMCP_DB_NAME=mydb dbmcp
# PostgreSQLDBMCP_DB_BACKEND=postgres DBMCP_DB_HOST=localhost DBMCP_DB_USER=postgres DBMCP_DB_NAME=mydb dbmcp
# SQLiteDBMCP_DB_BACKEND=sqlite DBMCP_DB_NAME=./data.db dbmcp
# PostgreSQL through an SSH bastion (DB host is resolved by the bastion)DBMCP_DB_BACKEND=postgres DBMCP_DB_HOST=db.internal DBMCP_DB_USER=postgres DBMCP_DB_NAME=mydb \DBMCP_SSH_HOST=bastion.example.com DBMCP_SSH_USER=deploy DBMCP_SSH_KEY=~/.ssh/id_ed25519 dbmcp
# HTTP transport (loopback only, no token required)DBMCP_TRANSPORT=http DBMCP_DB_BACKEND=mysql DBMCP_DB_USER=root DBMCP_DB_NAME=mydb dbmcp
# HTTP transport on all interfaces — a bearer token is REQUIREDDBMCP_HTTP_AUTH_TOKEN=change-me DBMCP_TRANSPORT=http DBMCP_HTTP_HOST=0.0.0.0 \DBMCP_DB_BACKEND=mysql DBMCP_DB_USER=root DBMCP_DB_NAME=mydb dbmcp

Warning: Binding a non-loopback address (e.g. DBMCP_HTTP_HOST=0.0.0.0) exposes the database to anyone who can reach the port. dbmcp refuses to start in that case unless DBMCP_HTTP_AUTH_TOKEN is set. The Host/Origin allowlists protect against browser DNS rebinding only — they are not authentication.

Using a config file

yaml
# dbmcp.yamldatabase:  backend: postgres  host: localhost  user: postgres  password: ${DB_PASSWORD:?set DB_PASSWORD}  name: mydb
bash
DB_PASSWORD=secret dbmcp --config-file /path/to/dbmcp.yaml

From an MCP client, pass "args": ["--config-file", "~/path/to/dbmcp.yaml"] or an absolute path; relative paths resolve against the process working directory, which the client controls. See Config File.

Configuration ⚙️

Every setting has a DBMCP_* environment variable and a YAML key. Each setting is resolved with clear precedence:

process environment > env files (--env-file) > config files (--config-file) > defaults

Environment variables are typically set by your MCP client (via env or envFile in the server config). An empty DBMCP_* value counts as unset. Nothing is discovered automatically: a file is read only when you name it.

FlagEnv VariableDescription
--config-file <PATH>DBMCP_CONFIG_FILEYAML config file (${} interpolation, strict keys); repeatable (env var: comma list), later wins
--env-file <PATH>DBMCP_ENV_FILEEnv file of KEY=VALUE lines; repeatable (env var: comma list), later wins

Layer files by repeating a flag, e.g. a shared base plus local overrides: dbmcp --config-file base.yaml --config-file local.yaml. Each setting comes from the last file that sets it; lists replace.

There are no per-setting flags. Booleans accept true/false, 1/0, t/f (not yes/no); lists are comma-separated in env vars.

Security note: Read-only mode is on by default (DBMCP_DB_READ_ONLY=true). The default HTTP Origin allowlist accepts browser pages from any port on localhost/127.0.0.1/[::1]; on shared or development machines, set DBMCP_HTTP_AUTH_TOKEN or narrow DBMCP_HTTP_ALLOWED_ORIGINS to the explicit origins you trust (e.g. http://localhost:5173).

The SSH tunnel is MySQL/MariaDB/PostgreSQL only and uses an embedded SSH client (no ssh binary). DBMCP_DB_HOST/DBMCP_DB_PORT are resolved by the SSH server. With both a key and a password set, the key is tried first. See SSH Tunnel for host-key policies, limitations, and troubleshooting.

MCP Tools 🧩

listDatabases

Lists accessible databases, paginated via cursor / nextCursor. See Cursor Pagination for iteration details. Not available for SQLite.

listTables

Lists tables in a database, paginated via cursor / nextCursor. See Cursor Pagination for iteration details.

Parameters: database (defaults to the active database; SQLite has no database parameter), cursor, search, detailed.

search is an optional case-insensitive LIKE/ILIKE pattern with % (any sequence) and _ (single character) as wildcards — pass users% to match names beginning with users, or %order% for substring matching. A bare word with no wildcards matches only an exact table name.

detailed (default false) switches the response shape:

  • Brief (default) — tables is a sorted JSON array of bare table-name strings.
  • Detailed (detailed: true) — tables is a JSON object keyed by table name; each value carries the table's schema, kind, owner, comment, columns[], constraints[], indexes[], and triggers[]. One call returns both the table list and the per-table metadata.

listViews

Lists views in a database, paginated via cursor / nextCursor. Available on MySQL/MariaDB, PostgreSQL (public schema), and SQLite. Parameters: database (defaults to the active database; SQLite has no database parameter), cursor, search, detailed. SQLite returns the brief shape only — search and detailed are not accepted there.

search is an optional case-insensitive LIKE/ILIKE pattern with % (any sequence) and _ (single character) as wildcards. The search value must remain identical across paginated calls for cursor continuity.

detailed (default false) switches the response shape:

  • Brief (default) — views is a sorted JSON array of bare view-name strings. View names are unique per schema, so no duplicates appear.
  • Detailed (detailed: true) — views is a JSON object keyed by bare view name; each value carries the per-backend metadata payload. PostgreSQL exposes schema, owner, description, definition. MySQL/MariaDB exposes schema, definer, security, checkOption, updatable, characterSetClient, collationConnection, definition. See the listViews reference for source columns, enumerated value sets, and intentional omissions per backend.

See Cursor Pagination for iteration details.

listTriggers

Lists user-defined triggers on tables, paginated via cursor / nextCursor. Internal constraint and foreign-key triggers are excluded. Available on MySQL/MariaDB, PostgreSQL (public schema), and SQLite. Parameters: database (defaults to the active database; SQLite has no database parameter), cursor, search, detailed.

search is an optional case-insensitive LIKE/ILIKE pattern with % (any sequence) and _ (single character) as wildcards. The search value must remain identical across paginated calls for cursor continuity.

detailed (default false) switches the response shape:

  • Brief (default) — triggers is a sorted JSON array of bare trigger-name strings.
  • Detailed (detailed: true) — triggers is a JSON object keyed by trigger name; each value carries the per-backend metadata payload (timing, events, definition, and backend-specific extras like PostgreSQL status/functionName or MySQL/MariaDB session-context fields). See the listTriggers reference for the full per-backend field list.

See Cursor Pagination for iteration details.

listFunctions

Lists user-defined SQL functions, paginated via cursor / nextCursor. PostgreSQL excludes aggregates, window functions, and procedures; MySQL/MariaDB excludes loadable UDFs (mysql.func). Available on MySQL/MariaDB and PostgreSQL (public schema). Not available for SQLite. Parameters: database (defaults to the active database), cursor, search, detailed.

search is an optional case-insensitive LIKE/ILIKE pattern with % (any sequence) and _ (single character) as wildcards. The search value must remain identical across paginated calls for cursor continuity.

detailed (default false) switches the response shape:

  • Brief (default) — functions is a sorted JSON array of bare function-name strings. PostgreSQL overloads appear once per overload (duplicate name strings are expected).
  • Detailed (detailed: true) — functions is a JSON object keyed by function signature; each value carries the per-backend metadata payload (language, arguments, return type, definition, and backend-specific extras such as PostgreSQL volatility/strict/parallelSafety or MySQL/MariaDB session-context fields). PostgreSQL keys are name(arguments) (overloads disambiguate); MySQL/MariaDB keys are bare names (no overloading). See the listFunctions reference for the full per-backend field list.

See Cursor Pagination for iteration details.

listProcedures

Lists user-defined stored procedures, paginated via cursor / nextCursor. Available on MySQL/MariaDB and PostgreSQL (public schema, PostgreSQL 11+). Not available for SQLite. Parameters: database (defaults to the active database), cursor, search, detailed.

search is an optional case-insensitive LIKE/ILIKE pattern with % (any sequence) and _ (single character) as wildcards. The search value must remain identical across paginated calls for cursor continuity.

detailed (default false) switches the response shape:

  • Brief (default) — procedures is a sorted JSON array of bare procedure-name strings. PostgreSQL overloads appear once per overload (duplicate name strings are expected).
  • Detailed (detailed: true) — procedures is a JSON object keyed by procedure signature; each value carries the per-backend metadata payload (language, arguments, security, definition, and backend-specific extras such as PostgreSQL owner or MySQL/MariaDB deterministic/sqlDataAccess/session-context fields). PostgreSQL keys are name(arguments) (overloads disambiguate; zero-arg procedures key as name()); MySQL/MariaDB keys are bare names (no overloading). See the listProcedures reference for the full per-backend field list.

See Cursor Pagination for iteration details.

listMaterializedViews

Lists materialized views in the public schema, paginated via cursor / nextCursor. PostgreSQL only — not available for MySQL/MariaDB or SQLite. Parameters: database (defaults to the active database), cursor, search, detailed.

search is an optional case-insensitive ILIKE pattern with % (any sequence) and _ (single character) as wildcards. SQL meta-characters (', ;, --) are bound as parameter values and never interpolated. The search value must remain identical across paginated calls for cursor continuity.

detailed (default false) switches the response shape:

  • Brief (default) — materializedViews is a sorted JSON array of bare matview-name strings. Matview names are unique per schema, so no duplicates appear.
  • Detailed (detailed: true) — materializedViews is a JSON object keyed by bare matview name; each value carries schema, owner, description (or null when no COMMENT ON MATERIALIZED VIEW), definition (the SELECT body verbatim from pg_matviews.definition), populated (false for matviews created WITH NO DATA and never refreshed), and indexed (true when at least one index exists; REFRESH MATERIALIZED VIEW CONCURRENTLY additionally requires a unique index). Detailed mode deliberately omits column metadata, tablespace, storage parameters, and unique-index detection — recoverable via definition, listTables(detailed=true), or readQuery against pg_indexes. See the listMaterializedViews reference for source columns and operational semantics.

See Cursor Pagination for iteration details.

readQuery

Executes a read-only SQL query (SELECT, SHOW, DESCRIBE, USE, EXPLAIN). Always enforces SQL validation as defence-in-depth. Parameters: query, database, cursor. SELECT results paginate via cursor / nextCursor; SHOW, DESCRIBE, USE, and EXPLAIN return a single page and ignore cursor. See Cursor Pagination for iteration details.

writeQuery

Executes a write SQL query (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP). Only available when read-only mode is disabled. Parameters: query, database.

createDatabase

Creates a database if it doesn't exist. Only available when read-only mode is disabled. Not available for SQLite. Parameters: database.

dropDatabase

Drops an existing database. Refuses to drop the currently connected database. Only available when read-only mode is disabled. Not available for SQLite. Parameters: database.

dropTable

Drops a table from a database. If the table has foreign key dependents, the database error is surfaced to the user. On PostgreSQL, a cascade parameter is available to force the drop with CASCADE. Only available when read-only mode is disabled. Parameters: database, table, cascade (PostgreSQL only).

explainQuery

Returns the execution plan for a SQL query. Supports an optional analyze parameter for actual execution statistics (PostgreSQL and MySQL/MariaDB). In read-only mode, EXPLAIN ANALYZE is only allowed for read-only statements since it actually executes the query. In read-only mode, every EXPLAIN runs inside a read-only transaction, so on MySQL/MariaDB plain EXPLAIN of write statements is rejected. SQLite uses EXPLAIN QUERY PLAN (no ANALYZE support). Always available regardless of read-only mode. Parameters: query, database, analyze (PostgreSQL/MySQL only).

Security 🔒

  • Read-only mode (default) — write tools hidden from AI assistant; readQuery enforces AST-based SQL validation
  • Single-statement enforcement — multi-statement injection blocked at parse level
  • Dangerous function blocking — LOAD_FILE(), INTO OUTFILE, INTO DUMPFILE detected in the AST
  • Identifier validation — database/table names validated against control characters and empty strings
  • HTTP bearer authentication — DBMCP_HTTP_AUTH_TOKEN enforces Authorization: Bearer <token> (constant-time compare, 401 on failure); non-loopback binds refuse to start without a token
  • Origin + Host allowlists — server-side rejection (403) plus CORS preflight; configurable for HTTP transport. Defends against browser DNS rebinding — not a substitute for authentication
  • SSL/TLS — configured via individual DBMCP_DB_SSL_* variables
  • SSH host-key verification — the SSH tunnel checks the server key against known_hosts (yes by default); SSH passwords and passphrases are never logged
  • PII redaction (opt-in, off by default) — when enabled, query tool output passes through a regex-based redactor that rewrites detected PII spans across 46 built-in entity types spanning seven categories: personal (email), financial (cards, IBAN, UK bank accounts, sort and US ABA routing codes, CVV), government IDs (SSN, ITIN, EIN, UK/US passports, NHS, NINO, SIN, VAT), contact (phone), network (IP, URL, MAC), digital identity (API keys, JWTs, PEM private keys, password hashes), and crypto wallets. Toggle: DBMCP_PII_ENABLE (pii.enabled). Operator: DBMCP_PII_OPERATOR (pii.operator) — one of replace (default, entity-aware placeholders like <EMAIL_ADDRESS>), mask (length-preserving *), redact (drop), hash (SHA-256 hex). Optional subset via DBMCP_PII_CATEGORIES (pii.categories) (comma-separated, e.g. financial,government); unset enables all built-ins. Scope: query tool output payloads only. See PII configuration for the full surface.
  • ML/NER redaction (opt-in at runtime, off by default) — adds PERSON, LOCATION, ORGANIZATION, NATIONALITY_RELIGION_POLITICS, and FACILITY detection that regex cannot catch, enabled via the DBMCP_PII_NER_ENABLE (pii.ner_enabled) toggle plus a user-supplied model directory. Which entities are produced depends on the model's labels (CoNLL models give person/location/organization; OntoNotes-class models add NRP and facility). Inference uses ONNX Runtime (model directory holds config.json, tokenizer.json, model.onnx; recommended: the MIT-licensed dslim/bert-base-NER exported to ONNX, int8-quantized for speed). Fail-closed: a model that cannot load aborts startup and an inference error fails the request — never a silent fallback. Respects pii.categories. English for v1.
  • Credential redaction — database password is never shown in logs or debug output

Testing 🧪

bash
# Unit testscargo test --workspace --lib --bins
# Integration tests (requires Docker)./tests/run.sh
# Filter by engine./tests/run.sh --filter mariadb./tests/run.sh --filter mysql./tests/run.sh --filter postgres./tests/run.sh --filter sqlite
# With MCP Inspectornpx @modelcontextprotocol/inspector ./target/release/dbmcp
# HTTP mode testingcurl -X POST http://localhost:9001/mcp \  -H "Content-Type: application/json" \  -H "Accept: application/json" \  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}'

Project Structure 🗂️

This is a Cargo workspace with the following crates:

CratePathDescription
dbmcp. (root)Binary shim
dbmcp-clicrates/cli/CLI parsing, transports, server bootstrap
dbmcp-sqlcrates/sql/Shared error types, validation, and identifier utilities
dbmcp-configcrates/config/Configuration structs and validation
dbmcp-servercrates/server/Shared MCP tool implementations and server info
dbmcp-mysqlcrates/mysql/MySQL/MariaDB backend handler and operations
dbmcp-postgrescrates/postgres/PostgreSQL backend handler and operations
dbmcp-sqlitecrates/sqlite/SQLite backend handler and operations
dbmcp-piicrates/pii/PII detection and anonymisation of query output
dbmcp-sql-lineagecrates/sql-lineage/Column-level SQL lineage extraction
dbmcp-sshcrates/ssh/SSH tunnel for database connections
sqlx-jsoncrates/sqlx-json/Type-safe row-to-JSON conversion for sqlx (RowExt trait)

Development 🧰

bash
cargo build              # Development buildcargo build --release    # Release build (~7 MB)cargo test               # Run testscargo clippy --workspace --tests -- -D warnings  # Lintcargo fmt                # Formatcargo doc --no-deps      # Build documentation

License 📄

This project is licensed under the MIT License — see the LICENSE file for details.

來源:README.md,提交 4b8617c

工具

8

explainQuery

Explain Query

Return the execution plan for a SQL query to diagnose performance. Use this tool instead of running EXPLAIN directly through readQuery — it provides structured output. <usecase> Use when: - A query runs slowly and you need to understand why - Investigating performance bottlenecks - Planning index creation to optimize queries - Analyzing join methods, table scan strategies, and sort operations </usecase> <when_not_to_use> - Running actual queries → use readQuery or writeQuery - Checking table structure → use listTables(detailed=true) </when_not_to_use> <examples> ✓ "Why is my SELECT on orders slow?" → explainQuery(query="SELECT ...") ✓ "Should I add an index?" → explainQuery with analyze=true ✗ "Run this SELECT" → use readQuery </examples> <safety> Set `analyze` to true for actual execution statistics (EXPLAIN ANALYZE). IMPORTANT: EXPLAIN ANALYZE actually executes the query! In read-only mode, only read-only statements are allowed with analyze. When analyze is false, returns EXPLAIN FORMAT=JSON output without executing. Only a single SQL statement is accepted. </safety> <what_it_returns> A JSON array of execution plan rows showing access methods, join types, row estimates, and costs. </what_it_returns>

輸入參數query必填analyzedatabase

listDatabases

List Databases

List all accessible databases on the connected server. Use this tool to discover what databases are available before using other tools. <usecase> ALWAYS call this tool FIRST when: - You need to explore what databases exist on the server - You need a database name for listTables or query tools - The user asks what data is available </usecase> <examples> ✓ "What databases are on this server?" ✓ "Show me what's available" → call listDatabases first </examples> <what_it_returns> A sorted JSON array of database name strings. </what_it_returns> <pagination> Paginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. </pagination>

輸入參數cursor

listFunctions

List Functions

List user-defined SQL functions in a database, optionally filtered and/or with full metadata. Loadable UDFs (`mysql.func`) and stored procedures are excluded. <usecase> Use when: - Auditing stored functions across a database (brief mode, default). - Searching for a function by partial name (pass `search`). - Inspecting a function's language, signature, return type, determinism, SQL-data-access classification, security mode, definer, comment, session context, and full reconstructed `CREATE FUNCTION` text before reasoning about correctness or invocation safety (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.ROUTINES` / `information_schema.PARAMETERS`. </usecase> <parameters> - `database` — Database to target. Defaults to the active database. - `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`. - `search` — Case-insensitive filter on function names via `LIKE`. `%` matches any sequence; `_` matches a single character. - `detailed` — When `true`, returns full metadata objects keyed by function name instead of bare name strings. Default `false`. </parameters> <examples> ✓ "What functions are in the mydb database?" → listFunctions(database="mydb") ✓ "Find the order-total calculation" → listFunctions(search="order") ✓ "What does calc_order_total do?" → listFunctions(search="calc_order_total", detailed=true) ✗ "List stored procedures" → use listProcedures instead ✗ "List loadable UDFs from mysql.func" → not supported; only routines in information_schema.ROUTINES are returned </examples> <what_it_returns> Brief mode (default): a sorted JSON array of function-name strings, e.g. `["calc_order_subtotal", "calc_order_total", "double_it"]`. Detailed mode: a JSON object keyed by bare function name (MySQL/MariaDB do not allow function overloading, so no signature suffix is needed); each value carries `schema`, `language` (typically `"SQL"`; MariaDB external-language functions report the external language

輸入參數cursorsearchdatabasedetailed

listProcedures

List Procedures

List user-defined stored procedures in a database, optionally filtered and/or with full metadata. Stored functions and loadable UDFs (`mysql.func`) are excluded. <usecase> Use when: - Auditing stored procedures across a database (brief mode, default). - Searching for a procedure by partial name (pass `search`). - Inspecting a procedure's language, parameter list (with `IN`/`OUT`/`INOUT` modes), determinism, SQL-data-access classification, security mode, definer, comment, session context, and full reconstructed `CREATE PROCEDURE` text before reasoning about correctness or invocation safety (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.ROUTINES` / `information_schema.PARAMETERS`. </usecase> <parameters> - `database` — Database to target. Defaults to the active database. - `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`. - `search` — Case-insensitive filter on procedure names via `LIKE`. `%` matches any sequence; `_` matches a single character. - `detailed` — When `true`, returns full metadata objects keyed by procedure name instead of bare name strings. Default `false`. </parameters> <examples> ✓ "What procedures are in the mydb database?" → listProcedures(database="mydb") ✓ "Find the order archival routine" → listProcedures(search="archive") ✓ "What does archive_order do?" → listProcedures(search="archive_order", detailed=true) ✗ "List functions" → use listFunctions instead ✗ "List loadable UDFs from mysql.func" → not supported; only routines in information_schema.ROUTINES are returned </examples> <what_it_returns> Brief mode (default): a sorted JSON array of procedure-name strings, e.g. `["archive_order", "archive_order_history", "purge_order_archive", "touch_post"]`. Detailed mode: a JSON object keyed by bare procedure name (MySQL/MariaDB do not allow procedure overloading, so no signature suffix is needed); each value carries `schema`, `language` (typically `"SQL"`; MariaDB external

輸入參數cursorsearchdatabasedetailed

listTables

List Tables

List tables in a database, optionally filtered and/or with full metadata. <usecase> Use when: - Exploring a database to find relevant tables (brief mode, default). - Searching for a table by partial name (pass `search`). - Inspecting a table's columns, constraints, indexes, and triggers before writing a query (pass `detailed: true`). This supersedes the legacy `getTableSchema` tool. </usecase> <parameters> - `database` — Database to target. Defaults to the active database. - `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`. - `search` — Case-insensitive filter on table names via `LIKE`. `%` matches any sequence; `_` matches a single character. - `detailed` — When `true`, returns full metadata objects keyed by table name instead of bare name strings. Default `false`. </parameters> <examples> ✓ "What tables are in mydb?" → listTables(database="mydb") ✓ "Find the orders table" → listTables(search="order") ✓ "What columns does orders have?" → listTables(search="orders", detailed=true) </examples> <what_it_returns> Brief mode (default): a sorted JSON array of table-name strings, e.g. `["customers", "orders"]`. Detailed mode: a JSON object keyed by table name; each value carries `schema`, `kind`, `owner`, `comment`, `columns`, `constraints`, `indexes`, and `triggers` (the name is the key and is not repeated inside the value). Keys iterate in the same alphabetical order brief mode uses. Example: `{"orders": {"schema": "mydb", "kind": "TABLE", …}}`. </what_it_returns> <pagination> Paginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity. </pagination>

輸入參數cursorsearchdatabasedetailed

listTriggers

List Triggers

List user-defined triggers in a database, optionally filtered and/or with full metadata. <usecase> Use when: - Auditing trigger coverage across a database (brief mode, default). - Searching for a trigger by partial name (pass `search`). - Inspecting a trigger's timing, event, activation level, full `CREATE TRIGGER` text, and the session context active at trigger-creation time before reasoning about side-effects (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.TRIGGERS`. </usecase> <parameters> - `database` — Database to target. Defaults to the active database. - `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`. - `search` — Case-insensitive filter on trigger names via `LIKE`. `%` matches any sequence; `_` matches a single character. - `detailed` — When `true`, returns full metadata objects keyed by trigger name instead of bare name strings. Default `false`. </parameters> <examples> ✓ "What triggers are in the mydb database?" → listTriggers(database="mydb") ✓ "Find the audit triggers" → listTriggers(search="audit") ✓ "What does orders_audit_after_insert do?" → listTriggers(search="orders_audit_after_insert", detailed=true) ✗ "Show me a trigger's body" → use detailed mode; the `definition` field carries the full `CREATE TRIGGER` text </examples> <what_it_returns> Brief mode (default): a sorted JSON array of trigger-name strings, e.g. `["customers_audit_after_insert", "orders_audit_after_insert"]`. Detailed mode: a JSON object keyed by trigger name; each value carries `schema`, `table`, `timing` (BEFORE/AFTER), `events` (single-element array — `INSERT`, `UPDATE`, or `DELETE`), `activationLevel` (always `ROW` on MySQL/MariaDB), `definition` (the canonical `CREATE TRIGGER` text including `DEFINER=` in `` `user`@`host` `` form), `sqlMode`, `characterSetClient`, `collationConnection`, and `databaseCollation`. The Postgres-only `status` and `functionName` fields are intentionally absent (no per-t

輸入參數cursorsearchdatabasedetailed

listViews

List Views

List user-defined views in a database, optionally filtered and/or with full metadata. Base tables and system-schema views are excluded. <usecase> Use when: - Auditing views across a database (brief mode, default). - Searching for a view by partial name (pass `search`). - Inspecting a view's definer, security mode, check-option level, updatable flag, session character set/collation, and full SELECT body before querying it (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.VIEWS`. </usecase> <parameters> - `database` — Database to target. Defaults to the active database. - `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`. - `search` — Case-insensitive filter on view names via `LIKE`. `%` matches any sequence; `_` matches a single character. - `detailed` — When `true`, returns full metadata objects keyed by view name instead of bare name strings. Default `false`. </parameters> <examples> ✓ "What views are in the mydb database?" → listViews(database="mydb") ✓ "Find the active-users view" → listViews(search="active") ✓ "What does active_users select?" → listViews(search="active_users", detailed=true) ✗ "Show me the columns of a view" → use listTables with `detailed: true` instead ✗ "List materialized views" → MySQL/MariaDB have no materialized-view concept </examples> <what_it_returns> Brief mode (default): a sorted JSON array of view-name strings, e.g. `["active_orders", "active_users", "published_posts"]`. Detailed mode: a JSON object keyed by bare view name; each value carries `schema`, `definer` (`user@host`), `security` (`INVOKER` or `DEFINER`), `checkOption` (`NONE`, `CASCADED`, or `LOCAL`), `updatable` (boolean), `characterSetClient`, `collationConnection`, and `definition` (the SELECT body verbatim from `information_schema.VIEWS.VIEW_DEFINITION`, with no `CREATE VIEW` wrapper). The view name is the map key only — it is not repeated inside the value. Versus the Postgres `listViews` detai

輸入參數cursorsearchdatabasedetailed

readQuery

Read Query

Execute a read-only SQL query. Allowed statements: SELECT, SHOW, DESCRIBE, USE, EXPLAIN. <usecase> Use when: - Querying data from tables (SELECT with WHERE, JOIN, GROUP BY, etc.) - Aggregations: COUNT, SUM, AVG, GROUP BY, HAVING - Listing server variables or status (SHOW) - Viewing table structure (DESCRIBE) - Switching database context (USE) </usecase> <when_not_to_use> - Data changes (INSERT, UPDATE, DELETE) → use writeQuery - Query performance analysis → use explainQuery - Discovering tables or columns → use listTables (pass detailed=true for column-level metadata) </when_not_to_use> <examples> ✓ "SELECT * FROM users WHERE status = 'active'" ✓ "SELECT COUNT(*) FROM orders GROUP BY region" ✓ "SHOW TABLES" or "DESCRIBE users" ✗ "INSERT INTO users ..." → use writeQuery ✗ "EXPLAIN SELECT ..." → use explainQuery for structured analysis </examples> <what_it_returns> A JSON array of row objects, each keyed by column name. </what_it_returns> <pagination> `SELECT` results are paginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. `SHOW`, `DESCRIBE`, `USE`, and `EXPLAIN` return a single page and ignore `cursor`. </pagination>

輸入參數query必填cursordatabase

版本歷史

6
  1. v0.16.0Nov 4, 2026
  2. v0.15.2Oct 26, 2026
  3. v0.15.1Oct 22, 2026
  4. v0.15.0Oct 17, 2026
  5. v0.14.0Oct 15, 2026
  6. v0.13.2Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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