Blog · AWS Chime SDK · Four-Package Architecture, Identity & Media Pipelines · 2026-11-20

AWS Chime SDK for MCP Servers: Four-Package Architecture, ChimeBearer Identity, Single-Use JoinTokens, and Silent S3 Capture Failures

AWS Chime SDK is split across four separate npm packages — @aws-sdk/client-chime-sdk-identity, @aws-sdk/client-chime-sdk-messaging, @aws-sdk/client-chime-sdk-meetings, and @aws-sdk/client-chime-sdk-media-pipelines — each routing to a different AWS service endpoint, each with independent failure modes that are invisible from the other sub-services. An MCP server author who reaches for the legacy @aws-sdk/client-chime package gets none of these APIs; one who skips the AppInstance setup gets ForbiddenException on every Messaging call; one who reuses a JoinToken for a reconnect gets an authentication failure at the client SDK; one who creates a capture pipeline without the right S3 bucket policy watches the pipeline report InProgress while zero files land in S3. These four sub-services — Messaging, Meetings, Identity, and Media Pipelines — compose a real-time communication platform that an AI agent can fully orchestrate through MCP tools, but each sub-service has its own identity model, its own IAM namespace, and its own first-hour failure. This post synthesizes the complete picture.

TL;DR

The four-package architecture decision

When AWS evolved Chime from a monolithic SaaS meeting product into a composable communication SDK, they intentionally split the API surface into sub-services that version independently. For MCP server authors, this means no single import point exists for the entire Chime SDK. Each sub-service must be installed and instantiated separately.

Sub-servicenpm packageWhat it managesIdentity modelRequires AppInstance?
Identity @aws-sdk/client-chime-sdk-identity AppInstances, AppInstanceUsers, AppInstanceAdmins IAM SigV4 Creates AppInstances
Messaging @aws-sdk/client-chime-sdk-messaging Channels, messages, memberships, bans, ChannelFlows IAM SigV4 + ChimeBearer (AppInstanceUser ARN) in every call Yes — mandatory
Meetings @aws-sdk/client-chime-sdk-meetings Meeting sessions, attendees, capabilities, billing lifecycle IAM SigV4 No
Media Pipelines @aws-sdk/client-chime-sdk-media-pipelines Capture (→S3), live connector (→RTMP), insights (→Kinesis/AI) IAM SigV4 + separate ResourceAccessRoleArn No

Each package routes to a different AWS endpoint. ChimeSDKMessaging calls go to messaging-chime.{region}.amazonaws.com; ChimeSDKMeetings to meetings-chime.{region}.amazonaws.com; ChimeSDKMediaPipelines to media-pipelines-chime.{region}.amazonaws.com. AWS SDK v3 constructs these automatically when you instantiate the correct client class — you do not set a manual endpoint URL.

The practical consequence for MCP servers: an MCP server that exposes tools for messaging, meetings, and recording needs three to four separate client instances. Instantiate them once at module level, not inside tool handlers — Chime clients wrap an HTTP connection pool and a credential provider chain, and reconstructing them on every tool call adds 50–200ms of cold setup per invocation in a long-running process.

import { ChimeSDKIdentityClient } from '@aws-sdk/client-chime-sdk-identity';
import { ChimeSDKMessagingClient } from '@aws-sdk/client-chime-sdk-messaging';
import { ChimeSDKMeetingsClient } from '@aws-sdk/client-chime-sdk-meetings';
import { ChimeSDKMediaPipelinesClient } from '@aws-sdk/client-chime-sdk-media-pipelines';

const region = process.env.CHIME_REGION ?? 'us-east-1';

// Module-level singletons — constructed once, reused for all tool calls
const identityClient = new ChimeSDKIdentityClient({ region });
const messagingClient = new ChimeSDKMessagingClient({ region });
const meetingsClient = new ChimeSDKMeetingsClient({ region });
const pipelinesClient = new ChimeSDKMediaPipelinesClient({ region });

Chime SDK services are not available in all AWS regions. Identity and Messaging are available in us-east-1, us-west-2, eu-west-1, ap-southeast-1, and ap-northeast-1 as of late 2026. Meetings has broader coverage. Media Pipelines has a narrower list. Verify region availability before creating an AppInstance — the AppInstance region is permanent and cannot be changed after creation.

Messaging: AppInstance, identity layer, and the ChimeBearer invariant

Chime SDK Messaging uses a two-layer identity model that is unlike most AWS services. The IAM principal authenticates the API request at the HTTP level via SigV4. The AppInstanceUser ARN identifies the logical actor within Chime's messaging layer — the entity whose name appears on messages, whose membership is tracked in channels, and whose admin status determines what channels can be accessed. These two identities are independent. Having full IAM permissions does not give the IAM principal Messaging rights; having AppInstanceAdmin status does not affect IAM permissions.

AppInstance: the permanent root namespace

An AppInstance is the top-level container for all Chime SDK Messaging resources. Every channel, every user, every ChannelFlow, every ban lives under exactly one AppInstance. The AppInstance ARN is embedded in every resource ARN under it: arn:aws:chime:{region}:{account}:app-instance/{instanceId}/user/{userId}. Because the AppInstance region is permanent, planning it before provisioning is critical — if you deploy users and channels to a region that lacks a feature you later need, there is no migration path except starting over in a new AppInstance and re-provisioning everything programmatically.

import {
  CreateAppInstanceCommand,
  CreateAppInstanceUserCommand,
  CreateAppInstanceAdminCommand,
  DescribeAppInstanceUserCommand,
} from '@aws-sdk/client-chime-sdk-identity';

async function getOrCreateAppInstance(name: string): Promise<string> {
  const existingArn = process.env.CHIME_APP_INSTANCE_ARN;
  if (existingArn) return existingArn;

  const response = await identityClient.send(
    new CreateAppInstanceCommand({
      Name: name,
      ClientRequestToken: `app-instance-${name}-v1`, // stable token = idempotent
      Metadata: JSON.stringify({ environment: 'production' }),
    })
  );
  return response.AppInstanceArn!;
}

The ClientRequestToken makes CreateAppInstance idempotent — repeated calls with the same token return the existing ARN. Use a stable token derived from the instance name, not a random UUID, so that safe retries on failure do not create duplicate instances. Persist the returned ARN to AWS Systems Manager Parameter Store or an environment variable; every subsequent Messaging call requires it.

AppInstanceUser and the service user pattern

Every Messaging action is attributed to an AppInstanceUser. For MCP server tools performing administrative operations — creating channels, banning users, moderating messages — without acting as a specific end user, the standard pattern is to create a dedicated service user AppInstanceUser and use its ARN as the ChimeBearer in those calls. This keeps system operations separate from user-initiated actions in audit logs and channel history.

async function ensureServiceUser(appInstanceArn: string): Promise<string> {
  const userId = 'mcp-service-user';
  const userArn = `${appInstanceArn}/user/${userId}`;

  try {
    await identityClient.send(
      new DescribeAppInstanceUserCommand({ AppInstanceUserArn: userArn })
    );
    return userArn;
  } catch (err: any) {
    if (err.name !== 'NotFoundException') throw err;
  }

  const response = await identityClient.send(
    new CreateAppInstanceUserCommand({
      AppInstanceArn: appInstanceArn,
      AppInstanceUserId: userId,
      Name: 'MCP Service Bot',
      ExpirationSettings: {
        ExpirationDays: 90,
        ExpirationCriterion: 'CREATED_TIMESTAMP',
      },
    })
  );
  return response.AppInstanceUserArn!;
}

async function promoteToAdmin(appInstanceArn: string, userArn: string): Promise<void> {
  await identityClient.send(
    new CreateAppInstanceAdminCommand({
      AppInstanceAdminArn: userArn,
      AppInstanceArn: appInstanceArn,
    })
  );
}

Promoting the service user to AppInstanceAdmin at setup time is mandatory. Without admin status, the service user's Messaging calls fail with ForbiddenException when operating on channels it has not explicitly joined — even when the IAM execution role has chime:* permissions. The two permission layers are independent, and the ForbiddenException does not indicate which layer is missing, making it a confusing failure without this context.

ChimeBearer: the mandatory identity parameter

Every single Chime SDK Messaging API call requires a ChimeBearer parameter containing the AppInstanceUser ARN of the acting user. It is not optional metadata — the SDK throws a client-side validation error if it is omitted before the request reaches AWS. If you pass a valid ARN format but a non-existent user, the service returns NotFoundException for the user, not UnauthorizedException — another non-obvious failure mode.

The standard MCP tool pattern accepts an optional actingUserArn parameter and falls back to the service user ARN when the orchestrator does not supply a user context:

server.tool(
  'create_chime_channel',
  'Create a new Chime SDK Messaging channel',
  {
    name: z.string().describe('Channel display name'),
    mode: z.enum(['UNRESTRICTED', 'RESTRICTED']).default('UNRESTRICTED'),
    privacy: z.enum(['PUBLIC', 'PRIVATE']).default('PUBLIC'),
    actingUserArn: z.string().optional(),
  },
  async ({ name, mode, privacy, actingUserArn }) => {
    const bearer = actingUserArn ?? SERVICE_USER_ARN;
    const result = await messagingClient.send(
      new CreateChannelCommand({
        AppInstanceArn: APP_INSTANCE_ARN,
        Name: name,
        Mode: mode,
        Privacy: privacy,
        ChimeBearer: bearer,
        ClientRequestToken: `channel-${name.toLowerCase().replace(/\s+/g, '-')}-v1`,
      })
    );
    return { content: [{ type: 'text', text: result.ChannelArn! }] };
  }
);

Channels: mode, privacy, and the STANDARD vs CONTROL split

Two properties control channel behavior at creation time and are immutable after creation — changing them requires deleting and recreating the channel. Getting these wrong is expensive:

These are orthogonal axes. A RESTRICTED + PUBLIC channel is a public read-only broadcast that anyone can discover and subscribe to. A UNRESTRICTED + PRIVATE channel is a private group chat where all members can speak. Plan the combination before creating channels.

Membership types: HIDDEN for observer bots

When adding users to a channel via CreateChannelMembership, the Type parameter controls visibility. DEFAULT members are visible to all; HIDDEN members are invisible to non-admins — use this for monitoring bots and AI observers that should not appear in the member list; GUEST members can read but cannot send.

// Add the service bot as HIDDEN so it doesn't appear in customer-facing member lists
await messagingClient.send(
  new CreateChannelMembershipCommand({
    ChannelArn: channelArn,
    MemberArn: SERVICE_USER_ARN,
    Type: 'HIDDEN',
    ChimeBearer: SERVICE_USER_ARN,
  })
);

STANDARD vs CONTROL: the most important message distinction

Chime SDK Messaging has two message types that differ in fundamental ways, not just minor behavior:

STANDARD messages are persistent. They are stored in Chime's message history, appear in every ListChannelMessages result, trigger push notifications, and pass through every ChannelFlow processor before delivery. Use STANDARD for all messages that form part of the conversation record.

CONTROL messages are ephemeral signaling only. They are delivered in real time to connected WebSocket clients and then discarded — never persisted, never returned by ListChannelMessages, never processed by ChannelFlow, not counted against message rate limits in the same way. Use CONTROL for transient signals: "user is typing" indicators, "stream started" push events, presence pings, and coordination payloads that have no meaning outside the current session.

// STANDARD: persisted, in history, through ChannelFlow
const msgResult = await messagingClient.send(
  new SendChannelMessageCommand({
    ChannelArn: channelArn,
    Content: 'Support ticket #4821 assigned to AI triage queue.',
    Type: 'STANDARD',
    Persistence: 'PERSISTENT',
    Metadata: JSON.stringify({ ticketId: '4821', source: 'mcp-triage' }),
    ChimeBearer: SERVICE_USER_ARN,
    ClientRequestToken: `msg-${Date.now()}`,
  })
);

// CONTROL: ephemeral signal — NEVER use Persistence: 'PERSISTENT' with CONTROL
await messagingClient.send(
  new SendChannelMessageCommand({
    ChannelArn: channelArn,
    Content: JSON.stringify({ event: 'user_typing', userId: 'user-123' }),
    Type: 'CONTROL',
    Persistence: 'NON_PERSISTENT', // mandatory — CONTROL + PERSISTENT throws BadRequestException
    ChimeBearer: SERVICE_USER_ARN,
    ClientRequestToken: `ctrl-${Date.now()}`,
  })
);

The Metadata field on STANDARD messages accepts a free-form string up to 1024 characters. It is returned alongside message content in ListChannelMessages without additional API calls. Use it to attach structured data — message type tags, source system identifiers, AI model identifiers, ticket IDs — without encoding that information into the visible message text.

ChannelFlow: Lambda-based message processing

ChannelFlow intercepts every STANDARD message sent to an associated channel before delivery. The flow invokes one or more Lambda processor functions that can inspect the message, modify its content or metadata, block delivery entirely, or pass it through unchanged. CONTROL messages bypass ChannelFlow entirely — this is by design and cannot be changed.

ChannelFlows are associated at the channel level but created at the AppInstance level — one ChannelFlow can be reused across multiple channels. The two most important design decisions are InvocationType and FallbackAction:

ParameterValueBehaviorUse case
InvocationType ASYNC Lambda is called but Chime does not wait; message delivers immediately Enrichment, tagging, analytics — where delivery latency matters more than correctness
SYNC Chime waits up to 20s for Lambda response before delivering Content moderation where messages must be blocked before delivery
FallbackAction CONTINUE If Lambda errors or times out, message delivers normally Enrichment flows — Lambda failure should not block conversation
ABORT If Lambda errors or times out, message is blocked Hard moderation — but only use if Lambda has high availability; a cold-start surge can silently block all messages in the channel

The asymmetry is subtle but critical: ABORT combined with an ASYNC invocation creates a channel where Lambda cold starts will block message delivery during traffic spikes. Use ABORT only with SYNC invocation and provisioned Lambda concurrency.

const flowResult = await messagingClient.send(
  new CreateChannelFlowCommand({
    AppInstanceArn: APP_INSTANCE_ARN,
    Name: 'content-moderation-flow',
    ClientRequestToken: 'cf-moderation-v1',
    Processors: [
      {
        Name: 'ModerationLambda',
        Configuration: {
          Lambda: {
            ResourceArn: 'arn:aws:lambda:us-east-1:123456789012:function:chime-moderator',
            InvocationType: 'SYNC',
          },
        },
        ExecutionOrder: 1,
        FallbackAction: 'CONTINUE', // fail open — blocked Lambda should not freeze the channel
      },
    ],
  })
);

// Associate with specific channels
await messagingClient.send(
  new AssociateChannelFlowCommand({
    ChannelArn: channelArn,
    ChannelFlowArn: flowResult.ChannelFlowArn!,
    ChimeBearer: SERVICE_USER_ARN,
  })
);

Banning users: the remove-then-ban pattern

Chime SDK Messaging distinguishes removing a user from banning them. DeleteChannelMembership removes the user from the channel but allows them to rejoin later. CreateChannelBan blocks the user permanently from joining or being added until the ban is explicitly lifted via DeleteChannelBan.

The critical gotcha: calling CreateChannelBan alone does not remove an existing member from the channel. A banned user who was already a member remains in the channel and can still read messages (depending on membership type) until their membership is separately deleted. The correct pattern always removes membership first, then bans:

async function banUser(channelArn: string, userArn: string): Promise<void> {
  // Step 1: remove membership (ignore NotFoundException if they were never a member)
  try {
    await messagingClient.send(
      new DeleteChannelMembershipCommand({
        ChannelArn: channelArn,
        MemberArn: userArn,
        ChimeBearer: SERVICE_USER_ARN,
      })
    );
  } catch (err: any) {
    if (err.name !== 'NotFoundException') throw err;
  }

  // Step 2: create the ban
  await messagingClient.send(
    new CreateChannelBanCommand({
      ChannelArn: channelArn,
      MemberArn: userArn,
      ChimeBearer: SERVICE_USER_ARN,
    })
  );
}

Banning does not delete the user's historical messages. If the moderation policy requires message removal, call DeleteChannelMessage for each message by that user separately. The service user acting as AppInstanceAdmin can delete any message regardless of sender.

Meetings: IAM-only identity, single-use JoinToken, and billing lifecycle

Chime SDK Meetings is architecturally independent from Messaging. It uses plain IAM SigV4 authentication — there is no AppInstance, no AppInstanceUser, and no ChimeBearer. This makes Meetings significantly easier to adopt in isolation compared to Messaging. The first-hour failure is different: reusing a JoinToken for a client reconnect.

CreateMeeting and MediaPlacement

A meeting session is a temporary resource with an auto-expiry. Meeting rooms are not persistent — there is no concept of a permanent room. Each meeting is created on demand, used for one session, then deleted. If your application needs persistent room identifiers (a "conference room 101" concept), store that in your own database and create a new Chime meeting each time the room is "opened."

const result = await meetingsClient.send(
  new CreateMeetingCommand({
    ExternalMeetingId: externalMeetingId, // your stable identifier — for correlation
    MediaRegion: 'us-east-1', // set to region closest to attendees
    ClientRequestToken: `meeting-${externalMeetingId}`, // idempotency key
    MeetingFeatures: {
      Audio: { EchoReduction: 'AVAILABLE' }, // client opts in; ON forces for all attendees
      Video: { MaxResolution: 'FHD' },       // permits FHD when both endpoints support it
      Content: { MaxResolution: 'FHD' },
      Attendee: { MaxCount: 250 },           // 1000 requires AWS support ticket first
    },
  })
);

const meeting = result.Meeting!;
// IMPORTANT: store MediaPlacement — all 7 URLs are required by the client SDK
// Without MediaPlacement the client SDK cannot connect
console.log(meeting.MeetingId, meeting.MediaPlacement);

The MediaPlacement object contains seven URL fields that the Chime client SDK uses to establish media connections: AudioHostUrl, AudioFallbackUrl, SignalingUrl, TurnControlUrl, ScreenDataUrl, ScreenSharingUrl, and ScreenViewingUrl. The MCP server must pass all seven to the client application. Missing even one of these causes "Failed to get audio-video session" in the client SDK — an error that looks like a network issue but is actually the server failing to pass a required value.

JoinToken: the single-use invariant

CreateAttendee returns a JoinToken that the client SDK uses to authenticate when joining the meeting. The token is consumed on first use. If a client disconnects for any reason — network drop, browser refresh, app crash, iOS background suspension — and needs to rejoin, the server must call CreateAttendee again to issue a fresh token. Attempting to reuse the original token causes an authentication error at the client SDK level, not at the AWS API level, so the error message often does not make the root cause obvious.

server.tool(
  'create_attendee',
  'Create an attendee record and return a fresh JoinToken',
  {
    meetingId: z.string(),
    externalUserId: z.string(),
    audioCapability: z.enum(['SendReceive', 'Send', 'Receive', 'None']).default('SendReceive'),
    videoCapability: z.enum(['SendReceive', 'Send', 'Receive', 'None']).default('SendReceive'),
    contentCapability: z.enum(['SendReceive', 'Send', 'Receive', 'None']).default('SendReceive'),
  },
  async ({ meetingId, externalUserId, audioCapability, videoCapability, contentCapability }) => {
    const result = await meetingsClient.send(
      new CreateAttendeeCommand({
        MeetingId: meetingId,
        ExternalUserId: externalUserId,
        Capabilities: {
          Audio: audioCapability,
          Video: videoCapability,
          Content: contentCapability,
        },
      })
    );
    // JoinToken is single-use: never cache; always issue a new one on reconnect
    return { content: [{ type: 'text', text: JSON.stringify(result.Attendee) }] };
  }
);

AttendeeCapabilities v2: granular per-dimension control

AttendeeCapabilities allows per-attendee, per-dimension media control. Audio, Video, and Content (screen share) can each independently be SendReceive, Send (transmit but cannot receive), Receive (listen/watch but cannot transmit), or None (blocked entirely). These can be set at creation or updated dynamically via UpdateAttendeeCapabilities while the meeting is live:

// Mute an attendee server-side (AI-moderated Q&A pattern)
await meetingsClient.send(
  new UpdateAttendeeCapabilitiesCommand({
    MeetingId: meetingId,
    AttendeeId: attendeeId,
    Capabilities: {
      Audio: 'Receive',      // cannot send audio (muted)
      Video: 'SendReceive',  // video unchanged
      Content: 'SendReceive',
    },
  })
);

// Set observer mode — silent recording bot or AI listener
await meetingsClient.send(
  new UpdateAttendeeCapabilitiesCommand({
    MeetingId: meetingId,
    AttendeeId: observerAttendeeId,
    Capabilities: {
      Audio: 'Receive',
      Video: 'Receive',
      Content: 'Receive',
    },
  })
);

The capability change takes effect within seconds for currently connected clients — the client SDK receives a capability change event and enforces the new policy locally without a rejoin cycle. A common AI-moderated meeting pattern starts all attendees in Audio: 'Receive' mode (read-only audience) and upgrades individuals to Audio: 'SendReceive' when they are "called on" — implementing push-to-talk or moderated Q&A entirely server-side.

MeetingFeatures: policy at meeting creation time

Three meeting-wide quality settings are set at creation and cannot be changed afterward:

DeleteMeeting for billing control

Chime SDK Meetings bills per attendee-minute. A meeting continues to accrue cost until: DeleteMeeting is called explicitly, all attendees disconnect and the meeting remains empty for 5 minutes (auto-termination), or the meeting reaches its maximum duration (default 6 hours). The 5-minute auto-termination is reliable but adds latency to billing stop. For MCP server tools managing short-lived meetings, always call DeleteMeeting explicitly when the session ends.

GetMeeting returns NotFoundException for meetings that have been deleted or auto-terminated. Treat this as a normal state representing "meeting ended" — not an error requiring retry. Catch NotFoundException and return { active: false }:

try {
  const result = await meetingsClient.send(
    new GetMeetingCommand({ MeetingId: meetingId })
  );
  return { active: true, ...result.Meeting };
} catch (err: any) {
  if (err.name === 'NotFoundException') {
    return { active: false, meetingId }; // normal ended state
  }
  throw err;
}

Media Pipelines: the S3 bucket policy trap and three pipeline types

Media Pipelines is the bridge between Chime SDK Meetings (which manages live sessions) and storage or AI services (which process the content). Without Media Pipelines, there is no server-side recording — the Chime client SDK can record locally on a participant's device, but that provides no server access to the content stream. Media Pipelines is a separate sub-service using the @aws-sdk/client-chime-sdk-media-pipelines package and routes to media-pipelines-chime.{region}.amazonaws.com.

Critical prerequisite: S3 bucket policy

Before creating any capture pipeline, the S3 destination bucket must have a resource-based bucket policy granting chime.amazonaws.com the s3:PutObject permission. This is in addition to any IAM role policies on the execution environment. The Chime Media Pipelines service writes artifacts using its own service credentials — the pipeline's IAM execution role does not control the actual file writes.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ChimeMediaPipelinesCapture",
      "Effect": "Allow",
      "Principal": { "Service": "chime.amazonaws.com" },
      "Action": ["s3:PutObject", "s3:PutObjectAcl"],
      "Resource": "arn:aws:s3:::your-capture-bucket/*",
      "Condition": {
        "StringEquals": { "aws:SourceAccount": "123456789012" }
      }
    }
  ]
}

The aws:SourceAccount condition is essential — without it, any Chime service call from any account could write to your bucket. If the bucket policy is missing or incorrect, CreateMediaCapturePipeline returns HTTP 201 (success). The pipeline is created and starts running. No files appear in S3. The failure is completely silent from the pipeline creation API — you must call GetMediaCapturePipeline and watch the status transition from InProgress to Failed (after 2–5 minutes), then check CloudWatch Logs for the error detail.

Three pipeline types

1. Capture pipeline → S3: Records meeting audio, video, and content to S3. Configured per-source via ArtifactsConfiguration. The Audio.MuxType field determines whether video is muxed into the audio track's MP4: AudioWithActiveSpeakerVideo produces a single MP4 with the active speaker's video alongside audio (suitable for playback); AudioOnly produces audio-only (suitable for transcription workflows); AudioWithCompositedVideo produces a grid layout of all participants muxed with audio. Composited video is more computationally expensive but produces recordings that show all participants without additional editing.

const result = await pipelinesClient.send(
  new CreateMediaCapturePipelineCommand({
    SourceType: 'ChimeSdkMeeting',
    SourceArn: `arn:aws:chime::${accountId}:meeting:${meetingId}`,
    SinkType: 'S3Bucket',
    SinkArn: s3BucketArn,
    ChimeSdkMeetingConfiguration: {
      ArtifactsConfiguration: {
        Audio: { MuxType: 'AudioWithCompositedVideo' },
        Video: { State: 'Enabled', MuxType: 'VideoOnly' },
        Content: { State: 'Enabled', MuxType: 'ContentOnly' },
        CompositedVideo: {
          Layout: 'GridView',
          Resolution: 'FHD',
          GridViewConfiguration: {
            ContentShareLayout: 'ActiveSpeakerOnly',
            ActiveSpeakerOnlyConfiguration: { ActiveSpeakerPosition: 'TopLeft' },
          },
        },
      },
    },
  })
);

Capture pipeline must be created in the same region as the meeting — using mismatched regions causes BadRequestException: Meeting not found on CreateMediaCapturePipeline.

2. Live Connector pipeline → RTMP: Takes a meeting's audio and video and pushes it to a Twitch, YouTube, or custom RTMP endpoint. The RTMP URL and stream key are concatenated as a single string. Store the stream key in AWS Secrets Manager and retrieve it at runtime — MCP tool inputs containing live streaming credentials can appear in agent memory or conversation history.

3. Media Insights pipeline → AI processing: Runs real-time transcription, keyword alerting, and sentiment analysis on meeting audio via Amazon Transcribe Call Analytics. Works in two stages: create a reusable MediaInsightsPipelineConfiguration template once at setup time, then call CreateMediaInsightsPipeline to run that template against a specific meeting.

Media Insights pipeline configuration and trust policy

The configuration defines an ordered chain of processor elements. AmazonTranscribeCallAnalyticsProcessor produces both low-level TranscriptEvent word stream and higher-level UtteranceEvent records. UtteranceEvent segments the transcript by speaker turn and includes per-utterance sentiment, issues detected, action items detected, and outcomes detected — from Transcribe Call Analytics ML models without additional processing. For MCP tools that summarize calls or extract action items, consuming UtteranceEvent records is significantly more efficient than parsing the lower-level word stream.

const configResult = await pipelinesClient.send(
  new CreateMediaInsightsPipelineConfigurationCommand({
    MediaInsightsPipelineConfigurationName: 'call-analytics-v1',
    ResourceAccessRoleArn: resourceAccessRoleArn, // assumed by Media Pipelines to deliver events
    Elements: [
      {
        Type: 'AmazonTranscribeCallAnalyticsProcessor',
        AmazonTranscribeCallAnalyticsProcessorConfiguration: {
          LanguageCode: 'en-US',
          ContentRedactionType: 'PII',
          ContentIdentificationType: 'PII',
          PartialResultsStability: 'high',
          EnablePartialResultsStabilization: true,
          PostCallAnalyticsSettings: {
            OutputLocation: 's3://your-bucket/call-analytics-output/',
            DataAccessRoleArn: transcribeDataAccessRoleArn,
            ContentRedactionOutput: 'redacted_and_combined',
          },
        },
      },
      {
        Type: 'KinesisDataStreamSink',
        KinesisDataStreamSinkConfiguration: {
          InsightsTarget: kinesisStreamArn,
        },
      },
    ],
    RealTimeAlertConfiguration: {
      Disabled: false,
      Rules: [
        {
          Type: 'KeywordMatchRule',
          KeywordMatchConfiguration: {
            RuleName: 'escalation-keywords',
            Keywords: ['refund', 'cancel', 'supervisor', 'complaint'],
            Negate: false,
          },
        },
        {
          Type: 'SentimentRule',
          SentimentConfiguration: {
            RuleName: 'negative-sentiment',
            SentimentType: 'NEGATIVE',
            TimePeriod: 60, // seconds of negative sentiment before firing alert
          },
        },
      ],
    },
  })
);

The ResourceAccessRoleArn trust policy must list mediapipelines.chime.amazonaws.com as the principal — not chime.amazonaws.com. Using the wrong principal causes the pipeline to create successfully while producing zero Kinesis events, with an AccessDenied error visible only in CloudWatch Logs. The two service principals are different identities and cannot be substituted.

// ResourceAccessRole trust policy
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "Service": "mediapipelines.chime.amazonaws.com" }, // NOT chime.amazonaws.com
    "Action": "sts:AssumeRole",
    "Condition": { "StringEquals": { "aws:SourceAccount": "123456789012" } }
  }]
}

Full MCP server implementations

Messaging server (5 tools)

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
import { ChimeSDKIdentityClient,
  CreateAppInstanceCommand, CreateAppInstanceUserCommand,
  CreateAppInstanceAdminCommand, DescribeAppInstanceUserCommand,
} from '@aws-sdk/client-chime-sdk-identity';
import { ChimeSDKMessagingClient,
  CreateChannelCommand, SendChannelMessageCommand,
  ListChannelMessagesCommand, CreateChannelMembershipCommand,
  CreateChannelBanCommand, DeleteChannelMembershipCommand,
} from '@aws-sdk/client-chime-sdk-messaging';

const region = process.env.CHIME_REGION ?? 'us-east-1';
const identityClient = new ChimeSDKIdentityClient({ region });
const messagingClient = new ChimeSDKMessagingClient({ region });

let APP_INSTANCE_ARN: string;
let SERVICE_USER_ARN: string;

async function init() {
  const existingArn = process.env.CHIME_APP_INSTANCE_ARN;
  if (existingArn) {
    APP_INSTANCE_ARN = existingArn;
  } else {
    const r = await identityClient.send(new CreateAppInstanceCommand({
      Name: 'mcp-messaging-app',
      ClientRequestToken: 'app-instance-mcp-messaging-v1',
    }));
    APP_INSTANCE_ARN = r.AppInstanceArn!;
  }

  const userId = 'mcp-service-user';
  const userArn = `${APP_INSTANCE_ARN}/user/${userId}`;
  try {
    await identityClient.send(new DescribeAppInstanceUserCommand({ AppInstanceUserArn: userArn }));
  } catch (e: any) {
    if (e.name === 'NotFoundException') {
      await identityClient.send(new CreateAppInstanceUserCommand({
        AppInstanceArn: APP_INSTANCE_ARN,
        AppInstanceUserId: userId,
        Name: 'MCP Service Bot',
      }));
    } else throw e;
  }
  SERVICE_USER_ARN = userArn;

  await identityClient.send(new CreateAppInstanceAdminCommand({
    AppInstanceAdminArn: SERVICE_USER_ARN,
    AppInstanceArn: APP_INSTANCE_ARN,
  })).catch(() => {}); // idempotent — ignore if already admin
}

const server = new McpServer({ name: 'chime-messaging', version: '1.0.0' });

server.tool('create_channel', 'Create a Chime SDK Messaging channel',
  { name: z.string(), mode: z.enum(['UNRESTRICTED','RESTRICTED']).default('UNRESTRICTED'), privacy: z.enum(['PUBLIC','PRIVATE']).default('PUBLIC') },
  async ({ name, mode, privacy }) => {
    const r = await messagingClient.send(new CreateChannelCommand({
      AppInstanceArn: APP_INSTANCE_ARN, Name: name, Mode: mode, Privacy: privacy,
      ChimeBearer: SERVICE_USER_ARN, ClientRequestToken: `ch-${name}-v1`,
    }));
    return { content: [{ type: 'text', text: r.ChannelArn! }] };
  });

server.tool('send_message', 'Send a message to a Chime channel',
  { channelArn: z.string(), content: z.string(), type: z.enum(['STANDARD','CONTROL']).default('STANDARD') },
  async ({ channelArn, content, type }) => {
    const r = await messagingClient.send(new SendChannelMessageCommand({
      ChannelArn: channelArn, Content: content, Type: type,
      Persistence: type === 'STANDARD' ? 'PERSISTENT' : 'NON_PERSISTENT',
      ChimeBearer: SERVICE_USER_ARN, ClientRequestToken: `m-${Date.now()}`,
    }));
    return { content: [{ type: 'text', text: r.MessageId! }] };
  });

server.tool('list_messages', 'List recent messages from a Chime channel',
  { channelArn: z.string(), maxResults: z.number().int().default(20), sortOrder: z.enum(['ASCENDING','DESCENDING']).default('DESCENDING') },
  async ({ channelArn, maxResults, sortOrder }) => {
    const r = await messagingClient.send(new ListChannelMessagesCommand({
      ChannelArn: channelArn, MaxResults: maxResults,
      SortOrder: sortOrder, ChimeBearer: SERVICE_USER_ARN,
    }));
    return { content: [{ type: 'text', text: JSON.stringify(r.ChannelMessages) }] };
  });

server.tool('add_member', 'Add an AppInstanceUser to a Chime channel',
  { channelArn: z.string(), memberArn: z.string(), memberType: z.enum(['DEFAULT','HIDDEN','GUEST']).default('DEFAULT') },
  async ({ channelArn, memberArn, memberType }) => {
    await messagingClient.send(new CreateChannelMembershipCommand({
      ChannelArn: channelArn, MemberArn: memberArn, Type: memberType,
      ChimeBearer: SERVICE_USER_ARN,
    }));
    return { content: [{ type: 'text', text: `Added ${memberArn} as ${memberType}` }] };
  });

server.tool('ban_user', 'Remove and permanently ban a user from a Chime channel',
  { channelArn: z.string(), userArn: z.string() },
  async ({ channelArn, userArn }) => {
    try { await messagingClient.send(new DeleteChannelMembershipCommand({
      ChannelArn: channelArn, MemberArn: userArn, ChimeBearer: SERVICE_USER_ARN,
    })); } catch (e: any) { if (e.name !== 'NotFoundException') throw e; }
    await messagingClient.send(new CreateChannelBanCommand({
      ChannelArn: channelArn, MemberArn: userArn, ChimeBearer: SERVICE_USER_ARN,
    }));
    return { content: [{ type: 'text', text: `Banned ${userArn}` }] };
  });

await init();
const transport = new StdioServerTransport();
await server.connect(transport);

Meetings + capture server (5 tools)

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
import { ChimeSDKMeetingsClient,
  CreateMeetingCommand, CreateAttendeeCommand,
  UpdateAttendeeCapabilitiesCommand, DeleteMeetingCommand,
  GetMeetingCommand,
} from '@aws-sdk/client-chime-sdk-meetings';
import { ChimeSDKMediaPipelinesClient,
  CreateMediaCapturePipelineCommand, DeleteMediaCapturePipelineCommand,
} from '@aws-sdk/client-chime-sdk-media-pipelines';

const region = process.env.AWS_REGION ?? 'us-east-1';
const meetingsClient = new ChimeSDKMeetingsClient({ region });
const pipelinesClient = new ChimeSDKMediaPipelinesClient({ region });

const server = new McpServer({ name: 'chime-meetings', version: '1.0.0' });

server.tool('create_meeting', 'Create a new Chime SDK video/audio meeting',
  { externalMeetingId: z.string(), mediaRegion: z.string().default('us-east-1') },
  async ({ externalMeetingId, mediaRegion }) => {
    const r = await meetingsClient.send(new CreateMeetingCommand({
      ExternalMeetingId: externalMeetingId,
      MediaRegion: mediaRegion,
      ClientRequestToken: `meeting-${externalMeetingId}`,
      MeetingFeatures: {
        Audio: { EchoReduction: 'AVAILABLE' },
        Video: { MaxResolution: 'FHD' },
      },
    }));
    // Return full MediaPlacement — client SDK requires all 7 URLs
    return { content: [{ type: 'text', text: JSON.stringify({
      meetingId: r.Meeting?.MeetingId,
      mediaPlacement: r.Meeting?.MediaPlacement,
    }) }] };
  });

server.tool('create_attendee', 'Create attendee and return a single-use JoinToken',
  { meetingId: z.string(), externalUserId: z.string(),
    audio: z.enum(['SendReceive','Send','Receive','None']).default('SendReceive'),
    video: z.enum(['SendReceive','Send','Receive','None']).default('SendReceive'),
  },
  async ({ meetingId, externalUserId, audio, video }) => {
    const r = await meetingsClient.send(new CreateAttendeeCommand({
      MeetingId: meetingId,
      ExternalUserId: externalUserId,
      Capabilities: { Audio: audio, Video: video, Content: 'SendReceive' },
    }));
    // JoinToken is single-use — do not cache; re-issue on every reconnect
    return { content: [{ type: 'text', text: JSON.stringify(r.Attendee) }] };
  });

server.tool('update_attendee_capabilities', 'Change per-attendee media capabilities live',
  { meetingId: z.string(), attendeeId: z.string(),
    audio: z.enum(['SendReceive','Send','Receive','None']),
    video: z.enum(['SendReceive','Send','Receive','None']),
  },
  async ({ meetingId, attendeeId, audio, video }) => {
    await meetingsClient.send(new UpdateAttendeeCapabilitiesCommand({
      MeetingId: meetingId,
      AttendeeId: attendeeId,
      Capabilities: { Audio: audio, Video: video, Content: 'SendReceive' },
    }));
    return { content: [{ type: 'text', text: `Capabilities updated for ${attendeeId}` }] };
  });

server.tool('end_meeting', 'Delete a meeting and stop billing',
  { meetingId: z.string() },
  async ({ meetingId }) => {
    await meetingsClient.send(new DeleteMeetingCommand({ MeetingId: meetingId }));
    return { content: [{ type: 'text', text: `Meeting ${meetingId} ended` }] };
  });

server.tool('start_capture', 'Start recording a meeting to S3 (requires bucket policy for chime.amazonaws.com)',
  { meetingId: z.string(), s3BucketArn: z.string(), accountId: z.string() },
  async ({ meetingId, s3BucketArn, accountId }) => {
    const r = await pipelinesClient.send(new CreateMediaCapturePipelineCommand({
      SourceType: 'ChimeSdkMeeting',
      SourceArn: `arn:aws:chime::${accountId}:meeting:${meetingId}`,
      SinkType: 'S3Bucket',
      SinkArn: s3BucketArn,
      ChimeSdkMeetingConfiguration: {
        ArtifactsConfiguration: {
          Audio: { MuxType: 'AudioWithCompositedVideo' },
          Video: { State: 'Enabled', MuxType: 'VideoOnly' },
          Content: { State: 'Enabled', MuxType: 'ContentOnly' },
          CompositedVideo: { Layout: 'GridView', Resolution: 'FHD',
            GridViewConfiguration: { ContentShareLayout: 'ActiveSpeakerOnly' } },
        },
      },
    }));
    return { content: [{ type: 'text', text: JSON.stringify({
      pipelineId: r.MediaCapturePipeline?.MediaPipelineId,
      status: r.MediaCapturePipeline?.Status,
    }) }] };
  });

const transport = new StdioServerTransport();
await server.connect(transport);

Startup init() pattern

For MCP servers using Messaging, the standard startup pattern resolves the AppInstance ARN and service user ARN before accepting any tool calls. If init() throws — missing IAM permissions, invalid region for the AppInstance, etc. — the process exits before connecting the transport. This fail-fast approach surfaces misconfiguration immediately rather than failing silently on the first tool call.

async function init() {
  APP_INSTANCE_ARN = await getOrCreateAppInstance('my-app');
  SERVICE_USER_ARN = await ensureAppInstanceUser(APP_INSTANCE_ARN, 'mcp-service', 'MCP Service');
  await promoteToAdmin(APP_INSTANCE_ARN, SERVICE_USER_ARN);
}

await init(); // throws immediately if setup is misconfigured
const transport = new StdioServerTransport();
await server.connect(transport); // only reached if init() succeeded

IAM permissions per sub-service

Sub-serviceIAM namespaceKey permissions needed
Identity chime:*AppInstance* CreateAppInstance, CreateAppInstanceUser, CreateAppInstanceAdmin, DescribeAppInstanceUser
Messaging chime:*Channel* CreateChannel, SendChannelMessage, ListChannelMessages, CreateChannelMembership, CreateChannelBan, DeleteChannelMembership
Meetings chime:*Meeting*, chime:*Attendee* CreateMeeting, DeleteMeeting, GetMeeting, CreateAttendee, BatchCreateAttendee, UpdateAttendeeCapabilities
Media Pipelines chime:*MediaCapturePipeline*, chime:*MediaInsightsPipeline* CreateMediaCapturePipeline, DeleteMediaCapturePipeline, GetMediaCapturePipeline, CreateMediaInsightsPipeline

Chime SDK does not support resource-level ARN conditions for most actions — the standard policy grants the namespace-level wildcard. Scope the IAM policy to only the sub-service namespaces your MCP server uses; a meetings-only server should not have chime:CreateChannel. Media Pipelines additionally requires s3:PutObject on the target S3 bucket for the execution role, plus the separate bucket policy for chime.amazonaws.com.

Production gotchas: synthesized across all four sub-services

Sub-serviceGotchaSymptomFix
All Using @aws-sdk/client-chime for Messaging or Meetings TypeScript type errors; methods for channels/meetings not found Install the split packages separately — the monolithic client covers only deprecated classic Chime
Messaging Missing ChimeBearer parameter BadRequestException: ChimeBearer is required Pass AppInstanceUser ARN in every Messaging call — it is mandatory even when acting as an IAM admin
Messaging Service user not promoted to AppInstanceAdmin ForbiddenException on channels the service user has not explicitly joined Call CreateAppInstanceAdmin for the service user ARN once at setup
Messaging CONTROL message passed to ChannelFlow CONTROL messages bypass ChannelFlow — flow Lambda is never invoked CONTROL messages do not go through ChannelFlow; use STANDARD for messages requiring moderation
Messaging CONTROL combined with PERSISTENT BadRequestException CONTROL messages must use Persistence: 'NON_PERSISTENT' — the combination is invalid
Messaging CreateChannelBan without DeleteChannelMembership first Banned user is still a member and can read messages Always call DeleteChannelMembership before CreateChannelBan (ignore NotFoundException if not a member)
Messaging ChannelFlow with FallbackAction: ABORT and cold Lambda All channel messages silently blocked during Lambda cold start surge Use CONTINUE unless hard moderation is required; pair ABORT only with provisioned Lambda concurrency
Messaging AppInstance in wrong region or region not supported NotFoundException when calling Messaging from a different region client Always instantiate Messaging client with the same region as the AppInstance — not a default from the environment
Meetings Reusing JoinToken after disconnect Client SDK throws authentication error on second join attempt JoinToken is single-use — call CreateAttendee again on each reconnect; do not cache tokens
Meetings MediaPlacement not passed to client "Failed to get audio-video session" in client SDK Store and return the full MediaPlacement object from CreateMeeting; the client SDK requires all 7 URLs
Meetings Not calling DeleteMeeting after session ends Billing continues for up to 5 minutes after all participants leave Always call DeleteMeeting explicitly when the session ends
Meetings GetMeeting NotFoundException treated as error Tool throws uncaught exception when checking status of an ended meeting Catch NotFoundException and return { active: false } — it means the meeting ended normally
Meetings MaxCount: 1000 without account limit increase Meeting created with lower default limit; MaxCount silently ignored Contact AWS Support to request the 1000-attendee limit increase before using it; validate via GetMeeting after creation
Media Pipelines Missing S3 bucket policy for capture pipeline Pipeline reports InProgress but no files appear in S3; transitions to Failed after 2–5 minutes Add resource-based bucket policy granting chime.amazonaws.com s3:PutObject with aws:SourceAccount condition — IAM role policy alone is not enough
Media Pipelines ResourceAccessRoleArn trust policy uses chime.amazonaws.com Insights pipeline creates successfully but no events appear in Kinesis Trust policy must use mediapipelines.chime.amazonaws.com — not chime.amazonaws.com; these are distinct service principals
Media Pipelines Capture pipeline region different from meeting region BadRequestException: Meeting not found on CreateMediaCapturePipeline Use the same region for both pipelinesClient and meetingsClient — capture pipeline must be in the same region as the meeting
Media Pipelines Video.State: 'Disabled' combined with AudioWithActiveSpeakerVideo ConflictException or unexpected behavior in audio track If video capture is disabled, use Audio.MuxType: 'AudioOnly' — cannot mux active-speaker video when video capture is off

Related pages