@andrew_eragon/mcp-server-salesforce
Version:
A SaaS-ready Salesforce connector MCP Server with connection pooling and multi-user support.
65 lines (64 loc) • 1.59 kB
TypeScript
import { ConnectionType } from '../types/connection.js';
/**
* User credentials for creating a connection
*/
export interface UserCredentials {
connectionType: ConnectionType;
username?: string;
password?: string;
token?: string;
accessToken?: string;
instanceUrl?: string;
clientId?: string;
clientSecret?: string;
refreshToken?: string;
id?: string;
scope?: string;
issuedAt?: string;
signature?: string;
tokenType?: string;
}
/**
* Connection pool for managing multiple user connections
*/
declare class ConnectionPool {
private connections;
private readonly maxIdleTime;
private readonly cleanupInterval;
private cleanupTimer?;
constructor();
/**
* Generate a unique key for user credentials
*/
private generateKey;
/**
* Get or create a connection for the given credentials
*/
getConnection(credentials: UserCredentials): Promise<any>;
/**
* Clean up idle connections
*/
private cleanup;
/**
* Start periodic cleanup
*/
private startCleanup;
/**
* Stop cleanup and clear all connections
*/
destroy(): void;
/**
* Get pool statistics
*/
getStats(): {
activeConnections: number;
connectionKeys: string[];
};
}
export declare const connectionPool: ConnectionPool;
/**
* Extract user credentials from environment variables
* This supports per-request environment variables set by the MCP client
*/
export declare function extractCredentialsFromEnv(): UserCredentials;
export {};