MCPcopy Create free account
hub / github.com/github/gh-aw / renderStandardJSONMCPConfig

Function renderStandardJSONMCPConfig

pkg/workflow/mcp_renderer_factory.go:116–144  ·  view source on GitHub ↗

renderStandardJSONMCPConfig is a shared helper for JSON MCP config rendering used by Claude, Gemini, Copilot, and Codex engines. It consolidates the repeated sequence of: buildMCPRendererFactory → buildMCPGatewayConfig → buildStandardJSONMCPRenderers → RenderJSONMCPConfig.

(
	yaml *strings.Builder,
	opts renderStandardJSONMCPConfigOptions,
)

Source from the content-addressed store, hash-verified

114// Claude, Gemini, Copilot, and Codex engines. It consolidates the repeated sequence of:
115// buildMCPRendererFactory → buildMCPGatewayConfig → buildStandardJSONMCPRenderers → RenderJSONMCPConfig.
116func renderStandardJSONMCPConfig(
117 yaml *strings.Builder,
118 opts renderStandardJSONMCPConfigOptions,
119) error {
120 tools := opts.tools
121 mcpTools := opts.mcpTools
122 workflowData := opts.workflowData
123 configPath := opts.configPath
124 includeCopilotFields := opts.includeCopilotFields
125 inlineArgs := opts.inlineArgs
126 renderCustom := opts.renderCustom
127 filterTool := opts.filterTool
128 mcpRenderingLog.Printf("Rendering standard JSON MCP config: config_path=%s tools=%d mcp_tools=%d", configPath, len(tools), len(mcpTools))
129 createRenderer := buildMCPRendererFactory(workflowData, "json", includeCopilotFields, inlineArgs)
130
131 // CLI-mounted servers are NOT excluded from the gateway config.
132 // The gateway must start their Docker containers so that:
133 // 1. The CLI manifest (saved by start_mcp_gateway.cjs) includes them.
134 // 2. mount_mcp_as_cli.cjs can query their tool lists and create wrappers.
135 // Exclusion from the agent's final MCP config happens inside each
136 // convert_gateway_config_*.cjs script via GH_AW_MCP_CLI_SERVERS.
137
138 return RenderJSONMCPConfig(yaml, tools, mcpTools, workflowData, JSONMCPConfigOptions{
139 ConfigPath: configPath,
140 GatewayConfig: buildMCPGatewayConfig(workflowData),
141 Renderers: buildStandardJSONMCPRenderers(workflowData, createRenderer, renderCustom),
142 FilterTool: filterTool,
143 })
144}
145
146// buildMCPRendererFactory creates a factory function for MCPConfigRendererUnified instances.
147// The returned function accepts isLast as a parameter and creates a renderer with engine-specific

Callers 3

RenderMCPConfigMethod · 0.85
RenderMCPConfigMethod · 0.85

Calls 5

buildMCPRendererFactoryFunction · 0.85
RenderJSONMCPConfigFunction · 0.85
buildMCPGatewayConfigFunction · 0.85
PrintfMethod · 0.45

Tested by

no test coverage detected