It is widely believed that future applications within the scientific and business communities would not be developed from scratch but assembled on the fly by reusing existing atomic services available in a grid ecosystem. This is premised on the fact that both domains have adopted the Service Oriented Computing (SOC) paradigm for developing its applications. However, providing key support components through a middleware infrastructure is vital to realizing the visionary promise of SOC Whereas the need for middleware support in SOC is clearly evident, current middleware approaches and solutions fall short because they do not sufficiently address dynamic composition of services in dynamic and open environments. In this paper, we present MINDS, an agent-based middleware infrastructure for dynamic composition of distributed (Grid/Web) services. We discuss the design and implementation of MINDS and compare it with some existing systems. We conclude that MINDS is particularly suitable for distributed services with capabilities of autonomy, flexibility, maintainability, reliability and robustness