mcpField
J
JDBC-MCP - Database Access for AI Assistants

JDBC-MCP - Database Access for AI Assistants

ローカル
github.com/guanghuangデータベース033 週間前に更新

JDBC-MCP - Database Access for AI Assistants について

JDBC-MCPは、JDBC接続を通じてAIアシスタントがデータベースを確認・検索し、データの作成や変更も行えるようにします。Quarkus MCP JDBC Serverを基にDockerデプロイに対応し、書き込みSQLは既定で無効です。

主な機能

  1. 01JDBC経由のデータベースアクセス
  2. 02MCP SSEとSTDIOに対応
  3. 03Dockerコンテナでのデプロイ
  4. 04書き込みSQLを既定で無効化

活用シーン

  1. 01AIアシスタントによるデータベース構造の確認
  2. 02自然言語を使ったデータ検索の補助
  3. 03コンテナでのデータベースMCPサービスの運用
  4. 04必要に応じたデータ変更操作の有効化

MCP 対応

このMCPサーバーはJDBCでデータベースに接続し、AIクライアントに確認、検索、作成、変更の機能を提供します。INSERT、UPDATE、DELETEは既定で無効で、MCP SSEまたはSTDIOで利用できます。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

mcp.json · 共通設定
{
"mcpServers": {
"jdbc": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"\\"
]
}
}
}
起動コマンドdocker run -i --rm '\'

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
oci\

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

JDBC-MCP - AI アシスタント向けデータベースアクセス

Docker Hub GitHub License

これは、以下の機能を追加した Quarkus MCP JDBC Server のフォークです。

  • Docker デプロイ - MCP SSE または MCP STDIO をコンテナ化されたアプリケーションとして簡単に実行できます
  • セキュリティの強化 - 書き込みクエリ(INSERT、UPDATE、DELETE)はデフォルトで無効になっており、明示的に有効にする必要があります

Model Context Protocol(MCP)サーバーを使用すると、AI アシスタントが JDBC 接続を通じてデータベースとやり取りできるようになり、LLM がデータベースの内容を調査、照会、作成、変更できます。

新機能

Docker デプロイ

JDBC-MCP サーバーを Docker コンテナ内で実行できるようになりました。

MCP SSE
シンプルな使用方法
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
環境ファイルを使用する

.env ファイルを作成します。

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

次に、実行します。

docker run -d --name jdbc-mcp \
  -p 8080:8080 \
  --env-file .env \
  guang1/jdbc-mcp:latest
SSE 用の Docker Compose
基本的な例
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
環境ファイルを使用する場合
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 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

Using with LLMs

This MCP server provides a standardized API that Large Language Models can use to interact with your database. To connect your LLM:

  1. Configure the LLM to use the MCP server endpoint
  2. Define the capabilities you want to allow (read-only vs. read-write)
  3. Ensure your database schema is accessible to the MCP server
Write Query Security

By default, write operations (INSERT, UPDATE, DELETE) are disabled for security. To enable them:

  • When using Docker: add -e enable.write.sql=true as shown above

Original Documentation

For all other features, including supported databases, general usage, example databases, MCP components, and troubleshooting, please refer to the original repository documentation:

Quarkus MCP JDBC Server Documentation

License

This project is licensed under the Apache License 2.0.

Acknowledgments

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。