(toolName string, mcpConfig map[string]any, config *RegistryMCPServerConfig)
| 539 | } |
| 540 | |
| 541 | func configureMCPStdioCommand(toolName string, mcpConfig map[string]any, config *RegistryMCPServerConfig) error { |
| 542 | command, hasCommand := mcpConfig["command"] |
| 543 | if !hasCommand { |
| 544 | return fmt.Errorf( |
| 545 | "stdio MCP tool '%s' must specify either 'command' or 'container' field. Cannot specify both. "+ |
| 546 | "Example with command:\n"+ |
| 547 | "mcp-servers:\n"+ |
| 548 | " %s:\n"+ |
| 549 | " command: \"npx @my/tool\"\n"+ |
| 550 | " args: [\"--port\", \"3000\"]\n\n"+ |
| 551 | "Example with container:\n"+ |
| 552 | "mcp-servers:\n"+ |
| 553 | " %s:\n"+ |
| 554 | " container: \"myorg/my-tool:latest\"\n"+ |
| 555 | " env:\n"+ |
| 556 | " API_KEY: \"${{ secrets.API_KEY }}\"", |
| 557 | toolName, toolName, toolName, |
| 558 | ) |
| 559 | } |
| 560 | commandStr, ok := command.(string) |
| 561 | if !ok { |
| 562 | return fmt.Errorf("command field must be a string, got %T. Example:\nmcp-servers:\n %s:\n command: \"npx @my/tool\"\n args: [\"--port\", \"3000\"]", command, toolName) |
| 563 | } |
| 564 | config.Command = commandStr |
| 565 | appendBuiltinArgs(config, mcpConfig["args"]) |
| 566 | return nil |
| 567 | } |
| 568 | |
| 569 | func appendContainerEnv(config *RegistryMCPServerConfig, envValue any) { |
| 570 | envMap, ok := envValue.(map[string]any) |
no test coverage detected