MCPcopy Create free account
hub / github.com/SethGammon/Citadel / generatePluginMcpConfig

Function generatePluginMcpConfig

scripts/codex-compat.js:303–330  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301 }
302 }
303
304 // Warn about unrecognized top-level keys so we notice when Claude's
305 // shape evolves.
306 const known = new Set([...Object.keys(CLAUDE_TO_CODEX_MAP), '_codex', 'type']);
307 for (const k of Object.keys(config)) {
308 if (k.startsWith('_')) continue;
309 if (!known.has(k)) warnings.push(`mcp_servers.${name}: unrecognized field "${k}" — not translated`);
310 }
311 for (const w of warnings) console.warn(` warning: ${w}`);
312
313 lines.push('');
314 return lines.join('\n');
315}
316
317// ---- 2. Generate plugin MCP config ------------------------------------------
318
319function generatePluginMcpConfig() {
320 const mcpPath = path.join(PROJECT_ROOT, '.mcp.json');
321 if (fs.existsSync(mcpPath)) {
322 console.log('Preserving existing .mcp.json...');
323 return;
324 }
325
326 console.log('Generating plugin MCP config...');
327 const content = JSON.stringify({
328 mcpServers: {
329 'citadel-state': {
330 command: 'node',
331 args: [path.join(CITADEL_ROOT, 'mcp-servers', 'citadel-state', 'index.js')],
332 env: {
333 CITADEL_PROJECT_ROOT: PROJECT_ROOT,

Callers 1

mainFunction · 0.85

Calls 1

writeFileFunction · 0.70

Tested by

no test coverage detected