# dba-master [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/AdanEinstein/dba-master  
**GitHub Stars:** 1  
**npm Downloads (last month):** 844  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/dba-master

## Description
MCP server para introspecção profunda de bancos de dados (Oracle, PostgreSQL, MySQL/MariaDB), voltado a consumo por agentes de IA e LLMs

## Tools
Capabilities this server exposes over MCP:

- **list_connections** — Lista as conexões configuradas; writable = as que aceitam escrita (readOnly:false).
- **list_tables** — Lista tabelas (owner, nome, num_rows) de um schema ou de todos os acessíveis.
- **search_tables** — Busca tabelas cujo nome contém o padrão informado (case-insensitive).
- **describe_table** — Grava em cache a interface .ts da tabela (colunas, PK, FKs, índices) e retorna o caminho — leia o arquivo. force=true refaz o describe.
- **list_views** — Lista views (owner, nome) de um schema ou de todos os acessíveis.
- **describe_view** — Grava em cache a interface .ts da view (colunas) e retorna o caminho — leia o arquivo. Para o SELECT que a define, use get_ddl.
- **get_relationships** — Grafo de FKs de uma tabela: 'outgoing' (FKs que ela possui) e 'incoming' (tabelas que a referenciam).
- **infer_relationships** — Infere FKs não declaradas por convenção de nome (ex.: PEDIDO.CLIENTE_ID → CLIENTE.ID), com confiança e evidência. Para bancos legados sem constraints.
- **get_ddl** — Retorna o DDL de um objeto (tabela, view, procedure, package, trigger, sequence, type).
- **list_procedures** — Lista procedures e functions standalone (fora de packages), com assinatura dos parâmetros.
- **list_packages** — Lista packages e, para cada um, os subprogramas expostos com suas assinaturas. Nem todo banco tem packages.
- **list_schedulers_jobs** — Lista jobs agendados (ação, agendamento, estado, próxima execução). O sistema de jobs varia por banco.
- **run_sql** — Executa SQL. Por padrão só permite SELECT/WITH; escrita exige readOnly:false na conexão.
- **compile_object** — DDL. Recompila objeto existente (name) ou executa script de deploy (sourceFile = caminho do arquivo, qualquer tamanho/encoding; ou source inline p/ fonte curta). Script SQL*Plus: PL/SQL e blocos até '/', SQL até ';', comandos SET/PROMPT/... pulados. Status por unidade VALID/INVALID/EXECUTED/SKIPPED/FAILED + erros linha/coluna. Hoje só Oracle (package, body, procedure, function, trigger, type, view); exige readOnly:false.
- **generate_interfaces** — Gera/atualiza em lote as interfaces .ts de todas as tabelas (e views) do schema. Incremental.
- **pg_monitor** — Monitoramento Postgres (leitura). Só engine Postgres. top_queries exige pg_stat_statements.
- **pg_kill_session** — DESTRUTIVO. Cancela o statement ou derruba a sessão (ROLLBACK) pelo pid. Só Postgres; exige readOnly:false na conexão.
- **ora_monitor** — Monitoramento Oracle (leitura). Só engine Oracle; exige SELECT_CATALOG_ROLE (v$/dba_*).
- **ora_kill_session** — DESTRUTIVO. Cancela o SQL ou derruba a sessão (ROLLBACK) por sid+serial#. Só Oracle; exige readOnly:false na conexão e ALTER SYSTEM.
- **mysql_monitor** — Executa checks predefinidos e seguros para investigar gargalos e incidentes no MySQL.
- **mysql_kill_session** — DESTRUTIVO. Cancela a query ou derruba a sessão pelo connection_id. Só MySQL; exige readOnly:false na conexão.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "dba-master": {
    "command": "npx",
    "args": ["-y","dba-master@latest"]
  }
}
```

## Documentation

## What dba-master does

dba-master exposes database introspection and administration capabilities through MCP. It can enumerate connections, schemas, tables, views, procedures, functions, packages, schedulers, and object definitions. Table and view descriptions are materialized as cached TypeScript interface files, while relationship tools expose declared foreign keys and can infer likely links from naming conventions for legacy schemas.

The supported engines are Oracle, PostgreSQL, MySQL/MariaDB, and SQL Server. Engine-specific behavior is applied where relevant: Oracle supports packages, scheduled jobs, native metadata DDL, monitoring, and session control; PostgreSQL has monitoring and session control; MySQL has predefined diagnostic checks and session control. SQL Server supports metadata-oriented database inspection and object definitions.

## How it works

Connections are named entries loaded from a `connections.json` file. The server uses those entries to open connection pools, but `list_connections` returns connection names and write capability rather than usernames, passwords, or connect strings. String fields can reference environment variables such as `${DBA_PROD_PASS}`, keeping secrets outside the JSON file.

Most inspection operations return structured metadata. `describe_table` and `describe_view` instead write `.ts` interface files into the cache and return their paths for the agent to read. `generate_interfaces` performs the same work across all tables and views in a schema, incrementally updating the cache.

`run_sql` permits `SELECT` and `WITH` statements by default. Write operations, deployment scripts, object recompilation, and session termination require a connection configured with `readOnly: false`. Monitoring tools are read-oriented, while the `*_kill_session` tools deliberately cancel statements or terminate sessions and can roll back work.

## Setup and configuration

The package can be installed and registered without cloning the repository:

```bash
npx -y dba-master@latest install
```

The interactive setup creates or edits connections and can configure agents at project scope or globally. Connection data is stored under `.dba-master/connections.json` in the project, or under `~/.dba-master/connections.json` globally. Use `configure` to manage connections separately, `uninstall` to remove configured agents, and `generate` to populate cached interfaces.

A manual MCP registration uses stdio:

```json
{
  "command": "npx",
  "args": ["-y", "dba-master@latest"]
}
```

Oracle uses thin mode by default, which does not require Instant Client. Set `thick: true` and provide `clientLibDir` when native Oracle client features are needed. PostgreSQL connections use a URL; Oracle uses a host, port, and service-style connect string. Pool size, query timeout, read-only status, and schema filters are configurable per connection.

## Tools and capabilities

- Discover configured connections, tables, views, procedures, packages, scheduled jobs, and schema objects.
- Describe tables with columns, primary keys, foreign keys, and indexes; describe views with their columns.
- Retrieve DDL for tables, views, procedures, packages, triggers, sequences, and types.
- Inspect declared foreign-key direction and infer probable undeclared relationships with evidence and confidence.
- Execute read-focused SQL and generate or refresh TypeScript interfaces in batches.
- Monitor PostgreSQL and Oracle activity, or run predefined MySQL checks for performance investigations.
- Compile Oracle objects or execute deployment scripts with per-unit status and source error locations.
- Cancel statements or terminate sessions on supported engines when the connection permits writes.

## Limitations and notes

Write access is opt-in per connection. A connection remains read-only unless its `readOnly` value is explicitly set to `false`; this restriction applies to SQL writes, Oracle compilation or deployment, and session-control tools. Deployment scripts run by `compile_object` are not subject to the configured query timeout.

Some capabilities depend on the database engine. Oracle monitoring requires `SELECT_CATALOG_ROLE`, and Oracle session termination requires `ALTER SYSTEM`. PostgreSQL `top_queries` requires `pg_stat_statements`. Package and scheduler features are not available on engines that lack those concepts.

Environment-variable references reduce accidental credential disclosure, but they are not a hard security boundary: another process running as the same user may read the server process environment. Use an operating-system keychain or isolate the server under another user or container when stronger separation is needed. Passwords supplied directly as command-line flags can also remain in shell history.

_Full upstream README: https://allmcps.com/mcp/dba-master/readme_

