feat(mcp): add campaign MCP tools - #44
Merged
Merged
Conversation
Adds list_campaigns, get_campaign, and create_campaign tools backed by ApolloSequencesService's DB-only methods (getAllCampaigns, getCampaignsByIcpProfile, getZukoCampaignById, createCampaignMeta). Scoped to campaigns:read/campaigns:write. create_campaign only writes the Zuko-side metadata row — building and activating the actual Apollo sequence (createSequence, approve, deactivate, addContactsToSequence, saveSequenceForCampaign) is left out of MCP for now since those call the live Apollo API and warrant their own review before exposing to an agent. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
anujeet98
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list_campaigns,get_campaign,create_campaigncampaigns:read/campaigns:writeOAuth scopes for MCP clientsScope decision
Zuko's "campaign" is really an Apollo outreach sequence, and
ApolloSequencesController/ApolloSequencesServicecover a much bigger surface than plain CRUD: creating/updating/approving/deactivating Apollo sequences, enrolling contacts, and saving sequence steps — all of which call the live Apollo API.This PR only exposes the DB-only, side-effect-free half of that surface (mirrors what
ApolloCampaignsControlleralready exposes over REST, plus the metadata-only create):list_campaigns→getAllCampaigns/getCampaignsByIcpProfileget_campaign→getZukoCampaignByIdcreate_campaign→createCampaignMeta(creates the Zuko row only, no Apollo sequence is created or activated)Left out intentionally:
createSequence,updateSequence,approveSequence,deactivateSequence,addContactsToSequence,saveSequenceForCampaign— these hit Apollo's live API and send real outreach; giving an MCP client that power deserves its own review/confirmation UX rather than riding along with this PR.Changes
MCP server (
apps/backend/src/app/mcp/mcp-server.ts)campaigns:read/campaigns:writeMcpDepswithcampaigns: ApolloSequencesServiceWiring
integrations.module.ts: exportsApolloSequencesService(was previously only provided internally)mcp.module.ts: importsIntegrationsModulemcp.controller.ts: injectsApolloSequencesService, passes it intobuildMcpServerbetter-auth/auth.ts: addscampaigns:read/campaigns:writetoMCP_SCOPESTests & docs
mcp-write-tools.spec.ts: 10 new tests covering all 3 toolsdocs/concepts/mcp-server.mdx: scopes table rows + tool reference sectionTest plan
bun fmtcleantsc --noEmitcleanvitest run mcp-write-tools.spec.ts— 86/86 passing (76 existing + 10 new)🤖 Generated with Claude Code