You are right that keeping the mouse inside is not hygienic: they poop everywhere, almost continually. As mentionned in comments, there are "different approaches for different vegans" (@Erica). Vegans and other people are not "allowed" this or that, they decide for themselves. Instead of asking if vegans are allowed to do this, you should ask:
Do I allow myself to kill a mouse in my house?
Veganism should be cruelty free, not harming animals as much as possible. For exemple you could kick a dog that attacks you even if you are vegan, but you wouldn't be resentful and hurt it more than necessary.
You should try to find what is your ethical standpoint about this mouse. See this quote from another question on another stackexchange site, it might resonate with you :
First is the truth that being a nuisance is a far lesser evil than
murder in cold-blood... the mouse has the moral higher ground over the
mouse-trapper.
Second is the truth that you don't want to be murdered yourself;
knowing this, how can you contemplate it for a fellow being?
source: https://buddhism.stackexchange.com/questions/10465/how-not-to-kill-the-mouse-in-my-house
A mouse might enter a house in search of: heat, dryness, food, comfort.
If you decide that you don't allow yourself to kill the mouse:
There are easy cruelty-free ways to get rid of a mouse or a beetle. For an insect, simply pick it up and put it outside. For a mouse you will need a harmless trap that locks her in a box, and then bring it out to release in a forest many kilometers away from your home. I did that myself, caught 2 mice and released them. Didn't get any new ones since. If they would come back I should take interest in where are they entering from and make sure to close these holes. Killing or putting poison around the house doesn't really address the source of the problem and is a bit "overkill" for me, I suspect people just get satisfaction from doing violence to a creature that annoys or scares them greatly.
Knowing that the alternative is possible, then how can you justify killing it when it's not absolutely necessary ?
Veganism is about respecting live animals and their right to live a free life. And showing compassion to them. Putting yourself in the shoes of the mouse. It can be more than just deciding what you put in your plate.
Do what you can, do the best that you can.
By the way, avoid touching the mouse with your hands, they will bite you if cornered, and they can indeed carry some disease or infectious something. If you trap a live mouse in a box, you will have the chance to observe her alive from a short distance, they have beautiful, big black eyes and they are fluffy, quite cute things they are. I think rats might be more ugly and grumpy but they are still decent fellas. :p
Notes on insects:
Insects multiply and coexist in very large numbers, and they are eaten/killed/expended very fast in very large numbers too. They might (speculation) not be very sentient either, some vegans might decide they are allowed to eat insect protein. So, for some, to slap a mosquito that is biting you, or a fly that entered your house doesn't make them feel bad at all, insect life is short. Poisoning a whole area or ecosystem is different. That being said, killing the mosquito while it is draining you might not be the best way to prevent a scratchy bump, I heard it's actually better to let it finish and go away.
Humans have a good chance to drive mammals, birds or fishes to extinction, but insects, not so easily.
Ants in the house might be an interesting topic too. In this case, killing the ants themselves will do almost nothing, more will come. The real trick is to stop leaving foods and crumbs in the house. Or if you want to keep your crumbs, then you can have a house full of crumbs and ant-poison, here we see again that killing is not the efficient or smart way to resolve.
A few spiders or silverfishes in a house shouldn't be a concern, you can let them live.
About killing and violence:
Killing and violence is usually fear-driven or panic-driven: punch it until it doesn't move. You can imagine someone wanting to "burn their whole house" because of scary ants or scary mice. Or when someone sees a spider and screams "Kill it, kill it !!!" That's because violence, on the short term, gets sh*t done, solves the scary problem, immediatly, for sure. At leat it's the impression that it gives. But like we see with killing the ants on the floor, it only gives the satisfaction or seeing one problem (one ant) getting instantly solved, while the underlying issue is still present.
Also, to be afraid of something so much smaller than you, that doesn't want to harm you at all, is a bit pathetic and shows how much humans live in a disinfected bubble of illusions and reassuring beliefs about hygiene and germs. Instead of admitting they are scared, people will say that the animals are "disgusting" or "dirty" or "carry diseases", and might label them with negative-connotation words like "pest". Oh it's a pest, therefore it's normalized to kill it, pests should be killed. Same happens with some plants that are labeled maybe "weeds". In french they would be "mauvaises herbes", literally bad herbs, just to justify their extermination with the choice of words.