The Matthew 7 passage shows that works without faith will not save you. These are people relying on their works, not their faith.
As for James 2, the questions is do works follow faith, or is it faith + works? c.f. Ephesians 2:8-10. James and Paul are not in opposition, rather they stand back-to-back to antinomians and legalists.
Forgot to ping you.
But the tax collector, standing far off, would not even lift up his eyes to heaven, but beat his breast, saying, God, be merciful to me, a sinner! I tell you, this man went down to his house justified, rather than the other. For everyone who exalts himself will be humbled, but the one who humbles himself will be exalted.
John 6:29 Jesus answered them, This is the work of God, that you believe in him whom he has sent.
These are people relying on their works, not their faith.
And you are right, James and Paul had no disagreement as Paul was talking about the works of the law and James was talking about the works of faith, however Paul is hard for most people to understand.