/** Audit log configuration */ interface AuditConfig { /** Master switch — false means no interceptor is created */ enabled: boolean; /** Absolute path to the JSONL output file, or "stderr" for container mode */ logPath: string; /** When true, tool arguments are omitted from entries */ redact: boolean; /** When true, read-scoped tools are also logged (default: false) */ auditReads: boolean; /** Maximum log file size in bytes before rotation (default: 10MB). 0 = no rotation. */ maxSizeBytes: number; } /** * Memory Journal MCP Server - Tool Filtering * * Configurable tool filtering system with groups and meta-groups. * Matches mysql-mcp filtering syntax and patterns. */ /** * Tool group definitions mapping group names to tool names * * All 73 tools are categorized here for filtering support. */ declare const TOOL_GROUPS: Record; /** * Meta-group definitions mapping shortcuts to groups */ declare const META_GROUPS: Record; /** * Get all tool names across all groups */ declare function getAllToolNames(): string[]; /** * Get the group for a specific tool */ declare function getToolGroup(toolName: string): ToolGroup | undefined; /** * Parse a tool filter string into configuration * * Syntax: * - `starter` - Use starter preset (whitelist mode) * - `core,search` - Enable specific groups (whitelist mode) * - `full,-admin` - All tools except admin group * - `starter,-delete_entry` - Starter without specific tool * - `+semantic_search` - Add specific tool to current set */ declare function parseToolFilter(filterString: string): ToolFilterConfig; /** * Check if a tool is enabled based on filter string */ declare function isToolEnabled(toolName: string, filterConfig: ToolFilterConfig): boolean; /** * Filter tools array based on filter configuration */ declare function filterTools(tools: T[], filterConfig: ToolFilterConfig): T[]; /** * Get tool filter from environment variable */ declare function getToolFilterFromEnv(): ToolFilterConfig | null; /** * Calculate token savings from filtering */ declare function calculateTokenSavings(totalTools: number, enabledTools: number, avgTokensPerTool?: number): { reduction: number; savedTokens: number; }; /** * Get human-readable filter summary */ declare function getFilterSummary(filterConfig: ToolFilterConfig): string; /** * Memory Journal MCP Server - Scheduler * * Lightweight in-process scheduler for periodic maintenance jobs. * Only meaningful for HTTP/SSE transport (long-lived server processes). * Uses setInterval for simplicity — no external dependencies. */ /** Scheduler configuration options */ interface SchedulerOptions { /** Automated backup interval in minutes (0 = disabled) */ backupIntervalMinutes: number; /** Max backups to retain during automated cleanup */ keepBackups: number; /** Database optimize interval in minutes (0 = disabled) */ vacuumIntervalMinutes: number; /** Vector index rebuild interval in minutes (0 = disabled) */ rebuildIndexIntervalMinutes: number; /** Analytics digest interval in minutes (0 = disabled; recommended: 1440 for daily) */ digestIntervalMinutes: number; } /** * Memory Journal MCP Server - Resource Shared Types & Helpers * * Shared types, helpers, and utilities used by all resource group modules. */ /** * Configuration for the memory://briefing resource. * All values have sensible defaults — users opt-in via env vars or CLI flags. */ interface BriefingConfig { /** Number of recent journal entries to include (default: 3) */ entryCount: number; /** Number of recent session summaries to display (default: 1) */ summaryCount?: number; /** Include team DB entries in briefing preview (default: false) */ includeTeam: boolean; /** Number of open issues to list with titles; 0 = count only (default: 0) */ issueCount: number; /** Number of PRs to list with titles; 0 = count only (default: 0) */ prCount: number; /** Show PR status breakdown (open/merged/closed) instead of simple count (default: false) */ prStatusBreakdown: boolean; /** Number of milestones to list in briefing; 0 = hide (default: 3) */ milestoneCount?: number; /** Path to the user's rules file (e.g., .gemini/GEMINI.md) for awareness in briefing */ rulesFilePath?: string; /** Path to the user's skills directory for awareness in briefing */ skillsDirPath?: string; /** Number of recent workflow runs to list; 0 = latest-only status (default: 0) */ workflowCount: number; /** Show workflow run status breakdown (passing/failing/pending) (default: false) */ workflowStatusBreakdown: boolean; /** Aggregate Copilot review state across recent PRs in briefing (default: false) */ copilotReviews: boolean; /** Workflow summary string for the memory://workflows resource (env: MEMORY_JOURNAL_WORKFLOW_SUMMARY) */ workflowSummary?: string; /** Default GitHub Project number for Kanban resources and issue tools (env: DEFAULT_PROJECT_NUMBER) */ defaultProjectNumber?: number; /** Project registry mapping dynamic repo IDs to local paths and kanban boards */ projectRegistry?: Record; /** Hush Protocol flag vocabulary passed from CLI/env */ flagVocabulary?: string[]; /** Allowlisted directory roots for strict filesystem jailing of agent read access */ allowedIoRoots?: string[]; } /** * Memory Journal MCP Server - Tool Filtering Types */ /** * Tool group identifiers for Memory Journal */ type ToolGroup = 'core' | 'search' | 'analytics' | 'relationships' | 'io' | 'admin' | 'github' | 'backup' | 'team' | 'codemode'; /** * Meta-group identifiers for common multi-group selections */ type MetaGroup = 'starter' | 'essential' | 'full' | 'readonly'; /** * Tool filter rule */ interface ToolFilterRule { /** Rule type: include or exclude */ type: 'include' | 'exclude'; /** Target: group name or tool name */ target: string; /** Whether target is a group (true) or individual tool (false) */ isGroup: boolean; } /** * Parsed tool filter configuration */ interface ToolFilterConfig { /** Original filter string */ raw: string; /** Parsed rules in order */ rules: ToolFilterRule[]; /** Set of enabled tool names after applying rules */ enabledTools: Set; } /** * Memory Journal MCP Server - Database Entity Types */ /** * Entry types for journal entries */ type EntryType = 'personal_reflection' | 'project_decision' | 'technical_achievement' | 'bug_fix' | 'feature_implementation' | 'code_review' | 'meeting_notes' | 'learning' | 'research' | 'planning' | 'retrospective' | 'standup' | 'technical_note' | 'development_note' | 'enhancement' | 'milestone' | 'flag' | 'system_integration_test' | 'test_entry' | 'plan_draft' | 'adversarial_review' | 'plan_refinement' | 'copilot_validation' | 'other'; /** * Significance types for important entries */ type SignificanceType = 'milestone' | 'breakthrough' | 'decision' | 'architecture' | 'lesson_learned' | 'blocker_resolved' | 'release' | 'security' | null; /** * Relationship types between entries * * Standard types: * - evolves_from: Entry builds upon previous work * - references: Entry mentions or links to another * - implements: Entry implements a spec/design * - clarifies: Entry explains or clarifies another * - response_to: Entry responds to a question/issue * * Causal types (for decision tracing): * - blocked_by: Entry was blocked by another (e.g., blocker → resolution) * - resolved: Entry resolved/fixed an issue from another * - caused: Entry caused or led to another outcome */ type RelationshipType = 'evolves_from' | 'references' | 'implements' | 'clarifies' | 'response_to' | 'blocked_by' | 'resolved' | 'caused'; /** * Journal entry entity */ interface JournalEntry { id: number; entryType: EntryType; content: string; timestamp: string; isPersonal: boolean; significanceType: SignificanceType; autoContext: string | null; deletedAt: string | null; tags: string[]; projectNumber?: number | null; projectOwner?: string | null; issueNumber?: number | null; issueUrl?: string | null; prNumber?: number | null; prUrl?: string | null; prStatus?: string | null; workflowRunId?: number | null; workflowName?: string | null; workflowStatus?: string | null; importanceScore?: number; } /** * Tag entity */ interface Tag { id: number; name: string; usageCount: number; } /** * Relationship entity */ interface Relationship { id: number; fromEntryId: number; toEntryId: number; relationshipType: RelationshipType; description: string | null; createdAt: string; } /** * Embedding entity for vector search */ interface Embedding { entryId: number; embedding: Float32Array; modelName: string; } /** * Importance scoring breakdown showing weighted component contributions */ interface ImportanceBreakdown { /** Significance type contribution (weight: 0.30) */ significance: number; /** Relationship count contribution (weight: 0.35) */ relationships: number; /** Causal relationship contribution (weight: 0.20) */ causal: number; /** Recency decay contribution (weight: 0.15) */ recency: number; } /** * Importance calculation result with total score and component breakdown */ interface ImportanceResult { /** Total importance score (0.0-1.0) */ score: number; /** Weighted component contributions */ breakdown: ImportanceBreakdown; } /** * Memory Journal MCP Server - GitHub Integration Types */ /** * GitHub project information */ interface GitHubProject { number: number; title: string; url: string; state: 'OPEN' | 'CLOSED'; } /** * GitHub issue information */ interface GitHubIssue { number: number; title: string; url: string; state: 'OPEN' | 'CLOSED'; milestone?: { number: number; title: string; } | null; } /** * GitHub pull request information */ interface GitHubPullRequest { number: number; title: string; url: string; state: 'OPEN' | 'CLOSED' | 'MERGED'; } /** * GitHub milestone information */ interface GitHubMilestone { number: number; title: string; description: string | null; state: 'open' | 'closed'; url: string; dueOn: string | null; openIssues: number; closedIssues: number; createdAt: string; updatedAt: string; creator: string | null; } /** * GitHub workflow run information */ interface GitHubWorkflowRun { id: number; name: string; status: 'queued' | 'in_progress' | 'completed'; conclusion: 'success' | 'failure' | 'cancelled' | 'skipped' | null; url: string; headBranch: string; headSha: string; createdAt: string; updatedAt: string; } /** * Auto-captured project context */ interface ProjectContext { repoName: string | null; branch: string | null; commit: string | null; remoteUrl: string | null; projects: GitHubProject[]; issues: GitHubIssue[]; pullRequests: GitHubPullRequest[]; workflowRuns: GitHubWorkflowRun[]; milestones: GitHubMilestone[]; degraded?: string[]; } /** * Memory Journal MCP Server - Type Definitions * * Barrel file re-exporting all types from sub-modules, plus types * that depend on external imports (SqliteAdapter, VectorSearchManager, etc.). */ /** * MCP Tool Annotations (MCP Spec 2025-11-25) * * Behavioral hints for AI clients to understand tool characteristics. */ interface ToolAnnotations { /** Tool does not modify state (idempotent reads) */ readOnlyHint?: boolean; /** Tool may permanently delete/destroy data */ destructiveHint?: boolean; /** Repeated calls with same args produce same result */ idempotentHint?: boolean; /** Tool interacts with external services (network, APIs) */ openWorldHint?: boolean; } /** * MCP Resource Annotations (MCP Spec 2025-11-25) */ interface ResourceAnnotations { /** Intended audience: 'user' or 'assistant' */ audience?: ('user' | 'assistant')[]; /** Importance level from 0.0 (optional) to 1.0 (required) */ priority?: number; /** ISO 8601 timestamp of last modification */ lastModified?: string; } /** * Tool definition for registration */ interface ToolDefinition { /** Unique tool name */ name: string; /** Human-readable display title (MCP 2025-11-25) */ title: string; /** Human-readable description */ description: string; /** Tool group for filtering */ group: ToolGroup; /** Zod schema for input validation */ inputSchema: unknown; /** Zod schema for output validation (MCP 2025-11-25 outputSchema) */ outputSchema?: unknown; /** Behavioral hints for AI clients */ annotations: ToolAnnotations; /** Security capabilities required to execute this tool */ capabilities?: { requiresTeamScope?: boolean; requiresAdminScope?: boolean; mutatesState?: boolean; }; /** Tool handler function */ handler: (params: unknown) => unknown; } interface ProjectRegistryEntry { path: string; project_number?: number; } /** * Resource definition for MCP */ interface ResourceDefinition { /** Resource URI template */ uri: string; /** Human-readable name */ name: string; /** Human-readable display title */ title: string; /** Description */ description: string; /** MIME type */ mimeType: string; /** Resource metadata annotations */ annotations?: ResourceAnnotations; /** Security capabilities required to read this resource */ capabilities?: { requiresTeamScope?: boolean; requiresAdminScope?: boolean; }; /** Resource handler - NOTE: db is passed at runtime, not in the definition */ handler: (uri: string) => Promise; } /** * Prompt definition for MCP */ interface PromptDefinition { /** Prompt name */ name: string; /** Description */ description: string; /** Argument definitions */ arguments?: { name: string; description: string; required?: boolean; }[]; /** Prompt handler */ handler: (args: Record) => Promise; } /** * Server configuration */ interface ServerConfig { /** Path to SQLite database file */ dbPath: string; /** GitHub personal access token */ githubToken?: string; /** GitHub organization token (for org projects) */ githubOrgToken?: string; /** Default organization name */ defaultOrg?: string; /** Tool filter string */ toolFilter?: string; /** Default GitHub Project number for auto-assignment */ defaultProjectNumber?: number; /** Project registry mapping dynamic repo IDs to local paths and kanban boards */ projectRegistry?: Record; /** Enable semantic search */ enableSemanticSearch: boolean; /** Sentence transformer model name */ modelName: string; /** Briefing depth for AI client instructions */ instructionLevel?: 'essential' | 'standard' | 'full'; /** Hush Protocol flag vocabulary (defaults: blocker, needs_review, help_requested, fyi) */ flagVocabulary?: string[]; } /** * Default configuration values */ declare const DEFAULT_CONFIG: Partial; /** * Memory Journal MCP Server - Database Schema * * SQL DDL for initialization and input types for the database adapter. */ /** * Input for creating a new entry */ interface CreateEntryInput { content: string; entryType?: EntryType; tags?: string[]; isPersonal?: boolean; significanceType?: SignificanceType; autoContext?: string; /** Optional ISO 8601 timestamp override (defaults to current time) */ timestamp?: string; projectNumber?: number; projectOwner?: string; issueNumber?: number; issueUrl?: string; prNumber?: number; prUrl?: string; prStatus?: 'draft' | 'open' | 'merged' | 'closed'; workflowRunId?: number; workflowName?: string; workflowStatus?: 'queued' | 'in_progress' | 'completed'; author?: string; } /** * The public facade representing the capabilities of any memory-journal DB adapter */ interface IDatabaseAdapter { initialize(): Promise; applyTeamSchema(): void; flushSave(): void; close(): void; createEntry(input: CreateEntryInput): JournalEntry; getEntryById(id: number): JournalEntry | null; getEntryByIdIncludeDeleted(id: number): JournalEntry | null; getEntriesByIds(ids: number[]): Map; getEntriesByIdsWithImportance(ids: number[]): Map; calculateImportance(entryId: number): ImportanceResult; getRecentEntries(limit?: number, isPersonal?: boolean, sortBy?: 'timestamp' | 'importance'): JournalEntry[]; getEntriesPage(offset: number, limit: number): JournalEntry[]; getActiveEntryCount(): number; updateEntry(id: number, updates: { content?: string; entryType?: EntryType; tags?: string[]; isPersonal?: boolean; significanceType?: string | null; autoContext?: string | null; projectNumber?: number | null; projectOwner?: string | null; issueNumber?: number | null; issueUrl?: string | null; prNumber?: number | null; prUrl?: string | null; prStatus?: string | null; workflowRunId?: number | null; workflowName?: string | null; workflowStatus?: string | null; }): JournalEntry | null; deleteEntry(id: number, permanent?: boolean): boolean; searchEntries(query: string, options?: { limit?: number; isPersonal?: boolean; projectNumber?: number; issueNumber?: number; prNumber?: number; prStatus?: string; workflowRunId?: number; tags?: string[]; entryType?: EntryType; startDate?: string; endDate?: string; sortBy?: 'timestamp' | 'importance'; }): JournalEntry[]; searchByDateRange(startDate: string, endDate: string, options?: { entryType?: EntryType; tags?: string[]; isPersonal?: boolean; projectNumber?: number; issueNumber?: number; prNumber?: number; workflowRunId?: number; limit?: number; sortBy?: 'timestamp' | 'importance'; }): JournalEntry[]; getStatistics(groupBy?: 'day' | 'week' | 'month' | 'year', startDate?: string, endDate?: string, projectBreakdown?: boolean): Record; getAuthorStatistics(): { author: string; count: number; }[]; getAuthorsForEntries(entryIds: number[]): Map; getTagsForEntry(entryId: number): string[]; getTagsForEntries(entryIds: number[]): Map; listTags(): Tag[]; mergeTags(sourceTag: string, targetTag: string): { entriesUpdated: number; sourceDeleted: boolean; }; linkEntries(fromEntryId: number, toEntryId: number, relationshipType: RelationshipType, description?: string): Relationship; getRelationships(entryId: number): Relationship[]; getRelationshipsForEntries(entryIds: number[]): Map; getBackupsDir(): string; exportToFile(backupName?: string): Promise<{ filename: string; path: string; sizeBytes: number; }>; listBackups(): { filename: string; path: string; sizeBytes: number; createdAt: string; }[]; deleteOldBackups(keepCount: number): { deleted: string[]; kept: number; }; restoreFromFile(filename: string, runtime?: unknown): Promise<{ restoredFrom: string; previousEntryCount: number; newEntryCount: number; }>; getHealthStatus(): { database: { path: string; sizeBytes: number; entryCount: number; deletedEntryCount: number; relationshipCount: number; tagCount: number; }; backups: { directory: string; count: number; lastBackup: { filename: string; createdAt: string; sizeBytes: number; } | null; }; }; saveAnalyticsSnapshot(type: string, data: Record): number; getLatestAnalyticsSnapshot(type: string): { id: number; createdAt: string; data: Record; } | null; getAnalyticsSnapshots(type: string, limit?: number): { id: number; createdAt: string; data: Record; }[]; computeDigest(): Record; pragma(command: string): void; getCrossProjectInsights(options: { startDate?: string; endDate?: string; minEntries: number; inactiveThresholdDays: number; }): { projects: Record[]; inactiveProjects: { project_number: number; last_entry_date: string; }[]; }; visualizeRelationships(options: { entryId?: number; tags?: string[]; relationshipType?: string; depth: number; limit: number; }): { nodes: { id: string | number; label: string; group: string; metadata?: Record; }[]; edges: { from: string | number; to: string | number; label: string; type: string; }[]; }; getTeamCollaborationMatrix(options: { period: string; limit: number; }): { totalAuthors: number; totalEntries: number; authorActivity: { author: string; period: string; entryCount: number; }[]; crossAuthorLinks: { fromAuthor: string; toAuthor: string; linkCount: number; }[]; impactFactor: { author: string; inboundLinks: number; }[]; }; getWorkflowActionEntries(limit: number): JournalEntry[]; getSignificantEntries(limit: number, projectNumber?: number): JournalEntry[]; getRecentGraphRelationships(limit: number): { from_entry_id: number; to_entry_id: number; relationship_type: string; from_content: string; to_content: string; }[]; upsertVector(entryId: number, embedding: Float32Array): void; upsertVectors(vectors: { entryId: number; embedding: Float32Array; }[]): void; searchVectors(embedding: Float32Array, limit: number): { entry_id: number; distance: number; }[]; getVector(entryId: number): Float32Array | null; deleteVector(entryId: number): void; clearVectors(): void; getVectorCount(): number; cleanupStaleVectors(): void; pruneByImportance(olderThanDays: number, importanceThreshold: number): number; executeInTransaction(cb: () => T): T; } /** * Memory Journal MCP Server - Main Server * * MCP server implementation with tools, resources, and prompts. */ interface ServerOptions { transport: 'stdio' | 'http'; port?: number; host?: string; dbPath: string; teamDbPath?: string; toolFilter?: string; defaultProjectNumber?: number; autoRebuildIndex?: boolean; statelessHttp?: boolean; corsOrigins?: string[]; authToken?: string; enableHSTS?: boolean; scheduler?: SchedulerOptions; oauthEnabled?: boolean; oauthIssuer?: string; oauthAudience?: string; oauthJwksUri?: string; oauthClockTolerance?: number; allowPlaintextLoopbackOAuth?: boolean; trustProxy?: boolean; publicOrigin?: string; briefingConfig?: BriefingConfig; projectRegistry?: Record; instructionLevel?: 'essential' | 'standard' | 'full'; auditConfig?: AuditConfig; flagVocabulary?: string[]; allowedIoRoots?: string[]; codemodeInternalFullAccess?: boolean; pruneOlderThanDays?: number; pruneImportanceThreshold?: number; } /** * Create and start the MCP server */ declare function createServer(options: ServerOptions): Promise; /** * Version SSoT — Single Source of Truth * * Reads the version from package.json at runtime via createRequire. * All modules that need the version string should import from here * instead of importing package.json directly. */ /** The current server version, read from package.json */ declare const VERSION: string; /** * Memory Journal MCP Server - Logger * * Centralized logging to stderr only (stdout reserved for MCP protocol). * Follows RFC 5424 severity levels. * Automatically sanitizes error fields to prevent token leakage. */ type LogLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical'; interface LogContext { module?: string; operation?: string; entityId?: string | number; [key: string]: unknown; } declare class Logger { private minLevel; constructor(level?: LogLevel); private shouldLog; private log; debug(message: string, context?: LogContext): void; info(message: string, context?: LogContext): void; notice(message: string, context?: LogContext): void; warning(message: string, context?: LogContext): void; error(message: string, context?: LogContext): void; critical(message: string, context?: LogContext): void; setLevel(level: LogLevel): void; } declare const logger: Logger; export { DEFAULT_CONFIG, type Embedding, type EntryType, type GitHubIssue, type GitHubProject, type GitHubPullRequest, type GitHubWorkflowRun, type JournalEntry, META_GROUPS, type MetaGroup, type ProjectContext, type PromptDefinition, type Relationship, type RelationshipType, type ResourceAnnotations, type ResourceDefinition, type ServerConfig, type SignificanceType, type IDatabaseAdapter as SqliteAdapter, TOOL_GROUPS, type Tag, type ToolAnnotations, type ToolDefinition, type ToolFilterConfig, type ToolFilterRule, type ToolGroup, VERSION, calculateTokenSavings, createServer, filterTools, getAllToolNames, getFilterSummary, getToolFilterFromEnv, getToolGroup, isToolEnabled, logger, parseToolFilter };