Israel's confession of YHWH as Lord and God supplies the broad monotheistic background for the titles.
Deuteronomy 6:4; Psalm 35:23 provide useful background.
The grammar explicitly presents Thomas as answering Jesus. Jesus does not correct the address but describes Thomas as having believed.
This is one of the clearest direct identifications of Jesus as God in the New Testament and forms a literary inclusio with John 1:1.
Thomas says to Jesus, 'My Lord and my God.'