Skip to content

fix: CDK template types and credential ARN passthrough for gateway deploy#432

Merged
jesseturner21 merged 8 commits intoaws:feat/gateway-integrationfrom
aidandaly24:fix/cdk-template-type-mismatch
Feb 26, 2026
Merged

fix: CDK template types and credential ARN passthrough for gateway deploy#432
jesseturner21 merged 8 commits intoaws:feat/gateway-integrationfrom
aidandaly24:fix/cdk-template-type-mismatch

Conversation

@aidandaly24
Copy link
Contributor

@aidandaly24 aidandaly24 commented Feb 25, 2026

Description

Fixes CDK template types, credential handling, and deploy flow ordering for gateway target deployment.

CDK template type mismatches (1ee255f)

  • McpSpecAgentCoreMcpSpec (type was renamed in CDK package)
  • Removed McpDeployedState — no longer exists in CDK package
  • Fixed prop names passed to AgentCoreMcp: projectName, mcpSpec, agentCoreApplication
  • Removed unused fs import from bin/cdk.ts

API key credential ARNs not collected during deploy (e178d79)

  • createApiKeyProvider and updateApiKeyProvider now fetch and return credentialProviderArn via Get call after create/update
  • ApiKeyProviderSetupResult now includes credentialProviderArn field
  • Unified deployedCredentials map collects ARNs from both API Key and OAuth credential providers (previously only OAuth ARNs were collected)
  • Moved credential setup BEFORE CDK synth (was after synth) so credential ARNs are available when the CDK template reads deployed state
  • Writes partial deployed state with credential ARNs before synth without corrupting existing agents/gateways/stackName

CDK template credential passthrough (ac4a5af)

  • bin/cdk.ts reads deployed-state.json and extracts credential ARNs per deployment target
  • cdk-stack.ts accepts credentials prop and passes it to AgentCoreMcp construct
  • Gateway targets with outbound auth (API Key, OAuth) can now resolve credential provider ARNs during CDK synth

TUI deploy flow reorder (e01a7fc)

  • Moved credential check (hasIdentityApiProviders + hasIdentityOAuthProviders) before CDK synth in TUI preflight
  • Identity-setup handler writes partial deployed state and re-synths after credential creation
  • Both CLI and TUI deploy paths now create credentials before synth

OAuth credential ARN fetch (8303abc)

  • createOAuth2Provider and updateOAuth2Provider now fetch credentialProviderArn via Get call after create/update (same pattern as API Key fix)

Gateway output parser (c54ade7)

  • Handle Mcp prefix in CloudFormation output keys (CDK nests gateway under Mcp/Gateway{Name}, producing output keys like McpGatewayMyGatewayUrlOutput instead of GatewayMyGatewayUrlOutput)

CDK version bump (1d78ead)

  • Bump aws-cdk-lib to 2.239.0 in project template — required for credentialProviderConfigurations to be optional (NoAuth support for MCP server targets)

Without these fixes, deploying a gateway target with outbound auth fails with Credential "X" not found in deployed state.

Related Issue

Part of the MCP Gateway Phase 1 integration (gateway-integration branch).

Type of Change

  • Bug fix

Testing

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

End-to-end tested: deployed gateway targets with both OAuth and NoAuth, agent successfully invoked tools through the gateway.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Feb 25, 2026
The CDK stack template used McpSpec (doesn't exist) instead of
AgentCoreMcpSpec, and passed wrong prop names to AgentCoreMcp:
- spec → mcpSpec
- application → agentCoreApplication
- Added missing projectName prop
…re CDK synth

API key credential providers were created during deploy but their ARNs
were not stored in deployed state, causing CDK to fail with 'Credential
not found in deployed state' for gateway targets with API key auth.

- Return credentialProviderArn from create/update API key providers
- Unify API key and OAuth credential ARNs into single deployed state map
- Move credential setup before CDK synth so template can read ARNs
- Write partial deployed state with credentials before synth
CDK template now reads deployed-state.json and extracts credential
provider ARNs per target, passing them to AgentCoreMcp so gateway
targets can reference outbound auth credentials.
@aidandaly24 aidandaly24 force-pushed the fix/cdk-template-type-mismatch branch from 4894ebe to 8f65e67 Compare February 25, 2026 19:23
@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Feb 25, 2026
Copy link
Contributor

@jesseturner21 jesseturner21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jesseturner21 jesseturner21 merged commit da3a2b4 into aws:feat/gateway-integration Feb 26, 2026
12 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants