UNPKG

claude-code-history-mcp

Version:

MCP server for Claude Code conversation history tracking and analysis

107 lines 2.9 kB
export interface ClaudeCodeMessage { parentUuid: string | null; isSidechain: boolean; userType: string; cwd: string; sessionId: string; version: string; type: 'user' | 'assistant' | 'system' | 'result'; message?: { role: string; content: string | any[]; model?: string; usage?: any; }; uuid: string; timestamp: string; requestId?: string; } export interface ConversationEntry { sessionId: string; timestamp: string; type: 'user' | 'assistant' | 'system' | 'result'; content: string; projectPath: string; uuid: string; formattedTime?: string; timeAgo?: string; localDate?: string; metadata?: { usage?: any; totalCostUsd?: number; numTurns?: number; durationMs?: number; isError?: boolean; errorType?: string; model?: string; requestId?: string; }; } export interface PaginatedConversationResponse { entries: ConversationEntry[]; pagination: { total_count: number; limit: number; offset: number; has_more: boolean; }; } export interface HistoryQueryOptions { sessionId?: string; startDate?: string; endDate?: string; limit?: number; offset?: number; timezone?: string; messageTypes?: ('user' | 'assistant' | 'system' | 'result')[]; } export interface SessionListOptions { projectPath?: string; startDate?: string; endDate?: string; timezone?: string; } export interface ProjectInfo { projectPath: string; sessionCount: number; messageCount: number; lastActivityTime: string; } export interface SessionInfo { sessionId: string; projectPath: string; startTime: string; endTime: string; messageCount: number; userMessageCount: number; assistantMessageCount: number; } export interface SearchOptions { limit?: number; projectPath?: string; startDate?: string; endDate?: string; timezone?: string; } export declare class ClaudeCodeHistoryService { private claudeDir; constructor(); /** * Normalize date string to ISO format for proper comparison with timezone support */ private normalizeDate; getConversationHistory(options?: HistoryQueryOptions): Promise<PaginatedConversationResponse>; searchConversations(searchQuery: string, options?: SearchOptions): Promise<ConversationEntry[]>; listProjects(): Promise<ProjectInfo[]>; listSessions(options?: SessionListOptions): Promise<SessionInfo[]>; private loadClaudeHistoryEntries; private parseJsonlFile; private convertClaudeMessageToEntry; private getTimeAgo; private decodeProjectPath; /** * Determines whether to skip reading a file based on its modification time */ private shouldSkipFile; } //# sourceMappingURL=history-service.d.ts.map