AivexaNewsSearch
AI news for builders and product teamsChecked every hour

How MoEngage turned over 400 APIs into agent tools with AgentCore Gateway

Collected Oct 29, 2026

MoEngage, a customer engagement platform used by more than 1,350 consumer brands across push, email, in-app, SMS, WhatsApp and RCS, has published an account of how it exposed roughly 400 internal REST APIs to AI agents. The APIs are built by 25 engineering teams, run in private VPCs across seven AWS Regions, and are kept regionally isolated to meet data residency commitments with no public internet exposure. The company used AgentCore Gateway, a capability of Amazon Bedrock AgentCore, to convert those APIs into permission-scoped agent tools. MoEngage estimates the approach saved about six months of platform engineering effort, and says onboarding a new API now takes hours rather than days. No product team wrote Model Context Protocol server code, no networking was provisioned per integration, and no public endpoint sits anywhere in the path. The deployment has been running in production for three months.

The rejected alternative was the obvious one: let each team run its own MCP server. MoEngage costed out more than 20 servers and turned it down, citing the burden of monitoring, patching and keeping that many deployments protocol-compatible as MCP evolves. Cross-domain agents that read a campaign, check its segment and inspect delivery stats would have to connect to several servers and reconcile them, and every team would need MCP expertise unrelated to its product work. Instead the company set a rule: engineering teams build REST APIs and declare which operations become tools; the AI Platform team owns the MCP layer end to end. A team's responsibility stops at a well-described OpenAPI spec.

Four constraints had to be satisfied at once. First, nothing gets a public endpoint, which rules out the per-integration habit of a NAT gateway here and a reverse proxy there, multiplied across seven Regions. Second, identity cannot be an agent's decision. Every internal call carries tenant, user, role and database context, and if that were an LLM-visible tool parameter a model could get it wrong or be persuaded to change it. Third, a 400-tool catalog does not fit in a context window: at roughly 50 tokens of JSON schema per tool, a full tools/list across the estate exceeds 20,000 tokens on every connection, spent before the agent does anything useful. Client-side filtering, such as tool_filter in ADK or the MCP SDK, does not solve this because the full catalog has already crossed the wire, and filtering by client convention is not an authorization boundary. The company's reasoning is that an agent not meant to see write operations should never receive them.

The gateway is a fully managed MCP server: teams register OpenAPI specs as targets, and it generates MCP tools and routes calls to the backing services. Each operation becomes a tool named Target___operationId, for example CampaignsAPI___searchCampaigns. When a spec changes, the tool changes with it, with no deployment or coordination with the AI Platform team. Authorization uses Cedar policies evaluated before the catalog is serialized, so the per-principal tools/list response is filtered server-side using partial evaluation. Each agent authenticates as its own IAM role. In the published example, a campaign QA bot is permitted read access to campaign and segment tool groups and explicitly forbidden from write actions, so write tools never appear in its tool listing. This is the piece that makes 400 tools tractable: the reduction happens before the response is built rather than after it arrives.

Connectivity runs inbound through a VPC interface endpoint with private DNS, with no public path, and outbound through AgentCore managed egress over Amazon VPC Lattice to the internal APIs. Adding an API therefore adds a target rather than a network topology change, which is what breaks the multiply-by-seven-Regions problem since the networking exists once and is shared. The gateway also offers semantic search through an x_amz_bedrock_agentcore_search capability, letting an agent find tools by describing a task rather than naming one. That removed the need for a custom discovery layer and softened rename fragility: if get_segment_user_count becomes get_segment_size, matching happens on description rather than identifier, so an agent searching for segment user count still finds it.

In the request flow, an agent service on Amazon EC2 or in a container uses an MCP client — the official MCP SDK, LangChain, Google ADK or MoEngage's own runner — and signs the request with SigV4 using the IAM role it already holds. The request goes over HTTPS to the VPC interface endpoint, the gateway evaluates Cedar policies, then routes the call through managed egress to the internal API. MoEngage chose SigV4 over JWT for this internal surface because the agents are services with existing IAM roles, so there is nothing new to issue, rotate or store. Its separate public MCP server, which serves human-authenticated sessions from Claude and other clients, uses OIDC JWTs on AgentCore runtime. Identity travels as X-MOE-* headers built by the client library from a small Identity object, invisible and unsettable by the model. Because SigV4 occupies the Authorization header, forwarded bearer tokens move to a dedicated MoEngage-prefixed header, and header propagation is capped so the set stays deliberate.

Discovery and execution are separated by identity: listing and searching tools carries no tenant identity, while only tools/call does, which keeps discovery cheap and makes the audit trail unambiguous. Even a Cedar-scoped subset can be large, so the client library exposes a single meta-tool called search_tools. The model describes what it needs, semantic search returns candidates, and only those become callable for the rest of the turn, so context holds one tool definition at the start and a handful after a search instead of several hundred.

Onboarding is handled in the OpenAPI spec through an x-moe-mcp block carrying expose flags, a tool_description and param_overrides. Exposure is explicit opt-in: an endpoint without the block is not a tool and CI does not warn, since for most endpoints absence is correct — cache-warmup routes and migration triggers should never become tools. Internal and external flags let a team target internal agents, the public MCP server, or both independently. MoEngage found that reusing API descriptions verbatim hurt tool selection, because models picked on implementation detail such as returning a paginated list rather than intent such as finding campaigns by status or channel; the tool_description and param_overrides fields give teams model-facing text separate from developer docs. On a spec push, CI validates the block, registers the target with the gateway and applies the Cedar policy, with no ticket to the platform team. The client library ships in a plug-in mode that wraps the gateway inside LangChain, Google ADK or another MCP-compatible framework, and an agent runner mode providing a full agent loop without a framework.

Today the gateway runs in seven AWS Regions, serves roughly 400 registered operations to 10 internal agents, and involves no product-team-authored MCP code, agent networking or Cedar policies. The agents cover everyday marketing workflows: a campaign QA agent validates targeting rules and content before launch, a delivery health agent watches send and bounce rates across channels, and a segment builder translates natural-language audience descriptions into segment queries. Each authenticates with its own IAM role and sees only permitted tools. MoEngage notes that AgentCore feature availability varies by Region.

Why it matters: teams building agents on top of an existing internal API estate face the same three problems MoEngage names — catalog size, server sprawl and identity leakage into model-set parameters — and this describes a working pattern for each. The trade-off is concentration: a single platform team owns the protocol, policy and connectivity layers, so its mistakes and the gateway's regional availability become the blast radius for every agent. For developers, treating the OpenAPI spec as the tool definition and Cedar policy as the access boundary suggests agent tooling can follow existing API governance rather than requiring a parallel MCP estate.

Read at AWS Machine Learning Blog

Based on reporting from the original publisher. Visit the source for full context and later updates.

Publisher excerpt

MoEngage turned roughly 400 private REST APIs across 7 AWS Regions into permission-scoped agent tools with Amazon Bedrock AgentCore Gateway. No per-service MCP servers, no public endpoints, and no 400-tool context bloat. See how OpenAPI specs, Cedar policies, and managed Amazon VPC Lattice egress made it work.