JDBC MCP Server logo

JDBC MCP Server

Read-only JDBC access for querying databases, inspecting schemas, validating SQL, and analyzing execution plans.

Install JDBC MCP Server

Run the project’s own setup commands, in order.

Setup steps from the project

JDBC MCP Server installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    ./gradlew bootJar   # → build/libs/jdbc-mcp-server.jar
    
  2. 2. Add to Claude Code
    claude mcp add --scope user jdbc -- java -jar /path/to/jdbc-mcp-server.jar
    
  3. 3. Add to Codex
    codex mcp add jdbc -- java -jar /path/to/jdbc-mcp-server.jar
    

Overview

JDBC MCP Server exposes read-only relational database access over MCP using JDBC. It supports PostgreSQL, Oracle, SQL Server, Firebird, SQLite, and other databases through an external JDBC driver, with multiple named connections configured in one file. Agents can run bounded SQL, inspect schema objects and relationships, validate or lint queries, resolve lineage, and analyze execution plans and timings. Reach for it when an agent needs database-aware SQL authoring, schema exploration, or query-performance investigation without write access.

Use cases

  • Answer read-only data questions with parameterized SQL
  • Explore unfamiliar schemas and foreign-key relationships
  • Validate and lint SQL before execution
  • Diagnose slow queries with plans and benchmarks

Key features

  • Read-only JDBC access across multiple named connections
  • SQL execution with parameters, limits, and timeouts
  • Execution-plan inspection and performance analysis
  • Schema metadata, lineage, and relationship discovery
  • Query validation, parsing, and linting
  • Usage-catalog search for application SQL

Tools49

What JDBC MCP Server lets your agent do. Expand a tool for its parameters.

Self-reported~2.6k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/14 checks healthy over the last 68d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit13d agoMost recent push to the default branch.
Tools exposed49Callable tools this server registers over MCP.

How JDBC MCP Server works

What JDBC MCP Server does

JDBC MCP Server gives MCP clients read-only access to relational databases through JDBC. It combines SQL execution with database metadata and analysis tools, so an agent can discover a schema, construct a query, check it before execution, and investigate its performance.

Built-in database handling covers PostgreSQL 11+, Oracle 12c+, SQL Server 2012+, Firebird 3+, and SQLite. Other JDBC-compatible databases can be used with an external driver JAR. A single server process can expose any number of named database connections.

The server is suited to data questions, unfamiliar-schema exploration, SQL review, query tuning, and schema or index audits. It is not intended for data modification: its SQL guard accepts a single SELECT, WITH, or EXPLAIN statement, and database-side read-only protections can add another layer where supported.

How it works

The server uses the MCP stdio transport. An MCP client starts the Java process and communicates with it over standard input and output; no network port is required. Connections are created on first use, and each tool identifies the target database with a connection name.

Database definitions live in connections.json, normally under ~/.jdbc-mcp-server/ on the host or /data/connections.json in the Docker image. Each entry contains a JDBC URL and may include credentials, a default schema, a description, and schema settings for the structure snapshot. The engine is inferred from the URL prefix. Generic JDBC connections also specify driverPath.

Query tools support positional ? parameters through params and named :name parameters through namedParams. Limits and timeouts can be supplied for query execution; benchmarking requires both a row limit and a timeout. PostgreSQL plan analysis can use EXPLAIN ANALYZE when requested.

Setup and configuration

Obtain the JAR from the latest project release, build it with ./gradlew bootJar, use the published Docker image, or run it through JBang. Java 21 or newer is required for the JAR. The bundled drivers cover the built-in database engines; an external driver JAR is needed for another JDBC database.

A minimal MCP client registration runs:

config.json
{
  "command": "java",
  "args": ["-jar", "/absolute/path/jdbc-mcp-server.jar"],
  "env": {}
}

The connection file can contain several databases, each keyed by a name. The url field is required. Credentials may be placed in the connection definition, including passwords that reference ${VAR} values. Use a database account with read-only permissions, and restrict access to the connection file because it can contain credentials.

Tools and capabilities

  • Execute SELECT, WITH, and EXPLAIN statements with parameters, row limits, and timeouts.
  • Return execution plans for PostgreSQL, Oracle, and SQL Server using each engine's plan facilities.
  • Summarize costly plan nodes, large-table scans, estimate errors, risky nested loops, and disk sort spills.
  • Validate SQL without running it, inspect its parsed structure, and report parser or syntax-related findings.
  • Lint queries for issues such as unknown objects, SELECT *, unconditional joins, and index coverage concerns.
  • Resolve query lineage through tables, views, materialized views, and available routine source.
  • Measure query wall-clock timings and compare cold and warm benchmark runs.
  • List schemas, tables, views, routines, sequences, triggers, and view or routine definitions.
  • Describe tables with columns, keys, indexes, foreign keys, checks, allowed values, and trigger metadata.
  • Build schema context, table relationship paths, graph metrics, and DOT/Graphviz output.
  • Search application-query usage catalogs and retrieve queries associated with a table.

Tool groups can be disabled individually. The server also maintains a per-connection SQLite-based structure snapshot and optional usage catalog for schema and query-context operations.

Limitations and notes

The write-protection design combines a JSqlParser AST check with session-, transaction-, or file-level read-only modes where the database supports them. A read-only database user remains the recommended protection because it does not depend on the server's safeguards.

Plan behavior and available metadata vary by database engine. For example, PostgreSQL estimate-versus-reality analysis requires analyze=true, while generic JDBC databases rely on JDBC metadata and the capabilities of their external driver. The server keeps query execution bounded when limit and timeoutSeconds are used; benchmark calls require both values and do not permit unbounded execution.

The stdio design means the MCP client must be able to launch the Java process or an equivalent Docker or JBang command. Connection credentials are configured outside the client registration, in the server's connection file.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about JDBC MCP Server

JDBC MCP Server is an MCP server that connects AI clients to relational databases through JDBC, including PostgreSQL, Oracle, SQL Server, Firebird, and SQLite. Its main tools execute read-only SQL, inspect schemas, validate and lint queries, explain plans, analyze performance, and resolve table or query relationships.

Install it by downloading the JAR from the latest release, building it with `./gradlew bootJar`, using the Docker image, or running it through JBang. Java 21 or newer is required for the JAR, and the process is registered with an MCP client as a stdio command.

Configure databases in `connections.json`, normally at `~/.jdbc-mcp-server/connections.json`. Add one named entry per database with a JDBC `url`; credentials, a default schema, a description, and an external `driverPath` for generic JDBC databases are optional settings.

Yes, JDBC MCP Server works with Cursor through its stdio MCP configuration. Register the Java JAR command in Cursor, then place the database definitions in the server's `connections.json` rather than in the client configuration.

No, its SQL execution path is read-only and accepts a single `SELECT`, `WITH`, or `EXPLAIN` statement. JSqlParser checks the statement, and additional database read-only modes may apply; using a read-only database account provides protection independent of the server.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewJDBC MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/jdbc-mcp-server?style=directory)](https://allmcps.com/mcp/jdbc-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/jdbc-mcp-server"><img src="https://allmcps.com/api/badge/jdbc-mcp-server?style=directory" alt="JDBC MCP Server on AllMCPs" /></a>