AWS Application Signals · Auto-Instrumentation, SLOs, ECS & Lambda · 2026-11-20 · Application Signals arc

AWS Application Signals for MCP Servers: Auto-Instrumentation, Service Topology, SLOs, and ECS vs Lambda Deployment

Four AWS Application Signals patterns synthesised into a complete observability playbook for MCP server developers — covering the ADOT auto-instrumentation model that requires no code changes, the service topology APIs that surface which downstream dependency is causing errors, the CreateServiceLevelObjectiveCommand patterns for defining success rate and latency budgets, the two-alarm burn-rate pattern that alerts before an SLO breach, ECS Fargate sidecar deployment, Lambda layer deployment, and the production gotchas that only appear after traffic flows.

The observability gap in MCP server deployments

Standard CloudWatch gives you infrastructure metrics: CPU utilization, memory, invocation count, and error rate. Those metrics tell you that something is wrong. They do not tell you which of your twelve MCP tools is degrading, or whether the slowdown is in your MCP server code versus the DynamoDB table it queries versus the third-party API it proxies.

This observability gap is structurally worse for MCP servers than for conventional HTTP services, because a standard MCP deployment routes all tool calls through a single endpoint: POST /mcp. Every request — from the fast search tool that queries a DynamoDB index in 50ms to the slow generate-report tool that renders a PDF in 15 seconds — lands at the same path. CloudWatch error metrics aggregate them together. A spike in error rate tells you something broke; it does not tell you which tool, and it does not tell you whether the fault is in your code or in a downstream service you depend on.

AWS Application Signals closes this gap. It is a CloudWatch feature that uses the AWS Distro for OpenTelemetry (ADOT) to automatically instrument your running application and surfaces per-operation latency, error rate, fault rate, and throughput metrics in CloudWatch — with a service topology map that shows every downstream dependency and its health contribution. For MCP server operators, it answers the questions that actually matter in production incidents: which tool is slow, which dependency is at fault, and are you meeting your reliability commitments to your users.

This guide synthesises the full Application Signals arc for MCP servers: how auto-instrumentation works, how to deploy it on ECS and Lambda, how to query the service health API, how to define SLOs that measure real reliability, and how to build burn-rate alarm infrastructure that alerts before the SLO is breached.

How ADOT auto-instrumentation works: no code changes required

The first thing to understand about Application Signals is that it does not require source code changes to your MCP server. Instead, it inserts a lightweight SDK layer at the Node.js process level using the NODE_OPTIONS environment variable — a standard Node.js mechanism for requiring modules before application code runs:

NODE_OPTIONS=--require @aws/aws-distro-opentelemetry-node-autoinstrumentation/register

When the Node.js runtime starts and processes this environment variable, the ADOT auto-instrumentation package's register hook runs before your first line of application code. It patches:

These instrumentation patches capture OpenTelemetry trace spans for every operation. Those spans are exported to an ADOT collector (running as a sidecar on ECS or as an embedded Lambda extension), which does two things: it forwards the full trace to AWS X-Ray for distributed tracing, and it synthesizes per-operation aggregate metrics that it writes to CloudWatch under the AWS/ApplicationSignals namespace. The result is four golden signals per service operation, automatically, without touching your MCP server code.

The critical environment variable that activates this synthesis is OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true. Without it, ADOT still collects traces and exports them to X-Ray, but the CloudWatch Metrics exporter (the pipeline stage that writes to AWS/ApplicationSignals) does not activate. This is the most common cause of "X-Ray traces appear but Application Signals shows no data" — always set both environment variables, not just NODE_OPTIONS.

One precision gotcha that bites operators repeatedly: the value must be the lowercase string "true". The ADOT SDK does string comparison, not truthy evaluation. Setting the value to "True", "TRUE", or 1 silently disables the Application Signals pipeline while leaving X-Ray tracing intact — you get traces but no metrics.

The four golden signals and service topology

Once traffic flows through an instrumented MCP server, Application Signals surfaces four golden signals per discovered service operation:

These four signals are stored with dimensions that identify the service, environment, and operation. The service topology extends this further — it populates a dependency map that shows every downstream service your MCP server called during the measurement window, with the same four golden signals for each edge. When DynamoDB starts throttling, you see the DynamoDB edge's error rate spike on the topology map before your MCP server's own fault rate rises. That early warning and clear attribution is the operational payoff of Application Signals.

Query the topology programmatically using ListServiceDependenciesCommand from @aws-sdk/client-application-signals:

import {
  ApplicationSignalsClient,
  ListServicesCommand,
  GetServiceCommand,
  ListServiceOperationsCommand,
  ListServiceDependenciesCommand
} from "@aws-sdk/client-application-signals";

const client = new ApplicationSignalsClient({ region: process.env.AWS_REGION });

async function getMcpServerTopology(serviceName: string, environment: string) {
  const now = new Date();
  const oneHourAgo = new Date(now.getTime() - 60 * 60 * 1000);

  // ListServicesCommand requires a time window — services with no traffic
  // in the window are not returned. Use at least 1 hour.
  const servicesResponse = await client.send(new ListServicesCommand({
    StartTime: oneHourAgo,
    EndTime: now
  }));

  const mcpService = servicesResponse.ServiceSummaries?.find(s =>
    s.KeyAttributes?.["Name"] === serviceName &&
    s.KeyAttributes?.["Environment"] === environment
  );

  if (!mcpService) {
    throw new Error(`Service '${serviceName}' not visible in the last hour — ` +
      `is ADOT running and is OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true?`);
  }

  const keyAttributes = mcpService.KeyAttributes!;

  // Get per-operation breakdown (the tool-level view)
  const [serviceDetail, operations, dependencies] = await Promise.all([
    client.send(new GetServiceCommand({ StartTime: oneHourAgo, EndTime: now, KeyAttributes: keyAttributes })),
    client.send(new ListServiceOperationsCommand({ StartTime: oneHourAgo, EndTime: now, KeyAttributes: keyAttributes })),
    client.send(new ListServiceDependenciesCommand({ StartTime: oneHourAgo, EndTime: now, KeyAttributes: keyAttributes }))
  ]);

  return {
    service: serviceDetail.Service,
    operations: operations.ServiceOperations?.map(op => ({
      name: op.Name,
      metricReferences: op.MetricReferences?.length
    })),
    // Downstream dependencies — DynamoDB, S3, SQS, external APIs
    dependencies: dependencies.ServiceDependencies?.map(dep => ({
      remoteService: dep.KeyAttributes?.["Name"],
      remoteType: dep.KeyAttributes?.["Type"],
      operation: dep.OperationName
    }))
  };
}

// Example output:
// operations: [{ name: "POST /mcp", metricReferences: 3 }]
// dependencies: [
//   { remoteService: "AWS::DynamoDB", remoteType: "AWS::DynamoDB::Table", operation: "GetItem" },
//   { remoteService: "api.openai.com", remoteType: "RemoteService", operation: "POST /v1/chat/completions" }
// ]

The ListServicesCommand time window requirement is the most common cause of "empty service list" confusion. The API does not return a static registry of all services that have ever emitted telemetry — it returns services that emitted telemetry within the requested period. For services with low traffic (e.g., a staging MCP server called only during CI runs), use a wider window of several hours. Application Signals data is also region-specific and does not replicate across regions — ensure the ApplicationSignalsClient region matches the region where your ECS or Lambda is running.

Reading CloudWatch metrics from the Application Signals namespace

Application Signals stores its synthesized metrics in CloudWatch at AWS/ApplicationSignals. Each metric point carries dimensions identifying the service, environment, and operation. For latency, use the ExtendedStatistics parameter to get percentiles; for error and fault rates, combine the Fault/Error sum with the Latency SampleCount to compute a rate:

import { CloudWatchClient, GetMetricStatisticsCommand } from "@aws-sdk/client-cloudwatch";

const cw = new CloudWatchClient({ region: process.env.AWS_REGION });

async function getMcpServerMetrics(serviceName: string, environment: string, operation: string) {
  const now = new Date();
  const oneHourAgo = new Date(now.getTime() - 60 * 60 * 1000);
  const baseDimensions = [
    { Name: "Service", Value: serviceName },
    { Name: "Environment", Value: environment },
    { Name: "Operation", Value: operation }
  ];

  const [latencyResponse, faultResponse, totalResponse] = await Promise.all([
    // Latency percentiles — use ExtendedStatistics, not Statistics
    cw.send(new GetMetricStatisticsCommand({
      Namespace: "AWS/ApplicationSignals",
      MetricName: "Latency",
      Dimensions: baseDimensions,
      StartTime: oneHourAgo,
      EndTime: now,
      Period: 300,
      ExtendedStatistics: ["p50", "p95", "p99"]
    })),
    // Fault count (5xx server errors)
    cw.send(new GetMetricStatisticsCommand({
      Namespace: "AWS/ApplicationSignals",
      MetricName: "Fault",
      Dimensions: baseDimensions,
      StartTime: oneHourAgo,
      EndTime: now,
      Period: 3600,
      Statistics: ["Sum"]
    })),
    // Total request count via Latency SampleCount
    cw.send(new GetMetricStatisticsCommand({
      Namespace: "AWS/ApplicationSignals",
      MetricName: "Latency",
      Dimensions: baseDimensions,
      StartTime: oneHourAgo,
      EndTime: now,
      Period: 3600,
      Statistics: ["SampleCount"]
    }))
  ]);

  const faults = faultResponse.Datapoints?.[0]?.Sum ?? 0;
  const total = totalResponse.Datapoints?.[0]?.SampleCount ?? 0;
  const faultRatePct = total > 0 ? ((faults / total) * 100).toFixed(3) : "no data";

  const latestLatency = latencyResponse.Datapoints?.sort(
    (a, b) => (b.Timestamp?.getTime() ?? 0) - (a.Timestamp?.getTime() ?? 0)
  )[0];

  return {
    p50Ms: latestLatency?.ExtendedStatistics?.["p50"],
    p95Ms: latestLatency?.ExtendedStatistics?.["p95"],
    p99Ms: latestLatency?.ExtendedStatistics?.["p99"],
    faultRatePct,
    totalRequestsLastHour: total
  };
}

These raw metric reads give you on-demand health checks. For continuous alerting and reliability tracking, build on them with Service Level Objectives rather than point-in-time metric queries — SLOs aggregate good-request fractions over multi-day windows, which is more robust than threshold-based alarms on instantaneous metric values.

Deployment path 1: ECS Fargate with ADOT sidecar

On ECS Fargate, the ADOT collector runs as a sidecar container in the same task as your MCP server. Because ECS tasks share a network namespace, the sidecar is reachable at localhost:4316 without any additional networking configuration. The sidecar receives trace spans from your MCP server via OTLP, forwards them to X-Ray, and exports aggregated metrics to CloudWatch.

The ADOT collector image for Application Signals is public.ecr.aws/aws-observability/aws-otel-collector:latest. When started with --config=/etc/ecs/container-insights/otel-task-metrics-config.yaml, it activates the managed Application Signals pipeline — no custom collector config file is needed. The complete task definition JSON:

{
  "family": "mcp-server-task",
  "networkMode": "awsvpc",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "1024",
  "memory": "2048",
  "executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/mcp-server-execution-role",
  "taskRoleArn": "arn:aws:iam::ACCOUNT_ID:role/mcp-server-task-role",
  "containerDefinitions": [
    {
      "name": "mcp-server",
      "image": "ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/mcp-server:latest",
      "portMappings": [{ "containerPort": 3000, "protocol": "tcp" }],
      "environment": [
        { "name": "NODE_OPTIONS",
          "value": "--require @aws/aws-distro-opentelemetry-node-autoinstrumentation/register" },
        { "name": "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "value": "true" },
        { "name": "OTEL_EXPORTER_OTLP_ENDPOINT", "value": "http://localhost:4316" },
        { "name": "OTEL_RESOURCE_ATTRIBUTES",
          "value": "service.name=mcp-server,deployment.environment=production,aws.log.group.names=/ecs/mcp-server" },
        { "name": "OTEL_PROPAGATORS", "value": "xray,tracecontext,b3" }
      ],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/mcp-server",
          "awslogs-region": "us-east-1",
          "awslogs-stream-prefix": "mcp-server"
        }
      },
      "dependsOn": [{ "containerName": "aws-otel-collector", "condition": "START" }],
      "essential": true
    },
    {
      "name": "aws-otel-collector",
      "image": "public.ecr.aws/aws-observability/aws-otel-collector:latest",
      "command": ["--config=/etc/ecs/container-insights/otel-task-metrics-config.yaml"],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/mcp-server",
          "awslogs-region": "us-east-1",
          "awslogs-stream-prefix": "aws-otel-collector"
        }
      },
      "essential": false,
      "healthCheck": {
        "command": ["/healthcheck"],
        "interval": 5,
        "timeout": 6,
        "retries": 5,
        "startPeriod": 1
      }
    }
  ]
}

Three design decisions in this configuration are worth explaining in detail:

essential: false on the ADOT sidecar. If the ADOT collector crashes — due to an IAM permission denial, a memory limit hit, or a transient AWS API error — the MCP server continues serving requests. Telemetry is lost but the service stays up. This is the correct default: observability infrastructure should never be on the critical path for user-facing request handling. If compliance requirements mean you need telemetry to be guaranteed before accepting traffic, change to essential: true — but be prepared for the task to restart every time the collector encounters a transient export error.

dependsOn condition: "START" vs "HEALTHY". The START condition ensures the collector container process is running before the MCP server starts, but does not wait for the collector to be fully ready to accept OTLP connections. The Node.js OTLP exporter automatically retries on connection failure, so telemetry from the first few seconds may be buffered or dropped, but the connection eventually succeeds. If you need a stronger guarantee (no telemetry loss from the first request), change the condition to HEALTHY and ensure the ADOT collector health check passes within the MCP server's startup window.

aws.log.group.names in OTEL_RESOURCE_ATTRIBUTES. This attribute links your CloudWatch Logs output to Application Signals, enabling log correlation in the console. When you drill into a trace that shows a slow span, the console can show you the corresponding log lines from the same invocation without manual log searching.

Avoid baking NODE_OPTIONS or any OTEL environment variables into the Docker image. These values differ between production and staging — using ECS environment variable overrides keeps the image environment-agnostic. The only change to your MCP server Docker image is installing the ADOT package as a production dependency:

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
# NODE_OPTIONS is set via ECS environment variables, not here.
CMD ["node", "dist/server.js"]

See the ECS deployment guide for the full SDK-based task definition registration and UpdateServiceCommand deployment flow, plus the complete environment variable reference table with explanation of each variable's role.

Deployment path 2: Lambda with ADOT layer

Lambda-based MCP servers use a layer rather than a sidecar. The ADOT Lambda layer contains three components bundled together: the Node.js require hook (equivalent to the auto-instrumentation package installed on ECS), an embedded OTEL collector running as a Lambda extension, and a handler wrapper script at /opt/otel-handler.

Enabling Application Signals on an existing Lambda function requires adding the layer ARN and setting three environment variables:

import {
  LambdaClient,
  UpdateFunctionConfigurationCommand
} from "@aws-sdk/client-lambda";

const lambda = new LambdaClient({ region: process.env.AWS_REGION });

async function enableApplicationSignalsOnLambda(functionName: string) {
  const region = process.env.AWS_REGION!;

  // Layer ARN is per-region and per-architecture.
  // Account 901920570463 is the AWS-managed ADOT layer account (consistent across regions).
  // Check https://github.com/aws-observability/aws-otel-lambda for current version numbers.
  const adotLayerArn = `arn:aws:lambda:${region}:901920570463:layer:aws-otel-nodejs-amd64-ver-1-18-1:4`;

  await lambda.send(new UpdateFunctionConfigurationCommand({
    FunctionName: functionName,
    Layers: [adotLayerArn],
    Environment: {
      Variables: {
        // Handler wrapper — MUST be exactly this path, not /opt/otel-sqs-handler
        AWS_LAMBDA_EXEC_WRAPPER: "/opt/otel-handler",
        // Enables Application Signals CloudWatch metrics pipeline
        OTEL_AWS_APPLICATION_SIGNALS_ENABLED: "true",
        // Service identity for the Application Signals service map
        OTEL_RESOURCE_ATTRIBUTES: "service.name=mcp-server,deployment.environment=production",
        OTEL_PROPAGATORS: "xray,tracecontext",
        OTEL_TRACES_SAMPLER: "xray"
      }
    }
  }));
}

When AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler is set, Lambda invokes the wrapper script before your handler. The wrapper exports NODE_OPTIONS=--require @aws/aws-distro-opentelemetry-node-autoinstrumentation/register into the execution environment and then execs your handler — the same auto-instrumentation model as ECS, managed by the layer instead of the task definition. Because the ADOT extension runs as a Lambda extension (not a separate process), it has access to the same execution role as your handler with no additional credential configuration.

Pin to a specific layer version ARN in production. AWS updates the ADOT Lambda layer with bug fixes and new OpenTelemetry versions, and unplanned updates to :latest can cause unexpected behavior changes. Upgrade the layer ARN in a planned maintenance window after testing in staging. To programmatically find the latest available version for your region and architecture:

import { LambdaClient, ListLayerVersionsCommand } from "@aws-sdk/client-lambda";

async function getLatestAdotLayerArn(architecture: "x86_64" | "arm64" = "x86_64") {
  const lambda = new LambdaClient({ region: process.env.AWS_REGION });
  const arch = architecture === "arm64" ? "arm64" : "amd64";
  const layerName = `aws-otel-nodejs-${arch}-ver-1-18-1`;

  const response = await lambda.send(new ListLayerVersionsCommand({
    LayerName: layerName,
    CompatibleRuntime: "nodejs22.x"
  }));

  const latest = response.LayerVersions?.[0]; // sorted descending
  if (!latest) throw new Error(`Layer ${layerName} not found in ${process.env.AWS_REGION}`);
  return latest.LayerVersionArn;
}

One common path confusion: use /opt/otel-handler for standard Lambda function URL invocations. The layer also includes /opt/otel-sqs-handler, which is designed for SQS-triggered Lambda functions that process messages in a batch. Using the SQS handler variant on an MCP server function URL deployment causes the wrapper to expect an SQS event structure and fail to properly initialize instrumentation for HTTP-style invocations.

Cold start impact and Provisioned Concurrency on Lambda

ADOT auto-instrumentation adds measurable cold start latency to Lambda functions. The layer must initialize the OpenTelemetry SDK, register instrumentation hooks for all patched libraries, and start the embedded OTEL collector extension. On typical Node.js Lambda functions serving MCP requests, this adds 300–600ms to cold start duration — which appears in Application Signals as elevated P99 latency for cold invocations.

The correct mental model: Application Signals is reporting the truth. Those cold-start invocations really did take 300–600ms longer than warm invocations. The question is whether that latency is acceptable under your SLO, and if not, how to mitigate it.

The primary mitigation is Provisioned Concurrency, which pre-warms a fixed number of execution environments. The ADOT SDK initialization runs during provisioning and is not counted in invocation latency for pre-warmed instances:

import {
  LambdaClient,
  PublishVersionCommand,
  PutProvisionedConcurrencyConfigCommand
} from "@aws-sdk/client-lambda";

const lambda = new LambdaClient({ region: process.env.AWS_REGION });

async function enableProvisionedConcurrency(functionName: string, concurrency: number) {
  // Provisioned concurrency requires a specific version or alias, not $LATEST
  const version = await lambda.send(new PublishVersionCommand({
    FunctionName: functionName
  }));

  await lambda.send(new PutProvisionedConcurrencyConfigCommand({
    FunctionName: functionName,
    Qualifier: version.Version!,
    ProvisionedConcurrentExecutions: concurrency
  }));

  console.log(`${concurrency} pre-warmed environments — ADOT cold start overhead eliminated`);
}

Secondary mitigation: narrow the instrumentation scope. The ADOT auto-instrumentation package instruments every supported library at startup, including PostgreSQL drivers, MongoDB clients, and Redis clients — even if your MCP server uses none of them. Setting OTEL_NODE_DISABLED_INSTRUMENTATIONS=pg,mysql2,redis,mongodb,mongoose skips unused instrumentations and reduces initialization time.

Application Signals surfaces cold start latency as elevated P99 that is not explained by the trace subsegments (all individual operation spans look fast). When you see this pattern, cross-reference with the AWS/Lambda InitDuration metric. If the P99 spikes align with InitDuration values in the 300–600ms range, ADOT cold start is the culprit and Provisioned Concurrency is the fix. See the Lambda deployment guide for the full cold start analysis workflow and SSE streaming function URL patterns.

ECS sidecar vs Lambda layer: deployment decision table

Both deployment paths produce the same Application Signals output — the same CloudWatch metrics namespace, the same service topology APIs, the same SLO primitives. The choice is about operational characteristics, not observability quality:

AttributeECS Fargate (ADOT sidecar)Lambda (ADOT layer)
ADOT collector location Separate sidecar container in the task Embedded Lambda extension alongside the handler
Auto-instrumentation activation NODE_OPTIONS in task definition environment AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
Package installation required? Yes — @aws/aws-distro-opentelemetry-node-autoinstrumentation in package.json No — bundled inside the layer
Cold start overhead None for a running ECS task; only at task restart 300–600ms per cold invocation; mitigate with Provisioned Concurrency
Memory overhead ADOT sidecar: 128–256MB memory reservation separate from app ADOT extension shares Lambda execution environment memory
Observability failure mode Sidecar crash: telemetry lost, service continues (essential:false) Extension crash: Lambda invocation fails (extension failures are fatal)
Collector config --config=...otel-task-metrics-config.yaml (bundled in image) Embedded in layer; controlled via environment variables only
SSE / streaming MCP Full support — TCP connections stay open as long as needed Requires RESPONSE_STREAM function URL mode; span closes on stream end
IAM attachment point ECS task role (not execution role) Lambda execution role
Layer/image versioning ADOT image tag pinned in task definition Layer ARN version pinned in function configuration

For MCP servers using SSE transport for streaming tool responses, ECS is structurally simpler — persistent TCP connections work without any special configuration. Lambda streaming via RESPONSE_STREAM mode works, but the ADOT span stays open for the full stream duration, which inflates P99 latency metrics for long streams. If you have mixed workloads (fast tool calls and long-running SSE streams), consider separate Lambda functions: one for the SSE connection endpoint and one for tool execution, with separate SLOs for each.

IAM configuration: task role vs execution role

Application Signals requires two categories of permissions that must be attached to different IAM roles. Getting this wrong is a common cause of partial telemetry — traces appear in X-Ray but no metrics appear in CloudWatch:

Runtime telemetry permissions (ECS task role or Lambda execution role) — these are needed at the application runtime level to allow the ADOT collector to export data:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "xray:PutTraceSegments",
        "xray:PutTelemetryRecords",
        "xray:GetSamplingRules",
        "xray:GetSamplingTargets"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": ["cloudwatch:PutMetricData"],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "cloudwatch:namespace": ["AWS/ApplicationSignals", "ECS/ContainerInsights"]
        }
      }
    }
  ]
}

The cloudwatch:PutMetricData condition scoping to AWS/ApplicationSignals (and ECS/ContainerInsights for ECS) is a least-privilege practice — the task role cannot write arbitrary metrics to any namespace. Without the X-Ray permissions, the ADOT collector's trace exporter fails silently: traces are dropped and Application Signals has no data to synthesize metrics from.

API read permissions (wherever your code calls the Application Signals SDK) — these are needed in any code that queries service health, lists operations, or reads SLO status:

{
  "Effect": "Allow",
  "Action": [
    "application-signals:ListServices",
    "application-signals:GetService",
    "application-signals:ListServiceOperations",
    "application-signals:ListServiceDependencies",
    "application-signals:ListServiceLevelObjectives",
    "application-signals:GetServiceLevelObjective",
    "application-signals:BatchGetServiceLevelObjectiveBudgetReport",
    "application-signals:CreateServiceLevelObjective",
    "application-signals:UpdateServiceLevelObjective",
    "application-signals:DeleteServiceLevelObjective"
  ],
  "Resource": "*"
}

For ECS, the execution role (used by ECS to pull images and push logs) needs only the standard AmazonECSTaskExecutionRolePolicy managed policy. The Application Signals and X-Ray permissions go on the task role — the IAM role assumed by the running container. Keep these roles separate: the execution role is used only at task startup and by the ECS control plane, not by application code.

Defining Service Level Objectives

Once Application Signals is emitting data, you can define SLOs against the discovered service operations using CreateServiceLevelObjectiveCommand. An SLO has three components: an SLI (the metric definition of a "good request"), an attainment goal (the target percentage of good requests), and a window (the period over which attainment is measured).

Application Signals supports two SLI metric types: AVAILABILITY (counts a request as good if it did not fault — no 5xx response) and LATENCY (counts a request as good if it completed within a threshold in milliseconds). For MCP servers, start with an availability SLO as the primary reliability commitment and a latency SLO as the secondary performance commitment:

import {
  ApplicationSignalsClient,
  CreateServiceLevelObjectiveCommand
} from "@aws-sdk/client-application-signals";

const client = new ApplicationSignalsClient({ region: process.env.AWS_REGION });

const mcpServiceKey = {
  "Type": "Service",
  "Name": "mcp-server",
  "Environment": "production"
};

// Primary SLO: 99.9% of tool calls must succeed (no 5xx faults)
await client.send(new CreateServiceLevelObjectiveCommand({
  Name: "mcp-server-tools-call-availability",
  Description: "99.9% of tools/call requests must not fault over 30 days",
  SliConfig: {
    SliMetricConfig: {
      KeyAttributes: mcpServiceKey,
      OperationName: "POST /mcp",
      MetricType: "AVAILABILITY"
    },
    MetricThreshold: 99.9,
    ComparisonOperator: "GreaterThanOrEqualTo"
  },
  Goal: {
    Interval: { RollingInterval: { DurationUnit: "DAY", Duration: 30 } },
    AttainmentGoal: 99.9,
    WarningThreshold: 99.5  // Alert before breach
  }
}));

// Secondary SLO: 95% of requests must complete under 2 seconds
await client.send(new CreateServiceLevelObjectiveCommand({
  Name: "mcp-server-latency-p95-2s",
  Description: "95% of tool call requests must complete within 2000ms",
  SliConfig: {
    SliMetricConfig: {
      KeyAttributes: mcpServiceKey,
      OperationName: "POST /mcp",
      MetricType: "LATENCY"
    },
    MetricThreshold: 2000,  // milliseconds
    ComparisonOperator: "LessThan"
  },
  Goal: {
    Interval: { RollingInterval: { DurationUnit: "DAY", Duration: 30 } },
    AttainmentGoal: 95.0,
    WarningThreshold: 94.0
  }
}));

Two precision requirements in CreateServiceLevelObjectiveCommand that cause silent SLO misconfiguration if violated: First, the OperationName must exactly match a name returned by ListServiceOperationsCommand — it is case-sensitive and must be precisely what ADOT detected. Run ListServiceOperationsCommand before creating SLOs to get the exact operation strings. If Application Signals has not discovered the operation yet (no traffic has flowed through it), creating an SLO against it will return INSUFFICIENT_DATA status immediately. Second, the ComparisonOperator for AVAILABILITY must be "GreaterThanOrEqualTo" (attainment should stay above the goal), while for LATENCY it must be "LessThan" (latency should stay below the threshold). Inverting these creates an SLO that always shows 100% attainment regardless of real error rates — a common and misleading misconfiguration.

Read current SLO health using BatchGetServiceLevelObjectiveBudgetReportCommand:

import {
  ListServiceLevelObjectivesCommand,
  BatchGetServiceLevelObjectiveBudgetReportCommand
} from "@aws-sdk/client-application-signals";

async function getMcpServerSloHealth() {
  const now = new Date();

  const listResponse = await client.send(new ListServiceLevelObjectivesCommand({
    KeyAttributes: mcpServiceKey
  }));

  const sloIds = listResponse.SloSummaries?.map(s => s.Id!) ?? [];
  if (!sloIds.length) return { status: "no_slos_defined" };

  const budgetResponse = await client.send(new BatchGetServiceLevelObjectiveBudgetReportCommand({
    Timestamp: now,
    SloIds: sloIds
  }));

  const reports = budgetResponse.Reports?.map(r => ({
    name: r.Name,
    attainment: r.Attainment,
    missedRequests: r.MissedRequestCount,
    totalRequests: r.TotalRequestCount,
    budgetSecondsRemaining: r.BudgetSecondsRemaining,
    // "OK" | "WARNING" | "BREACHED" | "INSUFFICIENT_DATA"
    budgetStatus: r.BudgetStatus,
    // "ACHIEVED" | "NEARLY_BREACHED" | "BREACHED" | "INSUFFICIENT_DATA"
    sloStatus: r.SloClassification
  }));

  const breached = reports?.filter(r => r.sloStatus === "BREACHED") ?? [];
  const warning = reports?.filter(r => r.sloStatus === "NEARLY_BREACHED") ?? [];

  return {
    status: breached.length > 0 ? "breach" : warning.length > 0 ? "warning" : "ok",
    breached: breached.map(r => r.name),
    warning: warning.map(r => r.name),
    slos: reports
  };
}

// Expose as a /reliability endpoint on your MCP server:
// { status: "ok", breached: [], warning: [], slos: [...] }

The BudgetSecondsRemaining field tells you how much error budget remains in absolute terms. For a 30-day rolling window, budget is consumed continuously as bad requests arrive — when this drops below 86,400 seconds (one day), you are approaching breach and should halt risky deployments.

Per-tool SLOs with custom OpenTelemetry spans

The fundamental challenge with SLOs on MCP servers is that the standard Streamable HTTP transport routes all tool calls through POST /mcp. Application Signals discovers one operation for the entire MCP server, not one per tool. A single availability SLO across all operations conflates tool workloads with very different latency profiles — a 50ms search tool and a 15-second document generation tool should have different SLO thresholds.

The solution is adding a custom OpenTelemetry span for each tool call with the aws.local.operation attribute set to the tool name. Application Signals uses this attribute to synthesize per-operation metrics in CloudWatch, surfacing each tool as a separate operation in the service map:

import { trace } from "@opentelemetry/api";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";

const server = new McpServer({ name: "mcp-server", version: "1.0.0" });
const tracer = trace.getTracer("mcp-server");

// Wrapper that creates a named span Application Signals uses for per-tool metrics
function withToolSpan<T>(toolName: string, fn: () => Promise<T>): Promise<T> {
  return tracer.startActiveSpan(toolName, (span) => {
    // Application Signals reads aws.local.operation to group per-tool metrics
    span.setAttribute("aws.local.operation", toolName);
    span.setAttribute("mcp.tool.name", toolName);
    return fn()
      .then(result => { span.end(); return result; })
      .catch(err => {
        span.recordException(err);
        span.setStatus({ code: 2, message: err.message });
        span.end();
        throw err;
      });
  });
}

// Fast tool: tight latency budget
server.tool("search", { query: z.string() }, async ({ query }) => {
  return withToolSpan("search", async () => {
    const results = await searchIndex(query);
    return { content: [{ type: "text", text: JSON.stringify(results) }] };
  });
});

// Slow tool: different latency budget
server.tool("generate-report", { reportId: z.string() }, async ({ reportId }) => {
  return withToolSpan("generate-report", async () => {
    const report = await buildReport(reportId);
    return { content: [{ type: "text", text: report }] };
  });
});

Once custom spans are emitting with aws.local.operation set to the tool name, Application Signals surfaces them as separate operations. You can then define distinct SLOs for each: "search" with a 200ms latency target at 99th percentile, and "generate-report" with a 15-second latency target at 95th percentile. The error budget for a brief DynamoDB hiccup affecting search queries no longer contaminates the error budget for document generation, and vice versa.

The upsert pattern for managing per-tool SLOs as code — checking for an existing SLO before creating or updating:

async function upsertToolSlo(config: {
  name: string;
  toolOperation: string;
  metricType: "AVAILABILITY" | "LATENCY";
  threshold: number;
  goalPercent: number;
  warningPercent: number;
  windowDays: 7 | 14 | 30;
}) {
  const existing = await client.send(new ListServiceLevelObjectivesCommand({
    KeyAttributes: mcpServiceKey
  }));
  const existingSlo = existing.SloSummaries?.find(s => s.Name === config.name);

  const sloBody = {
    SliConfig: {
      SliMetricConfig: {
        KeyAttributes: mcpServiceKey,
        OperationName: config.toolOperation,
        MetricType: config.metricType
      },
      MetricThreshold: config.threshold,
      ComparisonOperator: config.metricType === "AVAILABILITY"
        ? "GreaterThanOrEqualTo" as const
        : "LessThan" as const
    },
    Goal: {
      Interval: { RollingInterval: { DurationUnit: "DAY" as const, Duration: config.windowDays } },
      AttainmentGoal: config.goalPercent,
      WarningThreshold: config.warningPercent
    }
  };

  if (existingSlo?.Id) {
    await client.send(new UpdateServiceLevelObjectiveCommand({ Id: existingSlo.Id, ...sloBody }));
  } else {
    await client.send(new CreateServiceLevelObjectiveCommand({ Name: config.name, ...sloBody }));
  }
}

// Commit these alongside your infrastructure code:
await upsertToolSlo({ name: "search-availability", toolOperation: "search",
  metricType: "AVAILABILITY", threshold: 99.9, goalPercent: 99.9, warningPercent: 99.5, windowDays: 30 });
await upsertToolSlo({ name: "search-latency-200ms", toolOperation: "search",
  metricType: "LATENCY", threshold: 200, goalPercent: 99.0, warningPercent: 98.0, windowDays: 7 });
await upsertToolSlo({ name: "generate-report-latency-15s", toolOperation: "generate-report",
  metricType: "LATENCY", threshold: 15000, goalPercent: 95.0, warningPercent: 93.0, windowDays: 30 });

See the SLO guide for the full SLO lifecycle — listing, updating, deleting, and reading budget reports across multiple SLOs in batch.

Burn-rate alarms: the two-alarm pattern

An SLO breach alert fires too late. By the time attainment drops below 99.9%, the error budget for the month is already gone. Burn-rate alarms are the production solution: they fire when the error budget is consuming faster than is sustainable, before the budget is exhausted.

The concept: if your 30-day error budget allows 0.1% faults (1 in 1000 requests bad), and your fault rate over the last 5 minutes is 1% (10× budget), you will exhaust the month's budget in 3 days. Alert at that 10× burn rate now, not after the breach.

Application Signals does not create burn-rate alarms automatically. You build them from the base Application Signals metrics using CloudWatch metric math alarms. The two-alarm pattern — a fast alarm (5-minute window) and a slow alarm (20-minute window, evaluated over 1 hour) — covers both sudden incidents and gradual degradation:

import { CloudWatchClient, PutMetricAlarmCommand } from "@aws-sdk/client-cloudwatch";

const cw = new CloudWatchClient({ region: process.env.AWS_REGION });

const baseFaultDimensions = [
  { Name: "Service", Value: "mcp-server" },
  { Name: "Environment", Value: "production" },
  { Name: "Operation", Value: "POST /mcp" }
];

function faultRateAlarmMetrics(periodSeconds: number) {
  return [
    {
      Id: "faults",
      MetricStat: {
        Metric: { Namespace: "AWS/ApplicationSignals", MetricName: "Fault",
          Dimensions: baseFaultDimensions },
        Period: periodSeconds, Stat: "Sum"
      }
    },
    {
      Id: "total",
      MetricStat: {
        Metric: { Namespace: "AWS/ApplicationSignals", MetricName: "Latency",
          Dimensions: baseFaultDimensions },
        Period: periodSeconds, Stat: "SampleCount"
      }
    },
    {
      Id: "fault_rate",
      Expression: "(faults / total) * 100",
      Label: "FaultRatePercent"
    }
  ];
}

// FAST alarm: fault rate > 1% over 5 minutes (10× burn rate on 99.9% SLO)
// Catches: deployment incidents, sudden dependency failures
await cw.send(new PutMetricAlarmCommand({
  AlarmName: "mcp-server-slo-burn-fast",
  AlarmDescription: "MCP fault rate > 1% — error budget burning at 10× rate",
  ComparisonOperator: "GreaterThanThreshold",
  EvaluationPeriods: 2,    // Must exceed threshold for 2 consecutive 5m periods
  Threshold: 1.0,
  TreatMissingData: "notBreaching",
  Metrics: faultRateAlarmMetrics(300),  // 5-minute evaluation window
  AlarmActions: [snsTopicArn],
  OKActions: [snsTopicArn]
}));

// SLOW alarm: fault rate > 0.1% over 20 minutes (1× burn rate — the budget ceiling)
// Catches: memory leaks, gradual connection pool exhaustion, slow dependency degradation
await cw.send(new PutMetricAlarmCommand({
  AlarmName: "mcp-server-slo-burn-slow",
  AlarmDescription: "MCP fault rate > 0.1% over 1h — budget burn at or above ceiling",
  ComparisonOperator: "GreaterThanThreshold",
  EvaluationPeriods: 3,    // 3 × 20m = 1 hour at this rate
  Threshold: 0.1,
  TreatMissingData: "notBreaching",
  Metrics: faultRateAlarmMetrics(1200),  // 20-minute evaluation window
  AlarmActions: [snsTopicArn],
  OKActions: [snsTopicArn]
}));

The two alarms catch orthogonal failure modes. The fast alarm (5-minute window, 1% threshold) catches a deployment that starts throwing errors immediately — you get paged within 10 minutes. The slow alarm (20-minute window, 0.1% threshold) catches a memory leak or connection pool exhaustion that slowly increases fault rate over hours — the fast alarm never fires because no single 5-minute window exceeds 1%, but the error budget is quietly draining. Both are needed; neither is sufficient alone.

Low-traffic MCP servers (under 100 requests per 5-minute period) need an additional floor condition. When total request count is small, a single fault can produce a large percentage fault rate and trigger the alarm spuriously. Add a second alarm that suppresses the fault rate alarm when total request count is below a floor, or use TreatMissingData: "notBreaching" alongside a minimum request count metric math expression:

// Guards against false alarms from single-fault spikes on low-traffic servers
const faultRateWithFloor = [
  ...faultRateAlarmMetrics(300),
  {
    Id: "sufficient_traffic",
    Expression: "IF(total > 10, fault_rate, 0)",  // Only report fault rate if >10 requests
    Label: "FaultRateWithFloor"
  }
];

Consolidated failure patterns and fixes

SymptomRoot causeFix
No services appear in Application Signals after deployment OTEL_AWS_APPLICATION_SIGNALS_ENABLED not "true" (lowercase), or ADOT collector not running Confirm the value is exactly the string "true"; verify the ADOT collector sidecar or Lambda extension is running; check collector logs for X-Ray or CloudWatch export errors (usually IAM denials)
X-Ray traces appear but Application Signals CloudWatch metrics do not Missing cloudwatch:PutMetricData on the task/execution role, or value is "True"/1 instead of "true" Add cloudwatch:PutMetricData scoped to the AWS/ApplicationSignals namespace condition; confirm the case of the environment variable value
ListServicesCommand returns empty list despite active traffic Time window too narrow, or region mismatch Use at least a 1-hour window; ensure the ApplicationSignalsClient region matches the deployment region (Application Signals data is region-specific)
SLO shows INSUFFICIENT_DATA immediately after creation OperationName does not match a discovered operation (case-sensitive), or no traffic has flowed yet Call ListServiceOperationsCommand first to get exact operation names; send at least one request through the MCP server before creating per-operation SLOs
SLO attainment always shows 100% despite known errors MetricType set to LATENCY when you wanted availability, or ComparisonOperator inverted Use AVAILABILITY for success-rate SLOs; use LessThan for latency SLOs with MetricThreshold in milliseconds
ECS ADOT collector exits at startup Wrong config path in the command field, or image version too old Use the exact path --config=/etc/ecs/container-insights/otel-task-metrics-config.yaml; use image version ≥ v0.38.0 which includes Application Signals support
Lambda function fails to start after adding ADOT layer AWS_LAMBDA_EXEC_WRAPPER set to wrong path (e.g., /opt/otel-sqs-handler) Use exactly /opt/otel-handler for function URL invocations; /opt/otel-sqs-handler is for SQS-triggered Lambda and expects a different event structure
Lambda Application Signals shows elevated P99 with fast traces ADOT cold start latency (300–600ms) inflating metrics on cold invocations Cross-check with AWS/Lambda InitDuration metric; use Provisioned Concurrency to eliminate cold starts; consider a 95th-percentile SLO rather than 99th to tolerate occasional cold start spikes
Burn-rate alarms fire constantly on low-traffic server Single fault in a 5-minute window with low total request count produces artificially high fault-rate percentage Add minimum request count floor using metric math; use TreatMissingData: "notBreaching"; consider a 7-day SLO window (more data, more stable percentage)
Per-tool SLOs show INSUFFICIENT_DATA despite tool being called aws.local.operation custom span attribute not being set, or the span is not being exported Confirm the withToolSpan wrapper is active; verify ADOT is initialized before the first tool call (ECS: check dependsOn; Lambda: confirm layer is attached and AWS_LAMBDA_EXEC_WRAPPER is set)
NODE_OPTIONS not taking effect on ECS (no OTEL initialization in logs) NODE_OPTIONS overridden by a value baked into the Docker image, or container CMD uses a shell wrapper that resets environment Check the ECS task definition effective environment in the console; ensure the Dockerfile does not set ENV NODE_OPTIONS; task definition values take precedence over image ENV but not over CMD-level env resets

Putting it together: the full observability architecture

The four guides in this arc assemble into a layered observability architecture for production MCP servers. Each layer answers a different class of operational question:

Application Signals measures what happens inside a healthy invocation: which operations are slow, which dependencies are misbehaving, whether the SLO attainment is trending toward breach. What it cannot measure is whether your MCP server is reachable at all from the outside — a completely unreachable server generates no traces and no Application Signals data, so there is no metric to alert on. AliveMCP provides active probe-based uptime monitoring that detects this scenario immediately: external probes poll your MCP endpoint every minute and fire Slack and email alerts the moment your server stops responding, complementing your Application Signals telemetry with a signal that works even when your infrastructure is completely dark.