No they do not.
D&D 5e is a game where things only do what the rules covering them say they do. Magic items each have their own description and they only do what that description specifically says, nothing more, unless there is another general rule somewhere covering their use.
DMG p.213:
WEAPON, +1, +2, OR +3
Weapon (any), uncommon (+1), rare (+2), or very rare (+3)
You have a bonus to attack and damage rolls made with this magic weapon. The bonus is determined by the weapon's rarity.
So a longsword +1 grants a +1 bonus to attack and damage rolls, that's all. There is no rule anywhere else in the game that says anything like "The attack and damage bonus for a magic item will also apply to spell attacks and spell damage if the item can be used as a casting focus".
If there is still any confusion as to whether "bonus to attack and damage" includes spell attack and spell damage rolls we can look at other items that specifically state that this is the case:
DMG p.203
STAFF OF THE MAGI
Staff, legendary (requires attunement by a sorcerer, warlock, or wizard) This staff can be wielded as a magic quarterstaff that grants a +2 bonus to attack and damage rolls made with it. While you hold it, you gain a +2 bonus to spell attack rolls.
As you can see it clearly differentiates between can be wielded as a magic quarterstaff that grants a +2 bonus to attack and damage rolls and you gain a +2 bonus to spell attack rolls in the description. If the +2 bonus to attack and damage rolls applied to spell attack rolls the description would not have included the specific rule about spell attack rolls.
This is also the case for other magic items. For instance magic shields where the bonus only applies to AC, not to anything else:
DMG p.200:
SHIELD, +1, +2, OR +3
Armor (shield), uncommon (+1), rare (+2), or very rare (+3)
While holding this shield, you have a bonus to AC determined by the shield's rarity. This bonus is in addition to the shield's normal bonus to AC.
Even if it has a cleric's holy symbol emblazoned on it and is used as a Holy Symbol to cast spells the bonus only applies to what it says it does, to AC.
In case it is thought that this is not a deliberate and thought out rule/description for the Staff of the Magi, other items follow the same pattern. The Staff of the Woodlands, for instance, also specifically states that it has a +2 bonus to spell attack rolls in addition to the +2 bonus to attack and damage when wielded as a magic quarterstaff:
DMG p.204
STAFF OF THE WOODLANDS
Staff, rare (requires attunement by a druid)
This staff can be wielded as a magic quarterstaff that grants a +2 bonus to attack and damage rolls made with it. While holding it, you have a +2 bonus to spell attack rolls.
The Rod of the Pact Keeper goes the other way:
DMG p.197
ROD OF THE PACT KEEPER
While holding this rod, you gain a bonus to spell attack roils and to the saving throw DCs of your warlock spells.
It does not add to attack or damage rolls when used as a club, as it does not say it does. In fact, RAW, it is not a magic weapon at all, e.g. for the case where it is used against creatures with resistance to non-magical weapon's damage.