Refactor pipeline policies, MCP registry, and unified config/runtime

This commit is contained in:
2026-02-23 13:56:45 -05:00
parent 889087daa1
commit 9b4216dda9
22 changed files with 1441 additions and 587 deletions

View File

@@ -2,6 +2,7 @@ import test from "node:test";
import assert from "node:assert/strict";
import {
inferTransport,
normalizeSharedMcpServer,
toClaudeServerConfig,
toCodexServerConfig,
} from "../src/mcp/converters.js";
@@ -41,6 +42,42 @@ test("maps shared headers to codex http_headers", () => {
});
});
test("normalizes header aliases into a single headers object", () => {
const normalized = normalizeSharedMcpServer({
url: "http://localhost:3000/mcp",
http_headers: {
"X-Source": "legacy",
},
headers: {
Authorization: "Bearer token",
},
});
assert.deepEqual(normalized.headers, {
"X-Source": "legacy",
Authorization: "Bearer token",
});
assert.equal("http_headers" in normalized, false);
});
test("maps legacy http_headers alias for claude conversion", () => {
const claudeConfig = toClaudeServerConfig("legacy-http-headers", {
type: "http",
url: "http://localhost:3000/mcp",
http_headers: {
Authorization: "Bearer token",
},
});
assert.deepEqual(claudeConfig, {
type: "http",
url: "http://localhost:3000/mcp",
headers: {
Authorization: "Bearer token",
},
});
});
test("throws for claude http server without url", () => {
assert.throws(
() => toClaudeServerConfig("bad-http", { type: "http" }),