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 GitHubServidor 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-server1 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
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.
| Module | Databases |
|---|---|
| Core (built-in) | MySQL, MariaDB, PostgreSQL, MSSQL, H2, SQLite, CockroachDB, SingleStore |
| Embedded | DuckDB, Apache Derby, HSQLDB |
| Enterprise | Oracle, IBM DB2, Informix, Sybase ASE, Firebird |
| Cloud | Snowflake, Google BigQuery, SAP HANA, Trino, Apache Hive, ClickHouse, Vertica, Amazon Redshift |
| NoSQL | Elasticsearch, 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:
| Variable | Description | Default |
|---|---|---|
DB_TYPE | One of the supported types (see below) | postgres |
DB_HOST | Database host | localhost |
DB_PORT | Database port | per type (below) |
DB_NAME | Database name or keyspace | per type (below) |
DB_USER | Database user | per type (below) |
DB_PASSWORD | Database password | (empty) |
DB_DANGEROUS | Enable 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:
| Variable | Description | Required |
|---|---|---|
DB_DRIVER_CLASS | Fully qualified JDBC driver class name | yes |
DB_JDBC_URL | Full JDBC connection URL | yes |
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
| Type | Default Port | Default Database | Default User |
|---|---|---|---|
| mysql | 3306 | mysql | root |
| mariadb | 3306 | mysql | root |
| postgres | 5432 | postgres | postgres |
| mssql | 1433 | master | sa |
| h2 | 9092 | test | sa |
| oracle | 1521 | XE | system |
| cassandra | 9042 | (empty) | cassandra |
| sqlite | — | :memory: | (empty) |
| duckdb | — | :memory: | (empty) |
| derby | 1527 | mydb | APP |
| redshift | 5439 | dev | awsuser |
| snowflake | 443 | (empty) | (empty) |
| clickhouse | 8123 | default | default |
| elasticsearch | 9200 | (empty) | (empty) |
| db2 | 50000 | sample | db2inst1 |
| mongodb | 27017 | (empty) | (empty) |
| cockroachdb | 26257 | defaultdb | root |
| hsqldb | 9001 | test | sa |
| firebird | 3050 | test | SYSDBA |
| trino | 8080 | tpch | (empty) |
| hive | 10000 | default | (empty) |
| hana | 30015 | HXE | SYSTEM |
| informix | 9088 | sysmaster | informix |
| sybase | 5000 | master | sa |
| vertica | 5433 | vmart | dbadmin |
| singlestore | 3306 | singlestore | root |
| 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:
| Module | Content | Plugin JAR |
|---|---|---|
db-mcp-core | MySQL, MariaDB, PostgreSQL, MSSQL, H2, SQLite, CockroachDB, SingleStore | — (fat JAR, built-in) |
db-mcp-embedded | DuckDB, Derby, HSQLDB | db-mcp-embedded-1.0.0.jar |
db-mcp-enterprise | Oracle, DB2, Informix, Sybase, Firebird | db-mcp-enterprise-1.0.0.jar |
db-mcp-cloud | Snowflake, BigQuery, SAP HANA, Trino, Hive, ClickHouse, Vertica, Redshift | db-mcp-cloud-1.0.0.jar |
db-mcp-nosql | Elasticsearch, MongoDB, Cassandra | db-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:
- Scans the
plugins/directory for JAR files and loads them viaURLClassLoader - Uses
ServiceLoaderto discover allDatabaseProviderimplementations from both the classpath and plugin JARs - 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 withinitialize,supportsIntrospection,listTables,describeTable,runQuery,getDatabaseInfoJdbcProvider— 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 directlyByoProvider— generic JDBC provider for user-supplied drivers and URLs; no introspection supportDbService— thin delegator that looks up the provider viaPluginLoader.getProvider(type)McpHandler— JSON-RPC handler for the MCP protocol; suppresses introspection tools and resources whensupportsIntrospection()returnsfalse
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 resultsrun_query_write— execute a write SQL query (INSERT, UPDATE, DELETE, CREATE, DROP, ALTER). Only listed whenDB_DANGEROUS=true. (always available, regardless of introspection support)get_database_info— return database type, version, and basic metadata