mcp-jdbc
Java based Model Context Procotol (MCP) Server for JDBC
claude mcp add --transport stdio openlinksoftware-mcp-jdbc-server java -jar /path/to/mcp-jdbc-server/MCPServer-1.0.0-runner.jar \ --env jdbc.url="jdbc:virtuoso://localhost:1111" \ --env jdbc.user="dba" \ --env jdbc.api_key="xxx" \ --env jdbc.password="dba"
How to use
This MCP server implements a JDBC-based data access layer for relational databases (notably Virtuoso and other JDBC-backed DBMS). It exposes a range of MCP client tools that let you list schemas and tables, describe table structures, filter tables by name, and run SQL or Virtuoso-specific queries. Key capabilities include jdbc_get_schemas, jdbc_get_tables, jdbc_describe_table, jdbc_filter_table_names, jdbc_query_database, jdbc_query_database_md, jdbc_query_database_jsonl, and Virtuoso-specific features like jdbc_spasql_query and jdbc_sparql_query. Use these tools from your MCP client to discover database structure, execute queries, and retrieve results in JSONL or Markdown formats, depending on the tool you invoke.
How to install
Prerequisites:
- Java 21 or above
- A JVM environment suitable for running the MCPServer-1.0.0-runner.jar
- A JDBC-compatible database (Virtuoso or any other DBMS with a JDBC driver) and credentials
Installation steps:
- Clone the repository: git clone https://github.com/OpenLinkSoftware/mcp-jdbc-server.git cd mcp-jdbc-server
- Ensure you have Java 21+ installed and available in your PATH.
- Obtain or build the MCP server jar (the project provides MCPServer-1.0.0-runner.jar as the runnable artifact).
- Create or update the environment configuration to point to your database:
- Set jdbc.url, jdbc.user, jdbc.password, and any required jdbc.api_key in an environment file or container environment variables.
- Run the MCP server using the Java command from the mcp_config that will point to MCPServer-1.0.0-runner.jar. For example: java -jar MCPServer-1.0.0-runner.jar
- Verify the MCP client can connect to the running server and list available tools (jdbc_get_schemas, jdbc_get_tables, etc.).
Additional notes
Environment variables:
- jdbc.url: JDBC connection string (e.g., jdbc:virtuoso://localhost:1111)
- jdbc.user: Database username
- jdbc.password: Database password
- jdbc.api_key: Optional API key for authentication if required by your setup
Tips:
- Ensure the JDBC driver for your target DBMS is accessible to the MCP server classpath if you’re using a custom driver setup.
- For Claude Desktop users, you can embed the Java command with -jar path to MCPServer-1.0.0-runner.jar and provide jdbc.* env values in claude_desktop_config.json as shown in the README.
- When using jdbc_query_database_jsonl or other JSONL outputs, you can stream results to clients that process line-delimited JSON.
- The Virtuoso-specific features (jdbc_spasql_query, jdbc_sparql_query) require a Virtuoso backend and appropriate query strings to return results.