bc-webclient-mcp
Version:
Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central via WebUI protocol. Enables AI assistants to interact with BC through the web client protocol, supporting Card, List, and Document pages with full line item support and server
56 lines • 1.72 kB
TypeScript
/**
* Audit Logger for MCP Tool Executions
*
* Logs all tool executions that required user consent.
* Provides audit trail for compliance and debugging.
*
* CRITICAL FIX: Logs result AFTER execution completes, not before.
* This prevents contradictory audit entries where "success" is logged
* but the operation actually fails.
*/
import type { ILogger } from '../core/interfaces.js';
export interface AuditEvent {
readonly timestamp: Date;
readonly toolName: string;
readonly userId?: string;
readonly userApproved: boolean;
readonly inputSummary: Record<string, unknown>;
readonly result: 'success' | 'error';
readonly errorMessage?: string;
}
export declare class AuditLogger {
private readonly logger?;
private readonly maxEvents;
private readonly events;
constructor(logger?: ILogger | undefined, maxEvents?: number);
/**
* Log a tool execution that required user approval.
*
* NOTE: This should only be called AFTER the tool execution completes,
* with the actual result status (success/error).
*/
logToolExecution(event: Omit<AuditEvent, 'timestamp'>): void;
/**
* Get recent audit events.
*/
getRecentEvents(count?: number): readonly AuditEvent[];
/**
* Sanitize input to remove sensitive data before logging.
*
* EXPANDED REDACTION: Now includes comprehensive list of credential patterns.
*/
private sanitizeInput;
/**
* Export audit log to JSON.
*/
exportToJSON(): string;
/**
* Clear all audit events.
*/
clear(): void;
/**
* Get total event count.
*/
getEventCount(): number;
}
//# sourceMappingURL=audit-logger.d.ts.map