A key feature of wireless sensor networks (WSNs) is the collaborative processing, where the correlation existing over the local data of sensor nodes (SNs) is exploited so that the total data volume can be reduced (data aggregation). The use of Mobile Agents (MAs), i.e., software entities able of migrating among nodes and resuming execution naturally, fits in this scenario; the local data of an SN can be combined with the data collected by an MA from other SNs in a way that depends on the specific program code of the MA. In this paper, we consider the problem of calculating near-optimal routes for MAs that incrementally aggregate the data as they visit the nodes in a distributed sensor network. Our algorithm follows a greedy-like approach always selecting the next node to be included in an itinerary in such a way that the cost of the so far formed itineraries is kept minimum at each step. Simulation results confirm the high effectiveness of the proposed algorithm as well as its performance gain over alternative approaches. Also, with the use of proper data structures, the computational complexity of the algorithm is kept low as it is formally proved in the paper.