TestCodexEngineHttpMCPServerRendered verifies that HTTP MCP servers are properly rendered in TOML format for Codex
(t *testing.T)
| 940 | // TestCodexEngineHttpMCPServerRendered verifies that HTTP MCP servers |
| 941 | // are properly rendered in TOML format for Codex |
| 942 | func TestCodexEngineHttpMCPServerRendered(t *testing.T) { |
| 943 | engine := NewCodexEngine() |
| 944 | |
| 945 | tests := []struct { |
| 946 | name string |
| 947 | tools map[string]any |
| 948 | mcpTools []string |
| 949 | shouldContain []string |
| 950 | }{ |
| 951 | { |
| 952 | name: "HTTP MCP server should be rendered with url", |
| 953 | tools: map[string]any{ |
| 954 | "gh-aw": map[string]any{ |
| 955 | "type": "http", |
| 956 | "url": "http://localhost:8765", |
| 957 | }, |
| 958 | }, |
| 959 | mcpTools: []string{"gh-aw"}, |
| 960 | // localhost URLs are rewritten to host.docker.internal when firewall is enabled (default) |
| 961 | shouldContain: []string{ |
| 962 | "[mcp_servers.gh-aw]", |
| 963 | "url = \"http://host.docker.internal:8765\"", |
| 964 | }, |
| 965 | }, |
| 966 | { |
| 967 | name: "HTTP MCP server inferred from url field", |
| 968 | tools: map[string]any{ |
| 969 | "my-http-server": map[string]any{ |
| 970 | "url": "https://api.example.com/mcp", |
| 971 | }, |
| 972 | }, |
| 973 | mcpTools: []string{"my-http-server"}, |
| 974 | shouldContain: []string{ |
| 975 | "[mcp_servers.my-http-server]", |
| 976 | "url = \"https://api.example.com/mcp\"", |
| 977 | }, |
| 978 | }, |
| 979 | { |
| 980 | name: "HTTP MCP server with headers", |
| 981 | tools: map[string]any{ |
| 982 | "api-server": map[string]any{ |
| 983 | "type": "http", |
| 984 | "url": "https://api.example.com/mcp", |
| 985 | "headers": map[string]any{ |
| 986 | "Authorization": "Bearer token123", |
| 987 | "X-Custom": "value", |
| 988 | }, |
| 989 | }, |
| 990 | }, |
| 991 | mcpTools: []string{"api-server"}, |
| 992 | shouldContain: []string{ |
| 993 | "[mcp_servers.api-server]", |
| 994 | "url = \"https://api.example.com/mcp\"", |
| 995 | "http_headers = {", |
| 996 | "\"Authorization\" = \"Bearer token123\"", |
| 997 | "\"X-Custom\" = \"value\"", |
| 998 | }, |
| 999 | }, |
nothing calls this directly
no test coverage detected