The Node menu module provides an API for this. You can read the documentation (Doxygen) in code. I think the necessary functionality is provided by the method menu_node_get_links($nid, $router = FALSE):
An associative array is returned mlid => menu object. You probably only need the first one to look something like this:
$arr = menu_node_get_links(123);
list($mlid) = array_keys($arr);
Drupal:
node/[nid] $path :
function _get_mlid($path) {
$mlid = null;
$tree = menu_tree_all_data('primary-links');
foreach($tree as $item) {
if ($item['link']['link_path'] == $path) {
$mlid = $item['link']['mlid'];
break;
}
}
return $mlid;
}