MCPcopy
hub / github.com/benjitaylor/agentation / initializeStore

Function initializeStore

mcp/src/server/store.ts:43–61  ·  view source on GitHub ↗

* Initialize the store. Tries SQLite first, falls back to in-memory.

()

Source from the content-addressed store, hash-verified

41 * Initialize the store. Tries SQLite first, falls back to in-memory.
42 */
43function initializeStore(): AFSStore {
44 // Check if we should use in-memory only
45 if (process.env.AGENTATION_STORE === "memory") {
46 process.stderr.write("[Store] Using in-memory store (AGENTATION_STORE=memory)\n");
47 return createMemoryStore();
48 }
49
50 try {
51 // Dynamic import to avoid issues if better-sqlite3 isn't available
52 // eslint-disable-next-line @typescript-eslint/no-require-imports
53 const { createSQLiteStore } = require("./sqlite.js");
54 const store = createSQLiteStore();
55 process.stderr.write("[Store] Using SQLite store (~/.agentation/store.db)\n");
56 return store;
57 } catch (err) {
58 console.warn("[Store] SQLite unavailable, falling back to in-memory:", (err as Error).message);
59 return createMemoryStore();
60 }
61}
62
63// -----------------------------------------------------------------------------
64// In-Memory Store (fallback)

Callers 1

getStoreFunction · 0.85

Calls 2

createMemoryStoreFunction · 0.85
createSQLiteStoreFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…