JDBC MCP Server

v0.2.0
io.github.igorolv/jdbc-mcp-server Checked 10 hours ago Published 2 months ago

Read-only SQL, plans, schema for AI agents: PostgreSQL, Oracle, SQL Server, Firebird, SQLite, JDBC

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

rebuildCatalog rebuildCatalog

Create or refresh the persistent local catalog for offline/repeated metadata and usage lookups. Captures configured schema metadata, rebuilds the usage index and returns the distributable catalog file; writes only server-local data, never the inspected database.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemasstringSchemas to capture (CSV); omit for configured/default scope.

benchmarkQuery benchmarkQuery

Measure repeatable query latency with separate cold runs and min/median/max warm-run timings. Use for comparing query rewrites, not retrieving data; timedQuery is the one-run alternative that returns rows. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Returns the size of the last result (rows, columns, truncated), not the rows.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
limit *integerRow limit per run (> 0).
sql *string
timeoutSeconds *integerTimeout per run in seconds (> 0).
coldRunsintegerCold runs (default 1); executed first.
namedParamsobjectValues for ':name' placeholders, keyed by name.
paramsarrayValues for '?' placeholders, in order.
warmRunsintegerWarm runs (default 3).

timedQuery timedQuery

Measure one read-only SQL SELECT / WITH / EXPLAIN while still returning its rows and elapsed time. Use executeQuery when timing is irrelevant or benchmarkQuery for repeated cold/warm measurements. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Adds available per-statement counter deltas (calls, execution time, rows, buffer hits/reads).

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
limitintegerRow limit (default: the connection's maxRows).
namedParamsobjectValues for ':name' placeholders, keyed by name.
paramsarrayValues for '?' placeholders, in order.
timeoutSecondsintegerTimeout in seconds (default: the connection's queryTimeoutSeconds).

listConnections listConnections

Discover the databases served here and the valid name to pass as 'connection'. Call when the target connection is not already established; returns purpose, engine, default schema and local-catalog availability without opening a database connection.

columnDistribution columnDistribution

Measure value frequency and skew for one known column by returning top-N values, counts and row shares. Use columnStats for only cardinality/extremes; runs GROUP BY + COUNT and may be expensive on large tables.

ParameterTypeDescription
column *string
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring
topNintegerTop values to return (default 20, max 1000).

columnHistogram columnHistogram

Measure percentile distribution for one orderable numeric, date, timestamp or text column: min/max, P25/P50/P75/P90/P95/P99 and null counts. Use columnDistribution for top frequent values instead.

ParameterTypeDescription
column *string
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

columnStats columnStats

Measure basic extremes and cardinality for one known column: total/non-null rows, distinct count and min/max. Use columnDistribution for frequent values or columnHistogram for percentiles.

ParameterTypeDescription
column *string
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

estimateSelectivity estimateSelectivity

Estimate how selective one proposed table predicate is without executing the query. Returns planner-estimated rows, the unfiltered baseline and their ratio; use when evaluating filters or composite-index column order.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
predicate *stringRaw boolean SQL without WHERE or ';'.
table *string
schemastring

joinCardinality joinCardinality

Estimate the output size and selectivity of a proposed equi-join between two known tables without executing it. Returns planner estimates for both sides and versus the Cartesian product; use findJoinPaths when the join route itself is unknown.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
fromTable *string
leftColumn *stringColumn in fromTable.
rightColumn *stringColumn in toTable.
toTable *string
fromSchemastring
joinTypestringJoin type: INNER (default), LEFT, RIGHT, FULL
toSchemastring

nullRatio nullRatio

Find sparse or mostly-null fields across every column of one table in a single scan. Returns null/non-null counts and ratios sorted by sparsity; use describeTable when only declared nullability is needed.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

describeTable describeTable

Inspect one known table or view. Use for its fields/columns, types, nullability, defaults, comments, keys, indexes, constraints or triggers. Returns full metadata for that object only; use tableContext when nearby relationships or joins are also needed.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

getRoutineDefinition getRoutineDefinition

Return the source code of one known function, procedure or package, including its body where available. Use listRoutines to discover routine names.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
name *string
schemastring

getTriggerDefinition getTriggerDefinition

Return the full definition/body of one known table trigger. For trigger names and compact metadata, use describeTable first.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
trigger *string
schemastring

getViewDefinition getViewDefinition

Return the SQL text that defines one known view or materialized view. For its exposed fields, keys and other object metadata, use describeTable.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
name *string
schemastring

listRoutines listRoutines

Discover function, procedure and package names in a schema, optionally by name pattern. Use getRoutineDefinition when the source of one known routine is needed.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
namePatternstringJDBC name pattern, e.g. '%calculate%'.
schemastring

listSchemas listSchemas

Discover schema names visible to the current user when the target schema is unknown. Use listTables next to enumerate objects in one schema.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
includeSystembooleanInclude system schemas. Default false.

listSequences listSequences

Discover sequence names and metadata in one schema, or across all schemas when schema is omitted.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring

listTables listTables

Enumerate table and view names in a known schema, optionally filtered by name or type. Does not return fields/columns; use describeTable for one object's structure.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
namePatternstringJDBC pattern ('%' any, '_' one character).
schemastringOmit to use the connection's defaultSchema or the current schema.
typesstringJDBC table types CSV (default TABLE,VIEW,MATERIALIZED VIEW): TABLE,VIEW,MATERIALIZED VIEW,SYSTEM TABLE,GLOBAL TEMPORARY,LOCAL TEMPORARY,ALIAS,SYNONYM

searchObjects searchObjects

Find database objects when only a full or partial name is known. Searches non-system tables, views, routines, packages, sequences and synonyms case-insensitively; use describeTable after finding a table or view whose structure is needed.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
namePattern *stringName pattern — plain substring (auto-wrapped in %..%) or explicit pattern with % / _

analyzePlan analyzePlan

Diagnose query-plan performance with compact structured findings: expensive nodes, large-table full scans, estimation errors, risky nested loops and disk-sort spills. Use explainQuery when the full textual plan is required. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
analyzebooleanExecute the query to collect runtime stats where supported (default false).
namedParamsobjectValues for ':name' placeholders, keyed by name.
paramsarrayValues for '?' placeholders, in order.

explainQuery explainQuery

Return the full engine-specific textual execution plan for a SELECT / WITH statement. Use when raw plan detail is needed; prefer analyzePlan for compact performance findings. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
analyzebooleanExecute the query to collect runtime stats where supported (default false).
namedParamsobjectValues for ':name' placeholders, keyed by name.
paramsarrayValues for '?' placeholders, in order.

inspectQuery inspectQuery

Inspect SQL syntax and structure without accessing a database. Returns a parser-derived AST summary of tables, aliases, expressions, joins, predicates, ordering, columns and parameters; use validateQuery for driver validation or queryLint for metadata-aware advice.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string

queryLint queryLint

Review authored SQL for advisory metadata and indexing problems without executing it. Reports unknown objects, SELECT *, conditionless joins, unindexed FKs and non-leading predicate/order columns; use validateQuery when database-driver acceptance is the question.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
schemastring

resolveQueryLineage resolveQueryLineage

Trace a query's data lineage from direct FROM/JOIN objects through views and optionally routines to underlying physical tables. Use inspectQuery for direct AST references only; routine expansion is best-effort and may miss dynamic SQL.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
expandRoutinesbooleanExpand database functions/procedures referenced by the query, best-effort. Default true.
expandViewsbooleanExpand database views and materialized views recursively. Default true.
maxDepthintegerMaximum recursive expansion depth. Default 5, max 20.
schemastringDefault schema for unqualified names

validateQuery validateQuery

Check whether the database driver accepts a SELECT / WITH / EXPLAIN without executing it: prepares the statement and validates parameters, syntax and referenced objects. Use inspectQuery for parser-only AST inspection or queryLint for advisory metadata/index warnings. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
namedParamsobjectNamed parameters for ':name' placeholders. Required when SQL contains ':name'.
paramsarrayPositional parameters for '?' placeholders, in order. Required when SQL contains '?'.

executeQuery executeQuery

Run a read-only SQL SELECT / WITH / EXPLAIN when actual result rows are needed. Use timedQuery for one timed execution or benchmarkQuery for repeated latency measurements. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Sets 'truncated' when the row cap is hit.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sql *string
limitintegerRow limit (default: the connection's maxRows).
namedParamsobjectValues for ':name' placeholders, keyed by name.
paramsarrayValues for '?' placeholders, in order.
timeoutSecondsintegerTimeout in seconds (default: the connection's queryTimeoutSeconds).

sampleRows sampleRows

Preview a small number of actual rows from one known table or view to understand data shape and example values. For fields, types and constraints without reading row data, use describeTable.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
limitintegerRows to return (default 10, max 100).
schemastring

findJoinPaths findJoinPaths

Find join paths when both endpoint tables are known but the intermediate relationships are not. Traverses declared FK and optional observed join edges in both directions; for one table's immediate neighborhood, use tableContext.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
fromTable *string
toTable *string
fromSchemastring
includeObservedbooleanInclude usage-catalog equi-joins (default: catalog enabled).
maxDepthintegerMaximum FK hops. Default 4.
maxPathsintegerMaximum paths to return. Default 5, max 25.
scanLimitintegerMaximum tables to scan (default 300).
toSchemastring

queryContext queryContext

Build multi-table SQL-authoring context from natural-language terms or an explicit table list. Use when relevant tables are unknown or a request spans several tables; for one known table's fields or structure, use describeTable.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
includeSamplesbooleanInclude up to 3 rows per table (default false).
maxTablesintegerTables to include (default 12).
schemastring
tablesstringForce-include tables (CSV), e.g. customers,orders.
termsstringUser terms, e.g. 'customers order totals'.

schemaBrief schemaBrief

Discover candidate tables and views across a schema when their names are unknown. Returns a broad plain-text map with column counts, PKs and relationship summaries; follow with queryContext for multi-table authoring detail or describeTable for one known object.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
maxTablesintegerTables/views to include (default 2000).
schemastring
termsstringTerms to narrow discovery; falls back to full schema on no match.

schemaGraph schemaGraph

Analyze schema-wide relationship topology: graph nodes/edges, central or isolated tables, components, cycle hints and an optional shortest path. Use findJoinPaths when only paths between two known tables are needed.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
fromTablestringOptional shortest-path start.
maxDepthintegerShortest-path hops (default 4).
maxTablesintegerTables to scan (default 50).
schemastring
toTablestringOptional shortest-path target.

schemaGraphDot schemaGraphDot

Export a schema or selected tables as DOT/Graphviz ERD text with columns, types, PK/FK markers and join edges. Use schemaGraph for graph metrics rather than renderable diagram source.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring
tablesstringTables to include (CSV); omit for all.

schemaLint schemaLint

Audit one table or a schema for modeling and indexing risks: missing PKs, unindexed or mismatched FKs, nullable unique columns, missing CHECKs/remarks, orphan *_id columns, isolation and wide tables. Returns findings, not general table metadata.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
checksstringChecks CSV, e.g. missingPrimaryKey,fkWithoutIndex; omit for defaults.
maxFindingsintegerFindings to return (default 200).
maxTablesintegerTables to scan (default 50).
schemastring
tablestringOmit to scan the schema.

tableContext tableContext

Explore the relationship neighborhood of one known table: compact root/nearby table metadata plus declared FK and optional observed join edges. Use when nearby joins are needed; for only the table's own fields or structure, use describeTable.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
depthintegerFK depth (default 1).
includeIncomingbooleanInclude child references (default true).
includeObservedbooleanInclude declared/observed/semantic usage evidence (default: catalog enabled).
includeStatsbooleanInclude row/size/activity stats (default false).
schemastring

fkIndexCoverage fkIndexCoverage

Audit child-side foreign keys for missing supporting indexes. Returns only FKs not covered by an index starting with the FK columns in order, plus suggested index columns; use describeTable to inspect all keys and indexes of one table.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring
tablestringOmit to scan the schema.

indexStats indexStats

Inspect index definitions together with operational size, usage and cardinality counters for one table or a schema. Use describeTable for structural metadata of one table without live index statistics.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring
tablestringOmit to scan the schema.

redundantIndexes redundantIndexes

Find structurally overlapping non-unique indexes whose leading columns are a strict prefix of another same-type index. Unlike unusedIndexes, this does not depend on workload scan counters.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring
tablestringOmit to scan the schema.

tableStats tableStats

Inspect operational size and activity statistics for one known table: estimated/live rows, storage, dead tuples, maintenance times and scan counters. For fields, keys and constraints, use describeTable; available statistics depend on engine and privileges.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

unusedIndexes unusedIndexes

Find non-PK/non-unique indexes with zero recorded scans as removal candidates. Unlike redundantIndexes, this uses workload counters, which are meaningful only after representative traffic and are not supported by every engine.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
minSizeBytesintegerMinimum size in bytes; omit tiny indexes.
schemastring

findQueriesByColumn findQueriesByColumn

Find stored application/report queries that actually reference one column and show whether it appears in SELECT, WHERE, JOIN, ORDER BY or HAVING. Use describeTable to discover declared columns; schema/table filters are optional and case-insensitive.

ParameterTypeDescription
column *string
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
schemastring
tablestring

findQueriesByTable findQueriesByTable

Find stored application/report queries that actually reference one known table. Use to learn observed filters, joins and business usage, not to inspect declared table structure; resolved names are matched case-insensitively.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
table *string
schemastring

getQuery getQuery

Retrieve the complete stored record for one query whose source identity is already known. Returns SQL, parameters, parsed tables/columns/joins, outputs and field usages; use listQueries, findQueriesByTable or findQueriesByColumn to discover matching records first.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
sourceKind *stringSource kind, e.g. dao, report, database-view.
sourcePath *stringStable source path, e.g. file path.
sourceUnitstringOptional sub-unit, e.g. method name.

invalidateUsageCatalogCache invalidateUsageCatalogCache

Force the server-local usage index to be rebuilt after its configured sources change. Invalidates only the runtime/local index; the next usage lookup rebuilds it synchronously and no inspected database data is modified.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.

listKnownDomains listKnownDomains

Discover the existing business-domain vocabulary and query counts for reuse in listQueries filters.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.

listKnownKinds listKnownKinds

Discover valid usage-catalog source-kind values and their query counts for reuse in listQueries filters.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.

listKnownTags listKnownTags

Discover the existing business-tag vocabulary and query counts for reuse in listQueries filters.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.

listQueries listQueries

Browse or search stored usage-catalog queries by source, business metadata, parse status or free text. Returns summaries newest-ingest first; use getQuery for the complete SQL and evidence of one selected record.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
businessDomainstringExact business domain.
limitintegerRows to return (default 100, max 1000).
offsetintegerPaging offset (default 0).
parseStatusstringParse status: parsed or failed.
searchTextstringCase-insensitive full-text search over SQL, labels, domains and source paths.
sourceKindstringSource kind, e.g. bi-publisher-report or dao.
sourcePathstringSource path LIKE pattern ('%'/'_').
tagstringExact tag.

observedRelationships observedRelationships

Discover empirically observed equi-join column pairs from stored queries, with support counts and contributing query IDs. Use findJoinPaths for declared/combined paths between endpoints; non-equi joins are excluded.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.
minSupportintegerMinimum supporting queries (default 1).
schemastringCase-insensitive filter.
tablestringRequire either join side to use this table.

usageCatalogStatus usageCatalogStatus

Check whether the usage catalog is enabled and ready before relying on observed-query or semantic evidence. Returns configured sources, indexing state, counts and load errors without searching for queries.

ParameterTypeDescription
connection *stringDatabase to run against. Call listConnections for valid names; do not guess.