Skip to content

Comments

feat: wire scaffold MCP server flow with Lambda-only host#421

Open
aidandaly24 wants to merge 5 commits intoaws:feat/gateway-integrationfrom
aidandaly24:feat/batch-5-scaffold-mcp-server-cli
Open

feat: wire scaffold MCP server flow with Lambda-only host#421
aidandaly24 wants to merge 5 commits intoaws:feat/gateway-integrationfrom
aidandaly24:feat/batch-5-scaffold-mcp-server-cli

Conversation

@aidandaly24
Copy link
Contributor

Description

Wire the scaffold MCP server flow end-to-end in both CLI and TUI, with Lambda as the only supported compute host for Phase 1.

What this PR does

CLI routing by source type:
The handleAddGatewayTarget handler now branches based on --source:

  • existing-endpoint → calls createExternalGatewayTarget (writes config only, no scaffolding)
  • create-new → calls createToolFromWizard (scaffolds files + writes config)

Previously, the CLI always called createToolFromWizard regardless of source, which would fail for existing endpoints.

New mcpServerScaffold targetType:
Scaffolded Lambda MCP servers now use targetType: 'mcpServerScaffold' instead of 'lambda'. This lets CDK (Task 15) distinguish "deploy this Lambda from scaffolded FastMCP code" from raw Lambda targets. Schema validation requires compute config for this type.

Lambda-only compute host for Phase 1:

  • TUI: Removed the host selection step from the create-new wizard flow — always defaults to Lambda
  • CLI: Rejects --host AgentCoreRuntime when --source create-new
  • CLI: Rejects --host when --source existing-endpoint (not applicable)
  • Defaults --source to create-new and --host to Lambda when not specified

AgentCoreRuntime as a scaffold compute host is a later phase. The underlying code paths remain but are gated and unreachable in Phase 1.

Phase 1 gateway target flows after this PR

Flow targetType Status
External MCP server endpoint mcpServer + endpoint Works end-to-end
Scaffold new MCP server on Lambda mcpServerScaffold + compute CLI works, CDK pending Task 15

Related Issue

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

Depends on Task 13 (FastMCP Lambda template) — PR #TBD.

Type of Change

  • New feature

Testing

How have you tested the change?

  • 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

3 new schema tests:

  • mcpServerScaffold accepted in targetType enum
  • mcpServerScaffold without compute fails validation
  • mcpServerScaffold with compute passes validation

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 24, 2026
@aidandaly24 aidandaly24 force-pushed the feat/batch-5-scaffold-mcp-server-cli branch from 539f1b2 to e661bf5 Compare February 24, 2026 19:42
@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Feb 24, 2026
Add python-fastmcp-lambda template for scaffolding MCP servers that
run on AWS Lambda with function URLs. Uses FastMCP for tool definitions
and Mangum as the ASGI-to-Lambda adapter.

Template includes sample HTTP tools (lookup_ip, get_random_user,
fetch_post) matching the existing python/ template patterns.

Updates GatewayTargetRenderer to select this template when the
compute host is Lambda.
The CLI writes handler: 'handler.lambda_handler' in compute config.
The template must export lambda_handler, not handler.
Route CLI gateway-target command based on source: existing-endpoint
calls createExternalGatewayTarget, create-new calls createToolFromWizard.

Add mcpServerScaffold targetType for scaffolded Lambda MCP servers,
distinguishing them from external mcpServer endpoints and raw lambda
targets. CDK support for mcpServerScaffold comes in Task 15.

Restrict scaffold flow to Lambda-only compute host:
- TUI: skip host selection step (always Lambda)
- CLI: reject --host AgentCoreRuntime for create-new
- CLI: reject --host with existing-endpoint

Default --source to create-new and --host to Lambda when not specified.
Test source/host defaults, Lambda-only enforcement, --host rejection
for existing-endpoint, and handleAddGatewayTarget routing based on
source type.
Remove mcpServerScaffold — unnecessary complexity. CDK can distinguish
scaffolded vs external targets by checking compute vs endpoint fields:
- mcpServer + endpoint = external MCP server
- mcpServer + compute = scaffolded, deploy Lambda + function URL
@aidandaly24 aidandaly24 force-pushed the feat/batch-5-scaffold-mcp-server-cli branch from 95b9eea to 03f8171 Compare February 24, 2026 23:04
@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Feb 24, 2026
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.

1 participant