Skip to content

Commit 900accd

Browse files
committed
Test disabled MCP config filtering
1 parent 7b2aecf commit 900accd

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

src/__tests__/CodexACPAgent/CodexAcpClient.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,58 @@ describe('ACP server test', { timeout: 40_000 }, () => {
439439
});
440440
});
441441

442+
it('passes conflicting ACP MCP servers through when config filtering is disabled', async () => {
443+
vi.stubEnv("DISABLE_MCP_CONFIG_FILTERING", "true");
444+
try {
445+
const mockFixture = createCodexMockTestFixture();
446+
const codexAcpClient = mockFixture.getCodexAcpClient();
447+
const codexAppServerClient = mockFixture.getCodexAppServerClient();
448+
449+
vi.spyOn(codexAppServerClient, "listSkills").mockResolvedValue({data: []});
450+
const configReadSpy = vi.spyOn(codexAppServerClient, "configRead").mockResolvedValue({
451+
config: {
452+
mcp_servers: {
453+
shared_mcp: {
454+
url: "https://example.com/mcp",
455+
},
456+
},
457+
},
458+
} as any);
459+
const threadStartSpy = vi.spyOn(codexAppServerClient, "threadStart").mockResolvedValue({
460+
thread: {id: "thread-id"} as any,
461+
model: "gpt-5",
462+
reasoningEffort: "medium",
463+
serviceTier: null,
464+
} as any);
465+
vi.spyOn(codexAppServerClient, "listModels").mockResolvedValue({
466+
data: [createTestModel({id: "gpt-5"})],
467+
nextCursor: null,
468+
});
469+
470+
await codexAcpClient.newSession({
471+
cwd: "/workspace",
472+
mcpServers: [{
473+
name: "shared mcp",
474+
command: "npx",
475+
args: ["shared"],
476+
env: [],
477+
}],
478+
});
479+
480+
const threadStartRequest = threadStartSpy.mock.calls[0]![0];
481+
expect(configReadSpy).not.toHaveBeenCalled();
482+
expect(threadStartRequest.config?.["mcp_servers"]).toEqual({
483+
shared_mcp: {
484+
command: "npx",
485+
args: ["shared"],
486+
env: {},
487+
},
488+
});
489+
} finally {
490+
vi.unstubAllEnvs();
491+
}
492+
});
493+
442494
it('waits for typed mcp startup status updates and returns terminal states', async () => {
443495
const mockFixture = createCodexMockTestFixture();
444496
const codexAcpClient = mockFixture.getCodexAcpClient();

0 commit comments

Comments
 (0)