convez.ai
MCP ServerDados & AnalyticsAvançado
minininja

DB MCP Server

minininja/db-mcp-server

Acesso unificado a 27 tipos de BD via MCP com suporte a cloud, enterprise e NoSQL

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP para introspection e consultas de leitura em 27 tipos de bancos de dados, cobrindo plataformas tradicionais (MySQL, PostgreSQL, Oracle), cloud (Snowflake, BigQuery, Redshift) e NoSQL (MongoDB, Elasticsearch, Cassandra). Permite executar queries, descrever esquemas e explorar metadados através de uma interface unificada.

Instalação

$npx convez-ai minininja/db-mcp-server

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
14%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
2

Casos de uso

  • Explorar e documentar esquemas de múltiplos bancos de dados
  • Executar queries de leitura (e escrita opcional) sem clientes dedicados
  • Integrar análise de dados em workflows Claude com Snowflake, BigQuery ou Redshift
  • Conectar a bancos legados (Oracle, MSSQL, IBM DB2) via MCP

Veredito

Ferramenta robusta e bem-arquitetada para agregar acesso a dezenas de bancos de dados heterogêneos. Cobertura ampla (cloud, enterprise, NoSQL) e suporte a drivers JDBC nativos tornam viável para ambientes corporativos complexos; exige configuração cuidadosa e compreensão de segurança (queries de escrita desabilitadas por padrão).

README

A tradução para o português deste README ainda está na fila.

DB MCP Server

MCP server for database introspection and read-only queries across 27 database types.

ModuleDatabases
Core (built-in)MySQL, MariaDB, PostgreSQL, MSSQL, H2, SQLite, CockroachDB, SingleStore
EmbeddedDuckDB, Apache Derby, HSQLDB
EnterpriseOracle, IBM DB2, Informix, Sybase ASE, Firebird
CloudSnowflake, Google BigQuery, SAP HANA, Trino, Apache Hive, ClickHouse, Vertica, Amazon Redshift
NoSQLElasticsearch, MongoDB, Cassandra

Build

mvn clean install

The multi-module build produces a fat JAR at db-mcp-core/target/db-mcp-core-1.0.0.jar containing the core 8 database types (MySQL, MariaDB, PostgreSQL, MSSQL, H2, SQLite, CockroachDB, SingleStore) and all their JDBC drivers. Module JARs for additional databases are in their respective target/ directories. To add support for more databases, copy the module JARs into a plugins/ directory alongside the core fat JAR (see Running).

Configuration

Set environment variables to configure the database connection:

VariableDescriptionDefault
DB_TYPEOne of the supported types (see below)postgres
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase portper type (below)
DB_NAMEDatabase name or keyspaceper type (below)
DB_USERDatabase userper type (below)
DB_PASSWORDDatabase password(empty)
DB_DANGEROUSEnable write queries (run_query_write)false

BYO (Bring Your Own)

For custom or unsupported JDBC databases, set DB_TYPE to byo and supply the driver class and full JDBC URL:

VariableDescriptionRequired
DB_DRIVER_CLASSFully qualified JDBC driver class nameyes
DB_JDBC_URLFull JDBC connection URLyes

BYO suppresses all introspection tools (list_databases, list_tables, describe_table) and resources (db://tables, db://table/*). Only run_query, run_query_write (if DB_DANGEROUS=true), and get_database_info are available.

Per-type defaults

TypeDefault PortDefault DatabaseDefault User
mysql3306mysqlroot
mariadb3306mysqlroot
postgres5432postgrespostgres
mssql1433mastersa
h29092testsa
oracle1521XEsystem
cassandra9042(empty)cassandra
sqlite—:memory:(empty)
duckdb—:memory:(empty)
derby1527mydbAPP
redshift5439devawsuser
snowflake443(empty)(empty)
clickhouse8123defaultdefault
elasticsearch9200(empty)(empty)
db250000sampledb2inst1
mongodb27017(empty)(empty)
cockroachdb26257defaultdbroot
hsqldb9001testsa
firebird3050testSYSDBA
trino8080tpch(empty)
hive10000default(empty)
hana30015HXESYSTEM
informix9088sysmasterinformix
sybase5000mastersa
vertica5433vmartdbadmin
singlestore3306singlestoreroot
bigquery—(empty)(empty)
byo—(empty)(empty)

Running

The core fat JAR includes support for 8 database types. For additional types (Oracle, Snowflake, Elasticsearch, etc.), copy the corresponding module JAR from db-mcp-*/target/ into a plugins/ directory in the working directory.

# Create plugins directory
mkdir -p plugins

# Add plugin JARs for the databases you need
cp db-mcp-enterprise/target/db-mcp-enterprise-1.0.0.jar plugins/
cp db-mcp-cloud/target/db-mcp-cloud-1.0.0.jar plugins/
cp db-mcp-nosql/target/db-mcp-nosql-1.0.0.jar plugins/
cp db-mcp-embedded/target/db-mcp-embedded-1.0.0.jar plugins/

# Run the server
java -jar db-mcp-core/target/db-mcp-core-1.0.0.jar

The server communicates over stdin/stdout using the MCP JSON-RPC protocol.

MCP Setup

Set the DB_* environment variables in your MCP client configuration. Examples for each supported type:

Amazon Redshift

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "redshift",
        "DB_HOST": "my-cluster.xxxxxx.us-east-1.redshift.amazonaws.com",
        "DB_PORT": "5439",
        "DB_NAME": "pequod",
        "DB_USER": "lancelot",
        "DB_PASSWORD": "guinevere"
      }
    }
  }
}

Apache Derby

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "derby",
        "DB_HOST": "localhost",
        "DB_PORT": "1527",
        "DB_NAME": "nautilus",
        "DB_USER": "romeo",
        "DB_PASSWORD": "juliet"
      }
    }
  }
}

Apache Hive

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "hive",
        "DB_HOST": "localhost",
        "DB_PORT": "10000",
        "DB_NAME": "mary-rose",
        "DB_USER": "jason",
        "DB_PASSWORD": "medea"
      }
    }
  }
}

BigQuery

BigQuery uses Google Cloud application-default credentials. Set DB_NAME to your GCP project ID and DB_SCHEMA to your dataset name.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "bigquery",
        "DB_NAME": "my-gcp-project",
        "DB_SCHEMA": "my_dataset"
      }
    }
  }
}

BYO (Bring Your Own)

Supply your own JDBC driver JAR on the classpath or via a plugins/ directory. Only run_query and run_query_write tools are available — no database/table introspection. You will also need to specify any additional class path entries required to load the driver for your database.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar", "-cp", "your driver jar here"],
      "env": {
        "DB_TYPE": "byo",
        "DB_DRIVER_CLASS": "<your driver's class here>",
        "DB_JDBC_URL": "jdbc:.....",
        "DB_USER": "katniss",
        "DB_PASSWORD": "peeta"
      }
    }
  }
}

Cassandra

Cassandra uses the Datastax CQL driver via its native protocol. Queries must use CQL syntax.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "cassandra",
        "DB_HOST": "localhost",
        "DB_PORT": "9042",
        "DB_NAME": "",
        "DB_USER": "tarzan",
        "DB_PASSWORD": "jane"
      }
    }
  }
}

ClickHouse

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "clickhouse",
        "DB_HOST": "localhost",
        "DB_PORT": "8123",
        "DB_NAME": "nina",
        "DB_USER": "porgy",
        "DB_PASSWORD": "bess"
      }
    }
  }
}

CockroachDB

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "cockroachdb",
        "DB_HOST": "localhost",
        "DB_PORT": "26257",
        "DB_NAME": "endurance",
        "DB_USER": "tristan",
        "DB_PASSWORD": "isolda"
      }
    }
  }
}

DuckDB

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "duckdb",
        "DB_NAME": "/data/kon-tiki.db"
      }
    }
  }
}

Elasticsearch

Elasticsearch communicates via its REST API. Queries use the Elasticsearch SQL endpoint (/_sql). Set DB_HOST and DB_PORT to point to your Elasticsearch HTTP endpoint.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "elasticsearch",
        "DB_HOST": "localhost",
        "DB_PORT": "9200"
      }
    }
  }
}

Firebird

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "firebird",
        "DB_HOST": "localhost",
        "DB_PORT": "3050",
        "DB_NAME": "discovery",
        "DB_USER": "robin",
        "DB_PASSWORD": "marian"
      }
    }
  }
}

H2

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "h2",
        "DB_HOST": "localhost",
        "DB_PORT": "9092",
        "DB_NAME": "beagle",
        "DB_USER": "heathcliff",
        "DB_PASSWORD": "catherine"
      }
    }
  }
}

HSQLDB

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "hsqldb",
        "DB_HOST": "localhost",
        "DB_PORT": "9001",
        "DB_NAME": "enterprise",
        "DB_USER": "orpheus",
        "DB_PASSWORD": "eurydice"
      }
    }
  }
}

IBM DB2

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "db2",
        "DB_HOST": "localhost",
        "DB_PORT": "50000",
        "DB_NAME": "argo",
        "DB_USER": "hansel",
        "DB_PASSWORD": "gretel"
      }
    }
  }
}

Informix

The Informix JDBC URL includes informixserver=ol_<host> by default. Override via DB_NAME if your server name differs from your hostname.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "informix",
        "DB_HOST": "localhost",
        "DB_PORT": "9088",
        "DB_NAME": "hood",
        "DB_USER": "antony",
        "DB_PASSWORD": "cleopatra"
      }
    }
  }
}

MongoDB

MongoDB uses the mongodb-driver-sync Java driver directly. The run_query tool accepts a JSON object with a "collection" field and optional "filter", "projection", "sort", and "limit" fields.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "mongodb",
        "DB_HOST": "localhost",
        "DB_PORT": "27017",
        "DB_NAME": "batavia"
      }
    }
  }
}

MSSQL

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "mssql",
        "DB_HOST": "localhost",
        "DB_PORT": "1433",
        "DB_NAME": "endeavour",
        "DB_USER": "rhett",
        "DB_PASSWORD": "scarlett"
      }
    }
  }
}

MySQL / MariaDB

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "mysql",
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_NAME": "titanic",
        "DB_USER": "darcy",
        "DB_PASSWORD": "elizabeth"
      }
    }
  }
}

Oracle

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "oracle",
        "DB_HOST": "localhost",
        "DB_PORT": "1521",
        "DB_NAME": "goldenhind",
        "DB_USER": "odysseus",
        "DB_PASSWORD": "penelope"
      }
    }
  }
}

PostgreSQL

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "postgres",
        "DB_HOST": "localhost",
        "DB_PORT": "5432",
        "DB_NAME": "mayflower",
        "DB_USER": "gatsby",
        "DB_PASSWORD": "daisy"
      }
    }
  }
}

SAP HANA

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "hana",
        "DB_HOST": "localhost",
        "DB_PORT": "30015",
        "DB_NAME": "potemkin",
        "DB_USER": "dante",
        "DB_PASSWORD": "beatrice"
      }
    }
  }
}

SingleStore

SingleStore is wire-compatible with MySQL. Use the same driver and port.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "singlestore",
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_NAME": "victory",
        "DB_USER": "napoleon",
        "DB_PASSWORD": "josephine"
      }
    }
  }
}

Snowflake

Set DB_HOST to your Snowflake account identifier (e.g. myaccount.snowflakecomputing.com). The schema is set to PUBLIC by default; override with DB_SCHEMA.

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "snowflake",
        "DB_HOST": "myaccount.snowflakecomputing.com",
        "DB_PORT": "443",
        "DB_NAME": "santa-maria",
        "DB_USER": "frodo",
        "DB_PASSWORD": "samwise"
      }
    }
  }
}

SQLite

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "sqlite",
        "DB_NAME": "/data/hms-victory.db"
      }
    }
  }
}

Sybase ASE

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "sybase",
        "DB_HOST": "localhost",
        "DB_PORT": "5000",
        "DB_NAME": "warspite",
        "DB_USER": "abelard",
        "DB_PASSWORD": "heloise"
      }
    }
  }
}

Trino

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "trino",
        "DB_HOST": "localhost",
        "DB_PORT": "8080",
        "DB_NAME": "orion",
        "DB_USER": "beatrice",
        "DB_PASSWORD": "benedick"
      }
    }
  }
}

Vertica

{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/path/to/db-mcp-core/target/db-mcp-core-1.0.0.jar"],
      "env": {
        "DB_TYPE": "vertica",
        "DB_HOST": "localhost",
        "DB_PORT": "5433",
        "DB_NAME": "olympic",
        "DB_USER": "westley",
        "DB_PASSWORD": "buttercup"
      }
    }
  }
}

For file-based types (SQLite, DuckDB), omit DB_HOST, DB_PORT, DB_USER, and DB_PASSWORD. Set DB_NAME to :memory: for an in-memory database.

Architecture

The project is organized into a multi-module Maven reactor:

ModuleContentPlugin JAR
db-mcp-coreMySQL, MariaDB, PostgreSQL, MSSQL, H2, SQLite, CockroachDB, SingleStore— (fat JAR, built-in)
db-mcp-embeddedDuckDB, Derby, HSQLDBdb-mcp-embedded-1.0.0.jar
db-mcp-enterpriseOracle, DB2, Informix, Sybase, Firebirddb-mcp-enterprise-1.0.0.jar
db-mcp-cloudSnowflake, BigQuery, SAP HANA, Trino, Hive, ClickHouse, Vertica, Redshiftdb-mcp-cloud-1.0.0.jar
db-mcp-nosqlElasticsearch, MongoDB, Cassandradb-mcp-nosql-1.0.0.jar

Discovery

All providers implement the DatabaseProvider interface and register themselves via META-INF/services/org.dorkmaster.DatabaseProvider. The PluginLoader at startup:

  1. Scans the plugins/ directory for JAR files and loads them via URLClassLoader
  2. Uses ServiceLoader to discover all DatabaseProvider implementations from both the classpath and plugin JARs
  3. Caches the result in a synchronized singleton map keyed by provider type

The core fat JAR includes its providers on the classpath natively. To extend, drop any module JAR into plugins/ — no classpath modification needed.

Key classes

  • DatabaseProvider — interface with initialize, supportsIntrospection, listTables, describeTable, runQuery, getDatabaseInfo
  • JdbcProvider — shared abstract superclass for all JDBC-based providers (connection management, result-set mapping, read-only enforcement)
  • CassandraProvider, ElasticsearchProvider, MongoDbProvider, BigQueryProvider — non-JDBC implementations using native drivers directly
  • ByoProvider — generic JDBC provider for user-supplied drivers and URLs; no introspection support
  • DbService — thin delegator that looks up the provider via PluginLoader.getProvider(type)
  • McpHandler — JSON-RPC handler for the MCP protocol; suppresses introspection tools and resources when supportsIntrospection() returns false

Supported tools

  • list_databases — list all databases on the connected server (catalogs/keyspaces) (suppressed when provider does not support introspection)
  • list_tables — list all tables (or tables/views in the current database/schema) (suppressed when provider does not support introspection)
  • describe_table — show column metadata for a table (suppressed when provider does not support introspection)
  • run_query — execute a read-only SQL/CQL query and return results
  • run_query_write — execute a write SQL query (INSERT, UPDATE, DELETE, CREATE, DROP, ALTER). Only listed when DB_DANGEROUS=true. (always available, regardless of introspection support)
  • get_database_info — return database type, version, and basic metadata
Ver o original no GitHub

Bom para

Relacionados