Published
Securing AWS MCP Servers: IAM Session Policies, SourceIdentity and CloudTrail Evidence
Authorize MCP tools server-side, issue scoped AWS sessions from trusted identity and correlate tool decisions with CloudTrail without logging secrets.
A production MCP server is a privileged application boundary. Its tool descriptions help a client discover operations; they do not authorize a user, constrain a database query or prove who initiated an AWS change. Build the evidence chain from authenticated subject to tool decision to downstream action, including actions that never reach AWS.
Start with a tool-to-permission register
For each tool, identify the authenticated caller population, tenant boundary, allowed resources, downstream AWS role and approval requirement. Separate inventory from mutation. An agent allowed to list alarms should not inherit a generic operator role capable of deleting unrelated infrastructure. Validate tool arguments on the server and enforce resource ownership after resolving identifiers.
| Boundary | Enforcement | Evidence |
|---|---|---|
| Client to MCP | Validated token audience, issuer and authorized subject | Authentication decision with bounded identifiers |
| Tool dispatch | Allowed tool, schema and resource/tenant checks | Tool version, decision and correlation ID |
| MCP to STS | Trusted identity mapping, role trust and session restrictions | AssumeRole request and session context |
| Session to AWS API | Role/session policies and applicable resource policies | AWS request ID and configured CloudTrail event |
| Operator action | Explicit bounded approval where required | Approval, outcome and recovery receipt |
Do not pass an inbound bearer token to an unrelated downstream service. Read the MCP security guidance for authorization boundaries and confused-deputy risks. A prompt injection must not be able to turn a read-only tool into an arbitrary AWS CLI executor.
Issue sessions from trusted identity
AWS session tags can carry approved ownership dimensions. TransitiveTagKeys identifies tags intended to survive role chaining; trust and permission policies must permit and constrain the relevant tagging operations. Do not let the model choose its own tenant, administrator tag or budget owner.
Use a separate authenticated broker to derive SourceIdentity and approved tags from the caller identity. AWS documents SourceIdentity for relating supported assumed-role activity to its origin. Configure role trust permissions and chaining deliberately; service-mediated actions and service-linked roles have visibility limitations. Test the identity that actually appears instead of assuming every downstream service preserves the same attribution.
{
"synthetic": true,
"tool_call_id": "fixture-call-017",
"subject_ref": "opaque-approved-subject",
"tool": "describe_scoped_alarms",
"resource_scope": "approved-application-a",
"authorization": "allow",
"source_identity": "broker-derived-subject",
"aws_request_id": "fixture-request-017",
"result": "completed"
}
This is a proposed audit envelope, not the response of an MCP or AWS API. Record the corresponding denied decision without sensitive arguments. Use keyed correlation or restricted references where identifiers themselves are sensitive. Never store AWS credentials, bearer tokens or full prompt/tool content in a general audit log.
Reduce permissions at the downstream boundary
A session policy restricts the permissions available to a role session; it does not grant additional permissions beyond the applicable role permissions. Build small resource/action allowlists for each approved tool class, use short-lived sessions and test the complete effective policy context. Conditions, resource policies, permissions boundaries and organization controls can affect the result, so a successful simulator check is not the only acceptance evidence.
Test a permitted resource, a neighboring unauthorized resource, a different tenant, malformed arguments and a caller requesting a forbidden tag or role. Where changes require approval, bind the approval to the exact action, resource, expiry and request identity. Reusing an approval for a different tool call must fail.
Correlate CloudTrail without overstating coverage
CloudTrail records configured, supported AWS API activity; it does not automatically record every MCP tool call, a SQL statement inside a database, an application rejection or a no-op. Identify management/data event requirements and cost for the selected services. Match a synthetic tool audit record to the STS context, AWS request and observed CloudTrail event. Measure delivery lag and retain a gap when the expected event is missing.
Keep the server audit log for decisions outside AWS visibility, with access controls and integrity/retention appropriate to the boundary. Reconcile tool-start records with completed, rejected and unknown outcomes. A timeout can mean the downstream change completed while the caller lost the response; use idempotency and bounded status checks before retrying a mutation.
Use the AI evidence guide for control mapping. The Continuous Evidence Sprint is $9,500–$14,500 for its agreed scope; a narrower NIST hardening engagement starts at $2,950. Neither substitutes for authorization by your assessor or agency.
Frequently asked questions
Does CloudTrail record every MCP tool call?
No. It records supported AWS events under the configured coverage. Application decisions, database operations and rejected tool calls may require separate audit sources.
Can the client set its own trusted identity tags?
Do not trust arbitrary client or model tags. Derive identity and permitted tags through an authenticated broker, constrain session tagging and test forbidden tag attempts.
Does a session policy grant extra role permissions?
No. It restricts the role session within the applicable policy context. Validate the actual effective permissions and both allowed and denied resource cases.
Continue reading
- Bedrock in FedRAMP and NIST 800-53 Environments: Guardrails and Audit Evidence
Map Bedrock network, identity, Guardrails and logging evidence to owned NIST controls, with authorized-scope checks and negative fixtures.
- Bedrock Knowledge Base Costs: OpenSearch Serverless OCUs vs Aurora pgvector
Compare classic and NextGen OpenSearch capacity with Aurora pgvector, then stage a Bedrock knowledge-base migration with retrieval and rollback checks.
- Bedrock Model Invocation Logging: Direct S3, Athena and CloudWatch Cost Boundaries
Use a reviewed S3-only Bedrock invocation-log route, verify endpoint coverage and build an auditable Athena pipeline without assuming universal CloudWatch rates.
Written by
Tymur Chmeruk
Cloud Security & Infrastructure Engineer · Baltimore–Washington Metro · [email protected]