The basics of the Beatles story are a matter of public record — cynical John meets happy-go-lucky Paul, then George and, later, Ringo; they join a group that cranks out song after song for an all too brief period, then the world's greatest hit-making machine explodes in a welter of personal and business squabbles. And yet, as Adam Gopnik pointed out in a 2016 New Yorker article, "something mysterious remains, and that mysterious thing, as always in the lives of artists, is how they did what they did."

Till now. With the publication of "The Lyrics: 1956 to the Present," a massive two-volume collection of every lyric Paul McCartney ever wrote during his Beatles days and after, at last we know where the songs (at least the ones he wrote or co-wrote) came from. Or let's say we know as much as we ever will: McCartney's comments on each of these 154 songs that he wrote either himself or with a partner like John Lennon or, later, Linda McCartney, are generous, but they're also conversational, meaning they are intimate yet incomplete.

Reading "The Lyrics" is like standing in a master chef's kitchen as he prepares a dish, adding a dash of this and a spoonful of that and talking to us so winningly that we don't realize till later that he has withheld an ingredient, one that, because he was so deeply engaged himself, he didn't know he was withholding.

But here is what he does tell us. First, he owes it all to Black artists. "When you get right down to it," says McCartney, "in everything I've ever done — in the Beatles, Wings, solo — there's an undercurrent of Black music. You could say it's the blues, but it could be soul." Even the white performers the early Beatles based themselves on, a group that includes Elvis, Buddy Holly and Jerry Lee Lewis, were all influenced by Black musicians like Chuck Berry and Little Richard, so "that's definitely the underpinning of almost everything I've done."

Next, work with — and steal from — good people. Their late-career bitter clashes notwithstanding, Paul makes it clear how much sheer fun it was to write with John. But he also credits classically trained producer George Martin, his jazz trumpeter father, Jim, and his high school lit teacher Alan Durband as influences. As far as musical theft goes, McCartney points out that the Beatles stole the Beach Boys' vocal harmonies but that "of course, they were nicking from us. Everybody was nicking from everybody else. There was a circularity to the whole enterprise."

That said, be your own person. Jim McCartney's knowledge of music-hall standards shaped the whole "Sgt. Pepper" album and many more Beatles songs, but when he complained about Americanisms creeping into the queen's English and suggested the lads use the word "yes" in the refrain of "She Loves You," the four musicians stuck to their guns, and the result was their biggest-selling single in the United Kingdom. (Can you imagine singing along to a song that begins "She loves you / Yes, yes, yes"?)

But no matter how inventive you become, stay grounded in the real world. Use ordinary language: "She loves you," for example. "I like to use common phrases and put them in some kind of context where they sound uncommon," says McCartney, adding "I think a lot of creative people do that." After all, the idea was "to get more and more people to like us," he says. That's why so many of the early songs have personal pronouns in the titles: "Love Me Do," "Please Please Me," "I Want to Hold Your Hand," and "From Me to You," about which he notes that "we managed to get two of them in on that one!"

"The Lyrics," edited and introduced by poet Paul Muldoon, is not the first book of its kind and certainly not the first to delve into the band's history and lyrics. There's also, for instance, "All the Songs: The Story Behind Every Beatles Release" (2014), a hefty compilation by music historians Jean-Michel Guesdon and Philippe Margotin, who comment in detail on each album and single in chronological order, making it the best choice for fans who want to follow the whole band's development. Most of the 213 songs in "All the Songs" were written by the songwriting team of Lennon and McCartney, though some are attributed to George Harrison and Ringo Starr while others are covers of hits by other artists, such as Little Richard's "Long Tall Sally." What's missing, of course, is McCartney's voice, his charm, and his this-is-what-happened-in-the-studio-that-day viewpoint.

Both books are richly illustrated, though "The Lyrics" is able to cram in much more — show posters, set lists, handwritten notes, group photos both staged and casual. And while "All the Songs" may contain more facts, there's nothing like listening to Macca (as McCartney was known in his Liverpool days) talk about the rise of a band composed largely of working-class teens who changed the world forever. "There's a certain joy ... in poverty," he says as he reflects on his younger self, "because you've got nothing, and starting from there creates all kinds of interesting scenarios."

Almost 60 years later, it's still an amazing story. McCartney's comment here on "All My Loving" begins with the four on a bus tour with Roy Orbison and other musicians and ends with the band's appearance on "The Ed Sullivan Show" on Feb. 9, 1964, an event said to be watched by 73 million people, including some you might not expect: "The story goes that the crime rate went down, too; even the robbers were tuning in." The Beatles had conquered America, claiming all five of the top slots on the Billboard charts in a matter of days. And the last sentence of this chapter reads, "A few months later I turned twenty-two."

Other rock gods such as Bruce Springsteen and Eric Clapton wrote memoirs at much younger ages, but McCartney was always too busy touring or, well, writing songs — "the time has never been right," he says in the foreword. Happily, other heads prevailed, and over a five-year period, Muldoon interviewed him for hours and coaxed out these charming commentaries.

As to the mystery of how he did it, maybe it isn't that mysterious. Maybe the recipe is to work with (and don't forget to steal from) the best people and then just put in the hours. It's not as though the songs wrote themselves, but after a while, they flow so smoothly out of Chef Paul's kitchen that it almost seems that way.

David Kirby is the author of "Little Richard: The Birth of Rock 'n' Roll."

The Lyrics: 1956 to the Present

By Paul McCartney, ed. Paul Muldoon

Liveright, 960 pages in two volumes, $79.99