I live in Ottawa Ontario, and i used my mtb for about 4 months last summer in the city with no issues. I live right downtown, and i work at the Ottawa courthouse
I rode that thing to work every day all summer, and it's been parked in an underground cop garage under the courthouse all winter. Never had any problems.
Be realistic; if you're riding safely and not out of control, they won't even notice as they drive by. Certainly i've been passed by plenty of cop cars while riding hard on the side of the road, and it always make your heart jump, but most of the time, most cops have better things to do. You think they'd show in court to back up the 5k$ fine they gave that kid on the mtb? No. And no judge would fine you that much. More then likely, if you got pulled over, just promise to take it home and not ride it and i bet you'd be fine. If you somehow got ticketed for the full fine, the crown would settle for much less out of court as long as you pretended to be remorseful, ignorant and cooperated with them.
Some simple things you can do to not get caught (in my experience);
-grab some 2 stroke ceramic paint and spray your engine the same color as the frame. At a glance from a distance it could be shocks or something else in the frame. My bike is black, so the all black look blends the engine nicely with the bike. It looks like it's suppose to be there.
-grab a rear mounted gas tank, or build a rack to mount the teardrop one on. It's easy to bolt it on the top bar, but just moving that makes the whole bike look a lot less like a mtb.
-disable your idle. If you're not making a cloud of oily smoke and a huge 2 stroke racket at every red light right next to immobile cars with open windows, you'll stay more on the downlow. It also forces you to pedal start every time as lights turn green, arguably the most dangerous mtb moment on the roads, because cars never expect you to accelerate like we can. Pedaling means those first two cars pass you as you go through the intersection and you're all ready accelerating past them safely a few seconds behind. The third car in the row is behind you, and was the whole time you sat at the intersection, so they can see you accelerate and you run no risk of being crushed into the sidewalk by a car not expecting you to be on their right quite to fast.
-be observant. I'm VERY observant when i ride my bike; i'm all too aware of both the number of cops in ottawa and the seriousness of the injuries i could inflict on someone if i was careless. Running into someone is just not an option; being hit by a car, again not really an option. I've been run over twice on my non mtb, and i can tell you it's no fun, and even though both times it was 100% the cars fault, i could probably have avoided the accidents if id been more observant then. Don't assume drivers are competent. They aren't.
-DONT GO FASTER THEN CARS.
I'm planning another summer of fun with my mtb in the middle of Ottawa, and i'm truly not worried about police. The worst thing that will happen, imho, is i'll use up my get out of jail free card with this. If i was caught, ticketed and let off, i'd probably hesitate to ride quite as much, but since i have no priors, and i know **** like this gets dissmissed from the court house every day because, low and behold, while legislation might be lobbyable, judges really aren't out to do injustice. I might just try to be more subtle if i had this in my record though.