feat(codex): install context7 mcp

This commit is contained in:
YeonGyu-Kim
2026-05-31 05:29:00 +09:00
parent fe90cfcd02
commit 19f1c3418f
2 changed files with 69 additions and 0 deletions
@@ -15,6 +15,14 @@ const MANAGED_CODEX_AGENT_NAMES = [
"momus",
"plan",
];
const CONTEXT7_MCP_SERVER_HEADER = "mcp_servers.context7";
const CONTEXT7_MCP_SERVER_BLOCK = [
`[${CONTEXT7_MCP_SERVER_HEADER}]`,
`command = "npx"`,
`args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]`,
`startup_timeout_sec = 20`,
"",
].join("\n");
export async function updateCodexConfig({
configPath,
@@ -40,6 +48,7 @@ export async function updateCodexConfig({
config = ensureFeatureEnabled(config, "plugins");
config = ensureFeatureEnabled(config, "plugin_hooks");
config = ensureCodexMultiAgentV2Config(config);
config = ensureContext7McpServer(config);
config = ensureMarketplaceBlock(config, marketplaceName, marketplaceSource);
for (const pluginName of pluginNames) {
config = ensurePluginEnabled(config, `${pluginName}@${marketplaceName}`);
@@ -129,6 +138,11 @@ function ensureMarketplaceBlock(config, marketplaceName, source) {
return appendBlock(config, block);
}
function ensureContext7McpServer(config) {
if (findTomlSection(config, CONTEXT7_MCP_SERVER_HEADER)) return config;
return appendBlock(config, CONTEXT7_MCP_SERVER_BLOCK);
}
function ensurePluginEnabled(config, pluginKey) {
const header = `plugins.${JSON.stringify(pluginKey)}`;
const section = findTomlSection(config, header);