Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 3x 3x 1x 2x 2x 2x 1x | import * as fs from 'fs';
import * as path from 'path';
export interface VitekMcpConfig {
apiDir: string;
apiBasePath: string;
socketBasePath: string;
baseUrl: string;
}
const DEFAULT_CONFIG: VitekMcpConfig = {
apiDir: 'src/api',
apiBasePath: '/api',
socketBasePath: '/api/ws',
baseUrl: 'http://localhost:5173',
};
export function loadMcpConfig(root: string): VitekMcpConfig {
const configPath = path.join(root, 'vitek.mcp.json');
if (!fs.existsSync(configPath)) {
return { ...DEFAULT_CONFIG };
}
try {
const raw = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
return {
apiDir: raw.apiDir ?? DEFAULT_CONFIG.apiDir,
apiBasePath: raw.apiBasePath ?? DEFAULT_CONFIG.apiBasePath,
socketBasePath: raw.socketBasePath ?? DEFAULT_CONFIG.socketBasePath,
baseUrl: raw.baseUrl ?? DEFAULT_CONFIG.baseUrl,
};
} catch {
return { ...DEFAULT_CONFIG };
}
}
|