Skip to content

Commit b6f8c77

Browse files
committed
Allow disabling MCP config filtering
1 parent 989fc18 commit b6f8c77

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/CodexAcpClient.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ export class CodexAcpClient {
4848
private readonly codexClient: CodexAppServerClient;
4949
private readonly config: JsonObject;
5050
private readonly modelProvider: string | null;
51+
private readonly disableMcpConfigFiltering: boolean;
5152
private gatewayConfig: GatewayConfig | null;
5253
private pendingLoginCompleted: Promise<AccountLoginCompletedNotification> | null = null;
5354
private pendingAccountUpdated: Promise<AccountUpdatedNotification> | null = null;
5455
private readonly sessionNotificationQueues = new Map<string, Promise<void>>();
5556
private skillExtraRoots: string[] = [];
5657

5758

58-
constructor(codexClient: CodexAppServerClient, codexConfig?: JsonObject, modelProvider?: string) {
59+
constructor(codexClient: CodexAppServerClient, codexConfig?: JsonObject, modelProvider?: string, disableMcpConfigFiltering = false) {
5960
this.codexClient = codexClient;
6061
this.config = codexConfig ?? {};
6162
this.modelProvider = modelProvider ?? null;
63+
this.disableMcpConfigFiltering = disableMcpConfigFiltering;
6264
this.gatewayConfig = null;
6365
}
6466

@@ -328,7 +330,9 @@ export class CodexAcpClient {
328330

329331
// Deduplicates new servers against existing config to prevent Codex from deep-merging
330332
// incompatible field types (e.g., mixing url and stdio schemas).
331-
const existingNames = await this.getConfigMcpServerNames(projectPath);
333+
const existingNames = this.disableMcpConfigFiltering
334+
? new Set<string>()
335+
: await this.getConfigMcpServerNames(projectPath);
332336
const requestedServers = mcpServers.map(mcp => ({
333337
name: sanitizeMcpServerName(mcp.name),
334338
server: mcp,

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function startAcpServer() {
4242
const configString = process.env["CODEX_CONFIG"];
4343
const authRequestString = process.env["DEFAULT_AUTH_REQUEST"];
4444
const modelProvider = process.env["MODEL_PROVIDER"];
45+
const disableMcpConfigFiltering = process.env["DISABLE_MCP_CONFIG_FILTERING"] === "true";
4546
const config = configString ? JSON.parse(configString) : undefined;
4647
const parsedAuthRequest = authRequestString ? JSON.parse(authRequestString) : undefined;
4748
const defaultAuthRequest = parsedAuthRequest && isCodexAuthRequest(parsedAuthRequest) ? parsedAuthRequest : undefined;
@@ -72,7 +73,7 @@ function startAcpServer() {
7273

7374
function createAgent(connection: acp.AgentSideConnection): CodexAcpServer {
7475
const appServerClient = new CodexAppServerClient(codexConnection.connection);
75-
const codexClient = new CodexAcpClient(appServerClient, config, modelProvider);
76+
const codexClient = new CodexAcpClient(appServerClient, config, modelProvider, disableMcpConfigFiltering);
7677
return new CodexAcpServer(connection, codexClient, defaultAuthRequest, () => codexConnection.process.exitCode);
7778
}
7879

0 commit comments

Comments
 (0)