Skip to content

feat(mcp): add campaign MCP tools - #44

Merged
anujeet98 merged 1 commit into
mainfrom
feat/mcp-campaigns-tools
Sep 16, 2026
Merged

anujeet98 merged 1 commit into
mainfrom
feat/mcp-campaigns-tools

Conversation

@Rishavraaj

Copy link
Copy Markdown
Member

Summary

  • Adds MCP tools for campaign records: list_campaigns, get_campaign, create_campaign
  • Wires campaigns:read/campaigns:write OAuth scopes for MCP clients

Scope decision

Zuko's "campaign" is really an Apollo outreach sequence, and ApolloSequencesController/ApolloSequencesService cover 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 ApolloCampaignsController already exposes over REST, plus the metadata-only create):

  • list_campaignsgetAllCampaigns / getCampaignsByIcpProfile
  • get_campaigngetZukoCampaignById
  • create_campaigncreateCampaignMeta (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)

  • Added the three tools, scoped to the caller's organizations and gated by campaigns:read/campaigns:write
  • Extended McpDeps with campaigns: ApolloSequencesService

Wiring

  • integrations.module.ts: exports ApolloSequencesService (was previously only provided internally)
  • mcp.module.ts: imports IntegrationsModule
  • mcp.controller.ts: injects ApolloSequencesService, passes it into buildMcpServer
  • better-auth/auth.ts: adds campaigns:read/campaigns:write to MCP_SCOPES

Tests & docs

  • mcp-write-tools.spec.ts: 10 new tests covering all 3 tools
  • docs/concepts/mcp-server.mdx: scopes table rows + tool reference section

Test plan

  • bun fmt clean
  • tsc --noEmit clean
  • vitest run mcp-write-tools.spec.ts — 86/86 passing (76 existing + 10 new)
  • CI

🤖 Generated with Claude Code

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
anujeet98 merged commit 589aa11 into main Sep 16, 2026
1 check passed
@anujeet98
anujeet98 deleted the feat/mcp-campaigns-tools branch September 16, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants