feat: wire scaffold MCP server flow with Lambda-only host#421
Open
aidandaly24 wants to merge 5 commits intoaws:feat/gateway-integrationfrom
Open
feat: wire scaffold MCP server flow with Lambda-only host#421aidandaly24 wants to merge 5 commits intoaws:feat/gateway-integrationfrom
aidandaly24 wants to merge 5 commits intoaws:feat/gateway-integrationfrom
Conversation
539f1b2 to
e661bf5
Compare
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
95b9eea to
03f8171
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
handleAddGatewayTargethandler now branches based on--source:existing-endpoint→ callscreateExternalGatewayTarget(writes config only, no scaffolding)create-new→ callscreateToolFromWizard(scaffolds files + writes config)Previously, the CLI always called
createToolFromWizardregardless of source, which would fail for existing endpoints.New
mcpServerScaffoldtargetType: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:
--host AgentCoreRuntimewhen--source create-new--hostwhen--source existing-endpoint(not applicable)--sourcetocreate-newand--hosttoLambdawhen not specifiedAgentCoreRuntime 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
mcpServer+ endpointmcpServerScaffold+ computeRelated 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
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshots3 new schema tests:
mcpServerScaffoldaccepted in targetType enummcpServerScaffoldwithout compute fails validationmcpServerScaffoldwith compute passes validationChecklist