\startluacode
function userdata.my_command(keywords, text)
	commands.writestatus("test", string.format("text: %s, config: %s", text, keywords))
    local cfg = utilities.parsers.settings_to_hash(keywords)

	if cfg['emph'] ~= nil then
		context("\\emph{" .. text .. "}")
	elseif cfg['bold'] ~= nil then
		context("\\bold{" .. text .. "}")
	else
		context(text)
	end
end
\stopluacode

% without that line there is no problem
\setupinteraction[state=start]

\defineenumeration[enu][text=Enu]

\unprotect
\def\mc{\dosingleempty\do_my_command}
\def\do_my_command[#1]#2{%
 	\iffirstargument{%
		\ctxlua{userdata.my_command('#1', [==[#2]==])}%
	}\else {%
		\ctxlua{userdata.my_command('', [==[#2]==])}%
	}\fi
}
\protect

\starttext

% all the following works
\mc{foo} \mc[bold]{foo} \mc[emph]{foo}

\startenu[title=Some]
\stopenu

% this breaks
\startenu[title=Some \mc{foo}]
\stopenu

\stoptext
