Labsco
iPraBhu logo

mcp-database-server

from iPraBhu

Production-grade Model Context Protocol (MCP) server for unified SQL database access. Connect multiple databases through a single MCP server with schema discovery, relationship mapping, caching, and safety controls.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

@adevguide/mcp-database-server

npm version npm downloads

Production-grade Model Context Protocol (MCP) server for unified SQL database access. Connect multiple databases through a single MCP server with schema discovery, relationship mapping, caching, and safety controls.

Contents

Features

  • Multi-database support: PostgreSQL, MySQL/MariaDB, SQLite, SQL Server, Oracle
  • Automatic schema discovery: tables, columns, indexes, foreign keys, relationships
  • Persistent schema caching: TTL + versioning, manual refresh, cache stats
  • Relationship inference: foreign keys + heuristics
  • Query intelligence: tracking, statistics, timeouts
  • Join assistance: suggested join paths based on relationship graphs
  • Safety controls: read-only mode, allow/deny write operations, secret redaction
  • Query optimization: index recommendations, performance profiling, slow query detection
  • Performance monitoring: detailed execution analytics, bottleneck identification
  • Query rewriting: automated optimization suggestions with performance impact estimates

Why this exists

This project was originally vibe-coded to solve real issues I was facing when wiring LLM tools to multiple SQL databases (consistent connectivity, schema discovery, and safe query execution). It has since been hardened into a reusable MCP server with caching and security defaults.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    MCP Client                            β”‚
β”‚            (Claude Desktop, IDEs, etc.)                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚ JSON-RPC over stdio
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                MCP Database Server                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚           Schema Cache (TTL + Versioning)        β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Query Tracker (History + Statistics)            β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Security Layer (Read-only, Operation Controls)  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚         β”‚         β”‚          β”‚          β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Postgresβ”‚ β”‚ MySQL β”‚ β”‚ SQLite β”‚ β”‚ MSSQL   β”‚ β”‚ Oracle  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Supported Databases

DatabaseDriverStatusNotes
PostgreSQLpgβœ… Full SupportIncludes CockroachDB compatibility
MySQL/MariaDBmysql2βœ… Full SupportIncludes Amazon Aurora MySQL compatibility
SQLitesql.jsβœ… Full SupportWASM-backed SQLite with file persistence
SQL Servertediousβœ… Full SupportMicrosoft SQL Server / Azure SQL
Oracleoracledb⚠️ StubRequires Oracle Instant Client

MCP Client Integration

Configuration File Locations

MCP ClientConfiguration File Path
Claude Desktop (macOS)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%\Claude\claude_desktop_config.json
Cline (VS Code)VS Code settings β†’ MCP Servers
Other ClientsRefer to client-specific documentation

Setup Methods

Method 1: Global npm Installation

Configuration:

{
  "mcpServers": {
    "database": {
      "command": "mcp-database-server",
      "args": ["--config", "/absolute/path/to/.mcp-database-server.config"]
    }
  }
}

Method 2: Source Installation

Configuration:

{
  "mcpServers": {
    "database": {
      "command": "node",
      "args": [
        "/absolute/path/to/mcp-database-server/dist/index.js",
        "--config",
        "/absolute/path/to/.mcp-database-server.config"
      ]
    }
  }
}

Configuration Properties

PropertyDescriptionExample
commandExecutable to run. Use mcp-database-server for npm install, node for source install."mcp-database-server"
argsArray of command-line arguments. First arg is usually --config followed by config file path.["--config", "/path/to/config"]
envOptional environment variables passed to the server. Prefer secretRef with a local .env file or external secret tooling for DB credentials.{"APP_ENV": "production"}

Finding Absolute Paths:

# macOS/Linux
cd /path/to/mcp-database-server
pwd  # prints: /Users/username/projects/mcp-database-server

# Windows (PowerShell)
cd C:\path\to\mcp-database-server
$PWD.Path  # prints: C:\Users\username\projects\mcp-database-server

Available MCP Tools

This server provides 15 tools for comprehensive database interaction and optimization.

Tool Reference

ToolPurposeWrite AccessCached Data
list_databasesList all configured databases with statusNoUses cache
introspect_schemaDiscover and cache database schemaNoWrites cache
get_schemaRetrieve cached schema metadataNoReads cache
run_queryExecute SQL queries with safety controlsConditional*Updates stats
export_queryExport large read-only query results to a local fileNoNo cache
explain_queryAnalyze query execution plansNoNo cache
suggest_joinsGet intelligent join path recommendationsNoUses cache
clear_cacheClear schema cache and statisticsNoClears cache
cache_statusView cache health and statisticsNoReads cache
health_checkTest database connectivityNoNo cache
analyze_performanceGet detailed performance analyticsNoUses stats
suggest_indexesAnalyze queries and recommend indexesNoUses stats
detect_slow_queriesIdentify and alert on slow queriesNoUses stats
rewrite_querySuggest optimized query versionsNoUses cache
profile_queryProfile query performance with bottlenecksNoNo cache

<sub>* Requires allowWrite: true and respects security settings</sub>


1. list_databases

Lists all configured databases with their connection status and cache information.

Input Parameters:

None required.

Response:

[
  {
    "id": "postgres-main",
    "type": "postgres",
    "connected": true,
    "cached": true,
    "cacheAge": 45000,
    "version": "abc123"
  }
]

Response Fields:

FieldTypeDescription
idstringDatabase identifier from configuration
typestringDatabase type (postgres, mysql, sqlite, mssql, oracle)
connectedbooleanWhether database connection is active
cachedbooleanWhether schema is currently cached
cacheAgenumberAge of cached schema in milliseconds (if cached)
versionstringCache version hash (if cached)

2. introspect_schema

Discovers and caches complete database schema including tables, columns, indexes, foreign keys, and relationships.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier to introspect
forceRefreshbooleanNoForce re-introspection even if cache is valid (default: false)
schemaFilterobjectNoFilter which objects to introspect
schemaFilter.includeSchemasstring[]NoOnly introspect these schemas (PostgreSQL/SQL Server)
schemaFilter.excludeSchemasstring[]NoSkip these schemas during introspection
schemaFilter.includeViewsbooleanNoInclude database views (default: true)
schemaFilter.maxTablesnumberNoLimit to first N tables

Example Request:

{
  "dbId": "postgres-main",
  "forceRefresh": false,
  "schemaFilter": {
    "includeSchemas": ["public"],
    "excludeSchemas": ["temp"],
    "includeViews": true,
    "maxTables": 100
  }
}

Response:

{
  "dbId": "postgres-main",
  "version": "a1b2c3d4",
  "introspectedAt": "2026-01-26T10:00:00.000Z",
  "schemas": [
    {
      "name": "public",
      "tableCount": 15,
      "viewCount": 3
    }
  ],
  "totalTables": 15,
  "totalRelationships": 12
}

3. get_schema

Retrieves detailed schema metadata from cache without querying the database.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier
schemastringNoFilter to specific schema name
tablestringNoFilter to specific table name

Example Request:

{
  "dbId": "postgres-main",
  "schema": "public",
  "table": "users"
}

Response: Complete schema metadata including tables, columns, data types, indexes, foreign keys, and inferred relationships.


4. run_query

Executes SQL queries with automatic schema caching, relationship annotation, and comprehensive security controls.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier to query
sqlstringYesSQL query to execute
paramsarrayNoParameterized query values (prevents SQL injection)
limitnumberNoMaximum number of rows to return
offsetnumberNoRow offset for paginated reads. Requires limit.
maxBytesnumberNoApproximate max serialized bytes for returned rows.
includeMetadatabooleanNoInclude relationship and query statistics metadata in the response. Default: true.
trackQuerybooleanNoTrack this query in history and performance analytics. Default: true.
timeoutMsnumberNoQuery timeout in milliseconds

Example Request:

{
  "dbId": "postgres-main",
  "sql": "SELECT * FROM users WHERE active = $1 ORDER BY id",
  "params": [true],
  "limit": 10,
  "offset": 0,
  "maxBytes": 32768,
  "includeMetadata": false,
  "trackQuery": false,
  "timeoutMs": 5000
}

Response:

{
  "rows": [
    {"id": 1, "name": "Alice", "email": "alice@example.com", "active": true},
    {"id": 2, "name": "Bob", "email": "bob@example.com", "active": true}
  ],
  "columns": ["id", "name", "email", "active"],
  "rowCount": 2,
  "executionTimeMs": 15,
  "metadata": {
    "relationships": [...],
    "queryStats": {
      "totalQueries": 10,
      "avgExecutionTime": 20,
      "errorCount": 0
    },
    "pagination": {
      "limit": 10,
      "offset": 0,
      "hasMore": true,
      "nextOffset": 10
    },
    "responseSize": {
      "maxBytes": 32768,
      "rowsBytes": 1842,
      "rowsTrimmed": false,
      "omittedRowCount": 0
    }
  }
}

For the fastest MariaDB/MySQL read path, set "includeMetadata": false and "trackQuery": false when you only need result rows and do not need relationship annotations, query history, or performance analytics for that request.

Security Controls:

  • βœ… Write operations blocked by default (allowWrite: false)
  • βœ… Dangerous operations (DELETE, TRUNCATE, DROP) disabled by default
  • βœ… Specific operations can be whitelisted via allowedWriteOperations
  • βœ… Per-database readOnly mode

5. explain_query

Retrieves database query execution plan without executing the query.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier
sqlstringYesSQL query to analyze
paramsarrayNoQuery parameters (for parameterized queries)

Example Request:

{
  "dbId": "postgres-main",
  "sql": "SELECT * FROM users JOIN orders ON users.id = orders.user_id WHERE users.active = $1",
  "params": [true]
}

Response: Database-native execution plan (format varies by database type).


5a. export_query

Exports large read-only query results to a local file under .sql-mcp-cache/exports.

Execution Strategy:

  • MySQL/MariaDB uses adapter-level row streaming to avoid loading the full result set into memory.
  • PostgreSQL and SQLite use paged export by rewriting top-level LIMIT/OFFSET windows.
  • SQL Server export requires a future adapter-specific streaming path and will currently fail unless paging rewrite is supported.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier
sqlstringYesRead-only SQL query to export
paramsarrayNoQuery parameters
formatstringNoOutput format: jsonl or csv (default: jsonl)
pageSizenumberNoPage size for non-streaming adapters (default: 1000)
fileNamestringNoOptional output file name written inside the export directory
timeoutMsnumberNoQuery timeout in milliseconds

Example Request:

{
  "dbId": "mariadb-reporting",
  "sql": "SELECT id, email, created_at FROM users ORDER BY id",
  "format": "jsonl",
  "fileName": "users-export.jsonl",
  "timeoutMs": 10000
}

Response:

{
  "dbId": "mariadb-reporting",
  "outputPath": "/absolute/path/to/.sql-mcp-cache/exports/users-export.jsonl",
  "format": "jsonl",
  "strategy": "stream",
  "rowsExported": 250000,
  "columns": ["id", "email", "created_at"],
  "fileSizeBytes": 18342011,
  "executionTimeMs": 8421
}

6. suggest_joins

Analyzes relationship graph to recommend optimal join paths between multiple tables.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase identifier
tablesstring[]YesArray of table names to join (2-10 tables)

Example Request:

{
  "dbId": "postgres-main",
  "tables": ["users", "orders", "products"]
}

Response:

[
  {
    "tables": ["users", "orders", "products"],
    "joins": [
      {
        "fromTable": "users",
        "toTable": "orders",
        "relationship": {
          "type": "one-to-many",
          "confidence": 1.0
        },
        "joinCondition": "users.id = orders.user_id"
      },
      {
        "fromTable": "orders",
        "toTable": "products",
        "relationship": {
          "type": "many-to-one",
          "confidence": 1.0
        },
        "joinCondition": "orders.product_id = products.id"
      }
    ],
    "sql": "FROM users JOIN orders ON users.id = orders.user_id JOIN products ON orders.product_id = products.id"
  }
]

7. clear_cache

Clears schema cache and query statistics for one or all databases.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringNoDatabase to clear (omit to clear all)

Example Request:

{
  "dbId": "postgres-main"
}

Response: Confirmation message.


8. cache_status

Retrieves detailed cache statistics and health information.

Input Parameters:

None required.

Response:

{
  "directory": ".sql-mcp-cache",
  "ttlMinutes": 10,
  "databases": [
    {
      "dbId": "postgres-main",
      "cached": true,
      "version": "abc123",
      "age": 120000,
      "expired": false,
      "tableCount": 15,
      "sizeBytes": 45678
    }
  ]
}

9. health_check

Tests database connectivity and returns status information.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringNoDatabase to check (omit to check all)

Response:

{
  "databases": [
    {
      "dbId": "postgres-main",
      "healthy": true,
      "connected": true,
      "version": "PostgreSQL 15.3",
      "responseTimeMs": 12
    }
  ]
}

10. analyze_performance

Get comprehensive performance analytics across all queries for a database.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase to analyze

Response:

{
  "totalQueries": 1250,
  "slowQueries": 23,
  "avgExecutionTime": 45.67,
  "p95ExecutionTime": 234.5,
  "errorRate": 1.2,
  "mostFrequentTables": [
    { "table": "users", "count": 456 },
    { "table": "orders", "count": 234 }
  ],
  "performanceTrend": "improving"
}

11. suggest_indexes

Analyze query patterns and recommend optimal database indexes.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase to analyze

Response:

[
  {
    "table": "orders",
    "columns": ["customer_id", "order_date"],
    "type": "composite",
    "reason": "Frequently used in WHERE and JOIN conditions",
    "impact": "high"
  },
  {
    "table": "products",
    "columns": ["category_id"],
    "type": "single",
    "reason": "Column category_id is frequently queried",
    "impact": "medium"
  }
]

12. detect_slow_queries

Identify queries that exceed performance thresholds and provide alerts.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase to analyze

Response:

[
  {
    "dbId": "postgres-main",
    "queryId": "a1b2c3",
    "sql": "SELECT * FROM large_table WHERE slow_column = ?",
    "executionTimeMs": 2500,
    "thresholdMs": 1000,
    "timestamp": "2024-01-27T10:30:00Z",
    "frequency": 5,
    "recommendations": [
      {
        "type": "add_index",
        "description": "Add index on slow_column for better performance",
        "impact": "high",
        "effort": "medium"
      }
    ]
  }
]

13. rewrite_query

Suggest optimized versions of SQL queries with performance improvements.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase ID
sqlstringYesSQL query to optimize

Response:

{
  "originalQuery": "SELECT * FROM users WHERE active = 1",
  "optimizedQuery": "SELECT id, name, email FROM users WHERE active = 1 LIMIT 1000",
  "improvements": [
    "Removed unnecessary SELECT *",
    "Added LIMIT clause to prevent large result sets"
  ],
  "performanceGain": 35,
  "confidence": "high"
}

14. profile_query

Profile a specific query's performance with detailed bottleneck analysis.

Input Parameters:

ParameterTypeRequiredDescription
dbIdstringYesDatabase ID
sqlstringYesSQL query to profile
paramsarrayNoQuery parameters

Response:

{
  "queryId": "def456",
  "sql": "SELECT u.name, COUNT(o.id) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.id",
  "executionTimeMs": 1250,
  "rowCount": 5000,
  "bottlenecks": [
    {
      "type": "join",
      "severity": "high",
      "description": "Nested loop join on large tables",
      "estimatedCost": 150
    }
  ],
  "recommendations": [
    {
      "type": "add_index",
      "description": "Add index on orders.user_id",
      "impact": "high",
      "effort": "low"
    }
  ],
  "overallScore": 65
}

Resources

The server exposes cached schemas as MCP resources:

  • URI: schema://{dbId}
  • MIME Type: application/json
  • Content: Complete cached schema metadata

Schema Introspection

Automatic Discovery

The server automatically discovers:

  1. Tables and Views: All user tables and optionally views
  2. Columns: Name, data type, nullability, defaults, auto-increment
  3. Indexes: Including primary keys and unique constraints
  4. Foreign Keys: Explicit relationship metadata
  5. Relationships: Both explicit and inferred

Relationship Inference

When foreign keys are not defined, the server infers relationships using heuristics:

  • Column names matching {table}_id or {table}Id
  • Data type compatibility with target primary key
  • Confidence scoring for inferred relationships

Caching Strategy

  • Memory + Disk: Dual-layer caching for performance
  • TTL-based: Configurable time-to-live
  • Version Tracking: Content-based versioning (hash)
  • Concurrency Safe: Prevents duplicate introspection
  • On-Demand Refresh: Manual or automatic refresh

Query Tracking

The server maintains per-database query history:

  • Timestamp and SQL text
  • Execution time and row count
  • Referenced tables (best-effort extraction)
  • Error tracking
  • Aggregate statistics

Use this data to:

  • Monitor query performance
  • Identify frequently accessed tables
  • Detect query patterns
  • Debug issues

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint
npm run lint

# Format code
npm run format

# Type check
npm run typecheck

Project Structure

src/
β”œβ”€β”€ adapters/          # Database adapters
β”‚   β”œβ”€β”€ base.ts        # Base adapter class
β”‚   β”œβ”€β”€ postgres.ts    # PostgreSQL adapter
β”‚   β”œβ”€β”€ mysql.ts       # MySQL adapter
β”‚   β”œβ”€β”€ sqlite.ts      # SQLite adapter
β”‚   β”œβ”€β”€ mssql.ts       # SQL Server adapter
β”‚   β”œβ”€β”€ oracle.ts      # Oracle adapter (stub)
β”‚   └── index.ts       # Adapter factory
β”œβ”€β”€ cache.ts           # Schema caching
β”œβ”€β”€ config.ts          # Configuration loader
β”œβ”€β”€ database-manager.ts # Database orchestration
β”œβ”€β”€ logger.ts          # Logging setup
β”œβ”€β”€ mcp-server.ts      # MCP server implementation
β”œβ”€β”€ query-tracker.ts   # Query history tracking
β”œβ”€β”€ types.ts           # TypeScript types
β”œβ”€β”€ utils.ts           # Utility functions
└── index.ts           # Entry point

Adding New Database Adapters

  1. Implement the DatabaseAdapter interface in src/adapters/
  2. Follow the pattern from existing adapters
  3. Add to adapter factory in src/adapters/index.ts
  4. Update type definitions if needed
  5. Add tests

Example:

import { BaseAdapter } from './base.js';

export class CustomAdapter extends BaseAdapter {
  async connect(): Promise<void> { /* ... */ }
  async disconnect(): Promise<void> { /* ... */ }
  async introspect(): Promise<DatabaseSchema> { /* ... */ }
  async query(): Promise<QueryResult> { /* ... */ }
  async explain(): Promise<ExplainResult> { /* ... */ }
  async testConnection(): Promise<boolean> { /* ... */ }
  async getVersion(): Promise<string> { /* ... */ }
}

Security Considerations

  • Always use read-only mode in production unless write access is required
  • Use environment variables for credentials, never hardcode
  • Enable secret redaction in logs
  • Restrict write operations with allowedWriteOperations
  • Use connection string encryption where supported
  • Regular security audits of configurations

License

MIT

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

Support

For issues, questions, or feature requests, please open an issue on GitHub.