UNPKG

@aashari/mcp-server-atlassian-bitbucket

Version:

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MC

79 lines (78 loc) 2.4 kB
/** * Error types for MCP errors */ export type McpErrorType = 'AUTHENTICATION_REQUIRED' | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'RATE_LIMIT_EXCEEDED' | 'API_ERROR' | 'UNEXPECTED_ERROR'; /** * Error types for classification */ export declare enum ErrorType { AUTH_MISSING = "AUTH_MISSING", AUTH_INVALID = "AUTH_INVALID", API_ERROR = "API_ERROR", UNEXPECTED_ERROR = "UNEXPECTED_ERROR" } /** * Custom error class with type classification */ export declare class McpError extends Error { type: ErrorType; errorType?: McpErrorType; statusCode?: number; originalError?: unknown; constructor(message: string, type: ErrorType, statusCode?: number, originalError?: unknown); } /** * Helper to unwrap nested McpErrors and return the deepest original error. * This is useful when an McpError contains another McpError as `originalError` * which in turn may wrap the vendor (Bitbucket) error text or object. */ export declare function getDeepOriginalError(error: unknown): unknown; /** * Create an authentication missing error */ export declare function createAuthMissingError(message?: string, originalError?: unknown): McpError; /** * Create an authentication invalid error */ export declare function createAuthInvalidError(message?: string, originalError?: unknown): McpError; /** * Create an API error */ export declare function createApiError(message: string, statusCode?: number, originalError?: unknown): McpError; /** * Create an unexpected error */ export declare function createUnexpectedError(message?: string, originalError?: unknown): McpError; /** * Ensure an error is an McpError */ export declare function ensureMcpError(error: unknown): McpError; /** * 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; }; }; /** * Format error for MCP resource response */ export declare function formatErrorForMcpResource(error: unknown, uri: string): { contents: Array<{ uri: string; text: string; mimeType: string; description?: string; }>; }; /** * Handle error in CLI context with improved user feedback */ export declare function handleCliError(error: unknown): never;