@aashari/mcp-server-aws-sso
Version:
Node.js/TypeScript MCP server for AWS Single Sign-On (SSO). Enables AI systems (LLMs) with tools to initiate SSO login (device auth flow), list accounts/roles, and securely execute AWS CLI commands using temporary credentials. Streamlines AI interaction w
103 lines (102 loc) • 3.26 kB
TypeScript
/**
* Error types for classification
*/
export declare enum ErrorType {
AUTH_MISSING = "AUTH_MISSING",
AUTH_INVALID = "AUTH_INVALID",
API_ERROR = "API_ERROR",
UNEXPECTED_ERROR = "UNEXPECTED_ERROR"
}
/**
* Extend the Error interface to include the errorType property
*/
declare global {
interface Error {
errorType?: string;
$metadata?: Record<string, unknown>;
error?: string;
error_description?: string;
originalResponse?: Record<string, unknown> | string;
}
}
/**
* Custom error class with type classification
*/
export declare class McpError extends Error {
type: ErrorType;
statusCode?: number;
originalError?: unknown;
constructor(message: string, typeOrOptions: ErrorType | {
cause?: Error | unknown;
}, statusCode?: number, originalError?: unknown);
}
/**
* Create a standardized McpError with additional properties
* @param message Error message
* @param options Additional error options including cause and error type
* @returns McpError instance
*/
export declare function createMcpError(message: string, options?: {
cause?: Error | unknown;
errorType?: string;
metadata?: Record<string, unknown>;
}): McpError;
/**
* Create an authentication missing error
* @param message Error message
* @param cause Optional cause of the error
* @returns McpError with authentication missing details
*/
export declare function createAuthMissingError(message: string, cause?: Error | unknown): McpError;
/**
* Create an authentication timeout error
* @param message Error message
* @param cause Optional cause of the error
* @returns McpError with authentication timeout details
*/
export declare function createAuthTimeoutError(message: string, cause?: Error | unknown): McpError;
/**
* Create an API error
* @param message Error message
* @param statusCode Optional HTTP status code
* @param cause Optional cause of the error
* @returns McpError with API error details
*/
export declare function createApiError(message: string, statusCode?: number, cause?: Error | unknown): McpError;
/**
* Create an unexpected error
* @param message Error message
* @param cause Optional cause of the error
* @returns McpError with unexpected error details
*/
export declare function createUnexpectedError(message: string, cause?: Error | unknown): McpError;
/**
* Ensure an error is an McpError
* @param error The error to convert to an McpError
* @returns An McpError instance
*/
export declare function ensureMcpError(error: unknown): McpError;
/**
* Get the deepest original error from an error chain
* @param error The error to extract the original cause from
* @returns The deepest original error or the error itself
*/
export declare function getDeepOriginalError(error: unknown): unknown;
/**
* Format error for MCP tool response
*/
export declare function formatErrorForMcpTool(error: unknown): {
content: Array<{
type: 'text';
text: string;
}>;
metadata?: {
errorType: ErrorType;
statusCode?: number;
errorDetails?: unknown;
};
};
/**
* Handle error in CLI context with improved user feedback
*/
export declare function handleCliError(error: unknown): never;