Leibniz regards all spirits or minds as monads, each of which is distinct from the others, none of which actually interact, and each of which nonetheless runs in a pre-established harmony with all the others because each monad contains within itself all the truths about its relations to every other monad. Every monad, as Leibniz puts it, expresses God and the universe. Minds are not the only monads, in Leibniz's view; but they are the monads that are most clearly expressive of God and the universe, such that each mind-monad can be considered the image of God, vastly more valuable than anything else. All of these mind-monads are organized by their harmony with God into a moral realm, a City of God, a kingdom of grace. Within this kingdom of grace each monad acts with freedom; these expressions of freedom, however, are found in a harmony that has existed from all eternity due to God's selecting out from all possible world-lines that one that allows the greatest happiness of each that is consistent with the greatest harmony of all.
Kant builds on this in his account of the kingdom of ends. Each person or rational being is an end, capable of legislating himself under moral law; this moral law each person has in himself as a precondition of his very rationality. Because of this it is possible to think of all people together as being a unified whole, a systematic union of ends operating under a common moral law. Each person, however, operates with a sort of sovereign autonomy. Kant clearly links this to the Leibnizian City of God in the Mrongovius lecture notes from 1785 (29:610-611):
Man must regard himself as a legislating member of the kingdom of ends, or of rational beings. Leibnitz also calls the kingdom of ends moral principles of the kingdom of grace.
Thus we can think of Kant's kingdom of ends as a sort of ethical monadology, and the Kantian person as an autonomous legislator analogous to a Leibnizian monad.
This is all quite deliberate on Kant's part: as is often the case with Kantian philosophy, a great deal of the motive behind this appropriation is to capture what Kant likes in Wolff's mix of Leibniz and scholasticism, but also to de-fang it, to tear down its pretensions. We see this here. For despite the fact that Kant is appropriating Leibniz's monadic kingdom of grace, he is in a sense not affirming it. This is a very common tactic Kant uses against rationalism: what the rationalist takes categorically, Kant takes hypothetically. And in the process of outlining the kingdom of ends in his Groundwork, he takes the trouble to make the parenthetical comment that the kingdom of ends is "surely only an ideal." In this brief parenthetical aside is all the difference between Kant and Leibniz on this point. Leibniz's City of God is not an ideal; it is put forward as the way that God has really arranged the moral world. But Kant's kingdom of ends describes nothing real: it is merely an ideal we will as best we may, and a sort of analogy by which we understand the categorical imperative at the root of practical reason.