The CLI tool allows you to provide a JSON file supplying the config within the command
https://docs.anthropic.com/en/docs/claude-code/sdk#mcp-configuration
claude -p 'yo' --mcp-config mcp-servers.json
However, this SDK builds and supplies the entire mcp config via the command line directly, including any auth keys that need to be there:
claude -p 'yo' --mcp-config '{"mcpServers": {"github": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": {"GITHUB_TOKEN": "Your super secret token"}}}}'
I know you are currently not including the generated command in the debug output, but I think you should as it greatly helps with understanding errors. But having mcp-config json in the command makes this not possible without exposing tokens.