A cat’s claws are not fingernails, they are attached and protrude from the end of the bone. Most cats have five clawed digits on each of their front paws and four on each of their rear paws. Their claws are tools and are used by the cat for climbing, scratching, catching prey and defense. There is a sheath that can grow over the claw inhibiting their effectiveness and so cats regularly try to remove that sheath by scratching their claws against a rough surface. It is part of their regular grooming to keep their claws sharp.
If your sofa is the only available surface for them to scratch their claws, then that is where they will scratch.
Some owners think that the best remedy is to have their cats declawed. That is seen by most veterinarians as a drastic as well as an unnecessary and potentially harmful procedure. Declawing removes muscle, ligaments and bone in addition to the claw and may negatively impact your cat’s behavior and psyche. Common thought is that it’s overkill for a misbehavior that can be redirected with proper training.
Your cat needs their claws, not only for the uses mentioned above, but because cats are digitigrade which mean they walk on their toes. (Humans are plantigrade and we walk on the soles of our feet.) Removing their claws will distort their equilibrium and they may have trouble keeping their balance. They surely will have difficulties in doing many of the things cats enjoy like jumping and climbing.
Just remember, a cats clawing at carpets or furniture is a natural behavior and part of their grooming, so don’t punish them for doing something that comes naturally, redirect them to an acceptable outlet for the behavior.