Sign inSign up

guang1/jdbc-mcp

By guang1

•Updated 7 months ago

Model Context Protocol Server Streamable HTTP/SSE/STDIO for JDBC

Image
Machine learning & AI
Developer tools
0

2.8K

guang1/jdbc-mcp repository overview

⁠jdbc-mcp: Model Context Protocol Server Streamable HTTP/SSE for JDBC

Docker Pulls Docker Stars GitHub Repository License

⁠Quick reference

⁠Overview

This Docker image extends quarkiverse/quarkus-mcp-servers/jdbc⁠ with additional configuration options, most notably the ability to enable or disable write SQL operations.

The Model Context Protocol (MCP) server enables Large Language Models (LLMs) to:

  • Inspect database schemas
  • Query database content
  • Create and modify database content (when write SQL is enabled)

All of this functionality is accessible through a simple JDBC URL configuration.

⁠Supported MCP tools

The MCP server supports the following database operations:

⁠Schema Operations
  • database_info: Get information about the database
  • describe_table: Get detailed information about a specific table
  • list_tables: List all tables in the database
⁠Query Operations
  • read_query: Execute a read-only SQL query
⁠Data Modification Operations (when write SQL is enabled)
  • write_query: Execute an SQL statement that modifies data (INSERT, UPDATE, DELETE)
  • create_table: Execute an SQL statement that creates a new table

⁠How to use this image

⁠MCP Streamable HTTP/SSE
⁠Simple usage
docker run -d --name jdbc-mcp \
  -p 8080:8080 \
  -e enable.write.sql=false \
  -e jdbc.user=db_user \
  -e jdbc.password=db_password \
  -e jdbc.url=jdbc:postgresql://host:port/database \
  guang1/jdbc-mcp:latest
⁠Using an Environment File

Create a .env file:

enable.write.sql=false
jdbc.user=db_user
jdbc.password=db_password
jdbc.url=jdbc:postgresql://host:port/database

Then run:

docker run -d --name jdbc-mcp \
  -p 8080:8080 \
  --env-file .env \
  guang1/jdbc-mcp:latest
⁠Docker Compose for Streamable HTTP/SSE
⁠Basic Example
services:
  jdbc-mcp:
    container_name: jdbc-mcp
    ports:
      - 8080:8080
    environment:
      - enable.write.sql=false
      - jdbc.user=db_user
      - jdbc.password=db_password
      - jdbc.url=jdbc:postgresql://host:port/database
    restart: always
    image: guang1/jdbc-mcp:latest
⁠With Environment File
services:
  jdbc-mcp:
    container_name: jdbc-mcp
    ports:
      - 8080:8080
    env_file:
      - .env
    restart: always
    image: guang1/jdbc-mcp:latest
⁠MCP SSE URL

http://localhost:8080/mcp/sse

⁠MCP Streamable HTTP URL

http://localhost:8080/mcp

⁠MCP STDIO

Must pass quarkus.mcp.server.stdio.enabled=true, quarkus.log.console.enable=false and quarkus.log.console.stderr=false environment variables with -i interactive option.

⁠Simple usage
docker run --rm \
  -e enable.write.sql=false \
  -e jdbc.user=db_user \
  -e jdbc.password=db_password \
  -e jdbc.url=jdbc:postgresql://host:port/database \
  -e quarkus.mcp.server.stdio.enabled=true \
  -e quarkus.log.console.enable=false \
  -e quarkus.log.console.stderr=false \  
  guang1/jdbc-mcp:latest
⁠Using an Environment File
docker run --rm 
  --env-file .env \
   -e quarkus.mcp.server.stdio.enabled=true \
   -e quarkus.log.console.enable=false \
   -e quarkus.log.console.stderr=false \  
  guang1/jdbc-mcp:latest
⁠Claude Desktop Configuration (STDIO)

To use the Docker version with Claude Desktop, add this to your claude_desktop_config.json or server_config.json file:

⁠Simple usage
{
  "mcpServers": {
    "jdbc": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-e",
        "enable.write.sql=false",
        "-e",
        "jdbc.user=db_user",
        "-e",
        "jdbc.password=db_password",
        "-e",
        "jdbc.url=jdbc:postgresql://host:port/database",
        "-e",
        "quarkus.mcp.server.stdio.enabled=true",
        "-e",
        "quarkus.log.console.enable=false",
        "-e",
        "quarkus.log.console.stderr=false",
        "-i",
        "guang1/jdbc-mcp:latest"
      ]
    }
  }
}
⁠Using an Environment File
{
  "mcpServers": {
    "jdbc": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--env-file",
        ".env",
        "-e",
        "quarkus.mcp.server.stdio.enabled=true",
        "-e",
        "quarkus.log.console.enable=false",
        "-e",
        "quarkus.log.console.stderr=false",
        "-i",
        "guang1/jdbc-mcp:latest"
      ]
    }
  }
}

⁠Configuration

⁠Environment Variables
VariableDescriptionDefault
jdbc.urlJDBC connection URL (required)-
jdbc.userDatabase username-
jdbc.passwordDatabase password-
enable.write.sqlEnable SQL operations that modify datafalse
⁠Supported Database Types

This MCP server supports multiple database types through JDBC. For detailed information on supported JDBC variants, please see the quarkus-mcp-servers/jdbc documentation⁠.

⁠Security Considerations

⚠️ Warning: When enable.write.sql is set to true, the MCP server can execute SQL statements that modify data. Use with caution in production environments.

Consider these best practices:

  • Use read-only database users when possible
  • Implement network-level access controls
  • Run in an isolated network environment

⁠Source Code

The source code for this project is available on GitHub: https://github.com/guanghuang/jdbc-mcp⁠

This project is a fork of the Quarkus MCP JDBC Server with added features:

  • Docker deployment for both Streamable HTTP/SSE and STDIO modes
  • Enhanced security through configurable write protection
  • Simplified configuration through environment variables

⁠License

This project is licensed under the Apache License 2.0. See the LICENSE⁠ file in the GitHub repository for details.

⁠Contributing

Contributions are welcome! Please feel free to submit a Pull Request⁠ or create an Issue⁠ on the GitHub repository.

Tag summary

Content type

Image

Digest

sha256:ea9ee2496…

Size

188.2 MB

Last updated

7 months ago

docker pull guang1/jdbc-mcp