Sharply observed and cleverly executed, writer-director Paul Feig’s espionage satire “Spy” (Fox) boasts a large potential for fun.

Yet the abundant entertainment that might be hoped for from his genre-ribbing comedy is ultimately squelched by an excess of crude material and vulgar dialogue.

Blinkered by vanity, elegant James Bond-like CIA field operative Bradley Fine (Jude Law) fails to realize that he owes the better part of his success to the remote, high-tech support he receives from his desk-bound partner back at headquarters, Susan Cooper (Melissa McCarthy).

Bradley’s shallow assumptions also blind him to the fact that awkward, self-effacing Susan’s devotion to him is more than merely professional.

Susan’s heartfelt dedication is put to the test when Fine becomes a casualty in the agency’s effort to bring down Rayna Boyanov (Rose Byrne), the ruthless heir of an international crime dynasty. Determined to avenge her beloved idol, Susan convinces her prickly boss, Elaine Crocker (Allison Janney), to let her leave headquarters and go undercover. Though ostensibly her mission is merely to track Rayna, Susan’s real goal is to nab the evildoer.

Masked by a series of uniformly embarrassing disguises, Susan pursues outrageously spoiled, wildly cynical Rayna from one elegant European venue to the next.

Along the way, she’s aided, albeit ineptly, by her goodhearted officemate and best friend Nancy (Miranda Hart). But the relentless, disdain-driven interference of another colleague, macho lunkhead Rick Ford (Jason Statham), threatens to derail Susan’s risky project at every turn.

“Spy” deploys a blend of orneriness and sensitivity to satisfying effect. Yet, along with a level of bloodletting wholly unjustified by the comic context, the childish urge to shock undermines the script’s more respectable humor, tainting the whole endeavor with a stain of sophomoric stupidity.

The film contains intermittent harsh violence with gore, brief obscene images, much sexual and some scatological humor, over a dozen uses of profanity and pervasive rough and crude language. (O, R)