generateMCPCLIMountStep generates the "Mount MCP servers as CLIs" workflow step. This step runs after the MCP gateway is started and creates executable CLI wrapper scripts for each MCP server in a read-only directory on $PATH.
(yaml *strings.Builder, data *WorkflowData)
| 261 | // This step runs after the MCP gateway is started and creates executable CLI wrapper |
| 262 | // scripts for each MCP server in a read-only directory on $PATH. |
| 263 | func (c *Compiler) generateMCPCLIMountStep(yaml *strings.Builder, data *WorkflowData) { |
| 264 | servers := getMCPCLIServerNames(data) |
| 265 | if len(servers) == 0 { |
| 266 | return |
| 267 | } |
| 268 | mcpCLIMountLog.Printf("Generating MCP CLI mount step for %d servers: %v", len(servers), servers) |
| 269 | |
| 270 | yaml.WriteString(" - name: Mount MCP servers as CLIs\n") |
| 271 | yaml.WriteString(" id: mount-mcp-clis\n") |
| 272 | yaml.WriteString(" continue-on-error: true\n") |
| 273 | yaml.WriteString(" env:\n") |
| 274 | yaml.WriteString(" MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}\n") |
| 275 | yaml.WriteString(" MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }}\n") |
| 276 | yaml.WriteString(" MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}\n") |
| 277 | fmt.Fprintf(yaml, " uses: %s\n", getActionPin("actions/github-script")) |
| 278 | yaml.WriteString(" with:\n") |
| 279 | yaml.WriteString(" script: |\n") |
| 280 | yaml.WriteString(" const { setupGlobals } = require('" + SetupActionDestination + "/setup_globals.cjs');\n") |
| 281 | yaml.WriteString(" setupGlobals(core, github, context, exec, io);\n") |
| 282 | yaml.WriteString(" const { main } = require('" + SetupActionDestination + "/mount_mcp_as_cli.cjs');\n") |
| 283 | yaml.WriteString(" await main();\n") |
| 284 | } |
| 285 | |
| 286 | // GetMCPCLIPathSetup returns a shell command that adds the MCP CLI bin directory |
| 287 | // to PATH inside the AWF container. This ensures CLI-mounted MCP servers are |
no test coverage detected