Add PostgreSQL support to MCP Database Server

Updated package.json and package-lock.json to include PostgreSQL dependencies. Enhanced README with PostgreSQL usage instructions and configuration details. Modified index.ts to handle PostgreSQL connection parameters and logging. Added PostgresqlAdapter for database interactions.
This commit is contained in:
Karthik KK
2025-04-22 08:16:20 +12:00
parent 2a67d8b658
commit bd819d923f
7 changed files with 618 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ export interface DbAdapter {
// Import adapters using dynamic imports
import { SqliteAdapter } from './sqlite-adapter.js';
import { SqlServerAdapter } from './sqlserver-adapter.js';
import { PostgresqlAdapter } from './postgresql-adapter.js';
/**
* Factory function to create the appropriate database adapter
@@ -68,6 +69,9 @@ export function createDbAdapter(type: string, connectionInfo: any): DbAdapter {
}
case 'sqlserver':
return new SqlServerAdapter(connectionInfo);
case 'postgresql':
case 'postgres':
return new PostgresqlAdapter(connectionInfo);
default:
throw new Error(`Unsupported database type: ${type}`);
}