fix(adapters): use http_headers in codex managed mcp config
Codex CLI expects `http_headers` rather than `headers` for HTTP MCP server headers in config.toml. Using `headers` caused the Authorization bearer token to be omitted when connecting to Paperclip managed tool gateways, resulting in 401 unauthorized errors during MCP tool discovery. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
5cb4f061dd
commit
ab1fcec8ab
|
|
@ -952,7 +952,7 @@ describe("evaluateCodexCredentialReadiness", () => {
|
|||
const alpha = await fs.readFile(path.join(alphaHome, "config.toml"), "utf8");
|
||||
const zero = await fs.readFile(path.join(zeroHome, "config.toml"), "utf8");
|
||||
expect(alpha).toContain('[mcp_servers."alpha"]');
|
||||
expect(alpha).toContain('Authorization = "Bearer alpha-token"');
|
||||
expect(alpha).toContain('http_headers = { Authorization = "Bearer alpha-token" }');
|
||||
expect(zero).not.toContain("mcp_servers.");
|
||||
expect(zero).not.toContain("stale-token");
|
||||
expect(alphaHome).not.toBe(zeroHome);
|
||||
|
|
@ -1083,7 +1083,7 @@ describe("stageCodexHomeForSync", () => {
|
|||
// and is persisted 0600 on disk.
|
||||
await fs.writeFile(
|
||||
path.join(home, "config.toml"),
|
||||
"[mcp_servers.paperclip]\nheaders = { Authorization = \"Bearer secret-token\" }\n",
|
||||
"[mcp_servers.paperclip]\nhttp_headers = { Authorization = \"Bearer secret-token\" }\n",
|
||||
{ mode: 0o600 },
|
||||
);
|
||||
staged = await stageCodexHomeForSync(home, { runId: "run-toml-mode" });
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ function buildManagedMcpBlock(input: {
|
|||
"",
|
||||
`[mcp_servers.${tomlString(managedName)}]`,
|
||||
`url = ${tomlString(url)}`,
|
||||
`headers = { Authorization = ${tomlString(`Bearer ${gateway.bearerToken}`)} }`,
|
||||
`http_headers = { Authorization = ${tomlString(`Bearer ${gateway.bearerToken}`)} }`,
|
||||
);
|
||||
});
|
||||
lines.push(MANAGED_MCP_BLOCK_END);
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ describe("codex execute", () => {
|
|||
expect(configText).toContain("[mcp_servers.github]");
|
||||
expect(configText).toContain("[mcp_servers.\"paperclip-github\"]");
|
||||
expect(configText).toContain('url = "http://paperclip.local:3100/api/tool-gateway/gateways/gateway-1/mcp"');
|
||||
expect(configText).toContain('Authorization = "Bearer pcgw_secret-managed-token"');
|
||||
expect(configText).toContain('http_headers = { Authorization = "Bearer pcgw_secret-managed-token" }');
|
||||
expect(logs).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
|
|
|
|||
Loading…
Reference in New Issue