MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / initMcpRuntime

Function initMcpRuntime

apps/cli/src/mcp.ts:27–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27export function initMcpRuntime(): DatabaseManager {
28 const config = loadConfig()
29 const userDataDir = config.data.user_data_dir || undefined
30 const pathProvider = new NodePathProvider(userDataDir)
31 pathProvider.ensureAllDirs()
32 const runtime = assertCliDataDirCompatible(pathProvider, 'mcp')
33
34 if (hasPendingElectronDataWarning() || !verifyCliDataPath(pathProvider.getDatabaseDir())) {
35 console.error('[MCP] Electron desktop data detected but databases not found.')
36 console.error('[MCP] Set CHATLAB_DATA_DIR or edit ~/.chatlab/config.toml to point to your data directory.')
37 process.exit(1)
38 }
39
40 const nativeBinding = resolveNativeBinding()
41 return new DatabaseManager(pathProvider, { nativeBinding, runtime })
42}
43
44export async function startCliMcpServer(): Promise<void> {
45 const dbManager = initMcpRuntime()

Callers 2

startCliMcpServerFunction · 0.85

Calls 8

ensureAllDirsMethod · 0.95
getDatabaseDirMethod · 0.95
loadConfigFunction · 0.90
verifyCliDataPathFunction · 0.90
resolveNativeBindingFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected