Back to MCP Catalog

JDBC Database Connector MCP Server

DatabasesJava
Connect LLMs to databases via JDBC for querying and modifying data
Available Tools

read_query

Execute a SELECT query on the database

write_query

Execute an INSERT, UPDATE, or DELETE query on the database

create_table

Create a new table in the database

list_tables

List all tables in the database

describe_table

Get detailed information about a specific table's structure

The JDBC Database Connector enables Large Language Models to interact directly with databases through Java Database Connectivity (JDBC). It allows models to inspect, query, create, and modify database content with simple commands. This connector supports a wide range of databases including PostgreSQL, Oracle, MariaDB, SQLite, and many others, making it a versatile tool for database operations through natural language.

Overview

The JDBC Database Connector is a Model Context Protocol (MCP) server that enables LLMs to interact with databases through JDBC connections. This powerful tool allows models to perform database operations including querying data, modifying tables, and exploring database schemas through natural language.

Installation

Prerequisites

  1. Install JBang - a tool that makes it easy to use Java for scripting.
  2. Ensure Java is installed on your system.

Configuration

Add the following configuration to your MCP client's configuration file (e.g., claude_desktop_config.json or server_config.json):

{
  "mcpServers": {
    "jdbc": {
      "command": "jbang",
      "args": [
        "jdbc@quarkiverse/quarkus-mcp-servers",
        "jdbc:h2:mem:testdb"
      ]
    }
  }
}

You can replace jdbc:h2:mem:testdb with your own JDBC connection URL to connect to different databases.

Usage Examples

Connecting to Different Databases

In-memory H2 Database (for testing)

jbang jdbc@quarkiverse/quarkus-mcp-servers

PostgreSQL

jbang jdbc@quarkiverse/quarkus-mcp-servers jdbc:postgresql://localhost:5432/mydb -u username -p password

Oracle

jbang jdbc@quarkiverse/quarkus-mcp-servers jdbc:oracle:thin:@localhost:1521:orcl

SQLite

jbang jdbc@quarkiverse/quarkus-mcp-servers jdbc:sqlite:path/to/database.sqlite

Using Sample Databases

The connector can download and use sample databases directly from the web using the %{url} syntax:

Chinook Music Database

jbang jdbc@quarkiverse/quarkus-mcp-servers jdbc:sqlite:%{https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite}

Northwind Database

jbang jdbc@quarkiverse/quarkus-mcp-servers jdbc:sqlite:%{https://github.com/jpwhite3/northwind-SQLite3/raw/refs/heads/main/dist/northwind.db}

Supported Databases

The connector supports many popular database systems including:

  • PostgreSQL
  • Oracle
  • MariaDB/MySQL
  • SQLite
  • Microsoft SQL Server
  • SAP DB
  • Informix
  • Firebird
  • HSQLDB
  • H2
  • Apache Derby

Troubleshooting

If you encounter issues:

  1. JBang not found: Ensure JBang is installed and in your PATH, or use the full path to the JBang executable.

  2. Enable detailed logging:

    jbang -Dquarkus.log.file.enable=true -Dquarkus.log.file.path=${user.home}/mcp-jdbc.log jdbc@quarkiverse/quarkus-mcp-servers jdbc:h2:mem:testdb
    
  3. Database connection issues: Verify your JDBC URL, username, and password are correct.

  4. Missing JDBC driver: The connector automatically downloads the appropriate JDBC driver for your database type.

Related MCPs

Milvus Vector Database
DatabasesPython

Connect to Milvus vector database for semantic search and vector operations

MotherDuck DuckDB
DatabasesPython

SQL analytics with DuckDB and MotherDuck for AI assistants

Alibaba Cloud Tablestore
DatabasesJava, Python

Connect to Alibaba Cloud Tablestore for vector search and RAG applications

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.