OP

OpenLink Generic JDBC ODBC MCP Server

Connect to any DBMS with OpenLink's Generic JDBC/ODBC MCP server for secure, high-performance database access and driver management.

Quick Install
npx -y @OpenLinkSoftware/mcp-jdbc-server

Overview

The OpenLink Generic JDBC/ODBC MCP server is a lightweight Java-based Model Context Protocol (MCP) server that exposes JDBC-compatible databases to MCP clients. Built with Quarkus, it acts as a small bridge between any JDBC driver and tools that speak MCP (for example, Claude Desktop), enabling schema discovery, table inspection, and query execution over a consistent API. It works with Virtuoso and any other DBMS that has a JDBC driver.

This server is useful when you need a standardized, low-latency way to expose database metadata and query results to external tools, agents, or LLM-integrations. It simplifies driver management (you can add JDBC driver JARs to the server classpath) and supports multiple result formats (JSONL for programmatic consumption, Markdown tables for human-readable output). Virtuoso-specific extensions (SPARQL, SPASQL, stored procedures, and LLM assistant hooks) are available when connected to a Virtuoso backend.

Features

  • Discover schemas and list available schema names.
  • Enumerate tables per schema and filter table names by substring.
  • Describe table structure: columns, types, nullability, primary/foreign keys, autoincrement.
  • Execute arbitrary SQL and return results as JSONL or Markdown tables.
  • Execute stored procedures (Virtuoso-specific).
  • Run SPASQL and SPARQL queries when connected to Virtuoso.
  • Load multiple JDBC drivers by adjusting the server classpath — no code changes required.
  • Small footprint and easy to run with Java 21+.

Prerequisites

  • Java 21 or newer installed on the host.
  • A JDBC driver for your target DBMS if not using a built-in driver (add it to the classpath).

Installation / Configuration

Clone the repository and run the server:

git clone https://github.com/OpenLinkSoftware/mcp-jdbc-server.git
cd mcp-jdbc-server

Example: start the bundled runner JAR (set env vars before running):

export jdbc.url="jdbc:virtuoso://localhost:1111"
export jdbc.user="dba"
export jdbc.password="dba"
java -jar MCPServer-1.0.0-runner.jar

You can store connection defaults in a .env-style file or pass them through your process manager:

# .env
jdbc.url=jdbc:virtuoso://localhost:1111
jdbc.user=dba
jdbc.password=dba
jdbc.api_key=sk-xxx

Running with additional JDBC driver JARs (example for multiple drivers):

java -cp "/path/to/MCPServer-1.0.0-runner.jar:/path/to/mysql-connector.jar:/path/to/other-driver.jar" io.quarkus.runner.GeneratedMain

Example Claude Desktop integration snippets (update paths and credentials):

Single-jar (driver bundled or using the runner JAR):

{
  "mcpServers": {
    "my_database": {
      "command": "java",
      "args": ["-jar", "/path/to/mcp-jdbc-server/MCPServer-1.0.0-runner.jar"],
      "env": {
        "jdbc.url": "jdbc:virtuoso://localhost:1111",
        "jdbc.user": "username",
        "jdbc.password": "password"
      }
    }
  }
}

Classpath with external JDBC drivers:

{
  "mcpServers": {
    "jdbc": {
      "command": "java",
      "args": [
        "-cp",
        "/path/to/MCPServer-1.0.0-runner.jar:/path/to/driver1.jar:/path/to/driverN.jar",
        "io.quarkus.runner.GeneratedMain"
      ],
      "env": {
        "jdbc.url": "jdbc:mysql://db:3306/mydb",
        "jdbc.user": "dbuser",
        "jdbc.password": "s3cret"
      }
    }
  }
}

Available Tools

The server exposes a set of MCP tools (RPC endpoints) that clients can invoke. Common tools include:

Tool namePurpose
jdbc_get_schemasReturn a list of schema names available in the connected DBMS.
jdbc_get_tablesList tables for a schema (includes metadata like TABLE_NAME, TABLE_TYPE).
jdbc_filter_table_namesReturn tables whose names contain a substring (q parameter).
jdbc_describe_tableDetailed column/constraint metadata for a given table.
jdbc_query_databaseExecute SQL and return results in JSONL format.
jdbc_execute_queryExecute SQL and return JSONL results (alias/variant).
jdbc_execute_query_mdExecute SQL and return results as a Markdown table.
jdbc_spasql_queryVirtuoso: execute SPASQL and return results.
jdbc_sparql_queryVirtuoso: execute SPARQL and return results.
jdbc_virtuoso_support_aiVirtuoso-only assistant/agent integration with LLMs.

Input parameters are typically passed per-call (user, password, url, schema, table, q, etc.) and default to the server environment values when omitted.

Use Cases

  • Schema discovery for tooling: an analytics UI or assistant can call jdbc_get_schemas then jdbc_get_tables to build a navigable schema tree without manual DB access.

    • Example: call jdbc_get_schemas -> get [“public”,“sales”] -> call jdbc_get_tables(schema=“sales”).
  • Automated table inspection before code generation: use jdbc_describe_table to fetch columns and keys to scaffold ORM models or validation logic.

    • Example: jdbc_describe_table(schema=“public”, table=“orders”) -> receive column list with types and primary key info.
  • Programmatic query execution and downstream parsing: run complex queries via jdbc_query_database and receive JSONL for streaming ingestion into pipelines or LLM prompt augmentation.

    • Example SQL: SELECT id, name, total FROM orders WHERE created_at > ‘2026-01-01’;
    • Output format: one JSON object per row (JSONL), easy to parse in scripts.
  • Human-readable reports and debugging: use jdbc_execute_query_md to return results as a Markdown table for inclusion in reports or chat responses.

  • Virtuoso semantic queries: if connected to Virtuoso, run SPARQL/SPASQL queries or stored procedures and integrate LLM-driven assistants via the jdbc_virtuoso_support_ai tool.

  • Multi-driver setups: host a single MCP server with a shared classpath of JDBC drivers to expose heterogeneous DBMS backends to clients without reinstalling or recompiling the server.

Notes

  • The server relies on the JDBC driver to provide accurate metadata; behavior can vary across drivers.
  • Keep credentials secure; prefer process managers or secrets stores rather than committing connection strings to code.