Skip to content

feat(scripts): Validate MCP servers before building the image - #19

Merged
morgnza merged 1 commit into
aws-samples:mainfrom
anderscarlssn:feat/forwarding-validation-gate
Jul 20, 2026
Merged

feat(scripts): Validate MCP servers before building the image#19
morgnza merged 1 commit into
aws-samples:mainfrom
anderscarlssn:feat/forwarding-validation-gate

Conversation

@anderscarlssn

Copy link
Copy Markdown
Contributor

Summary

Adds a validation gate to setup_mcp_forwarding.sh so a broken MCP tool forwarding setup is caught on the build instance, before the ~25 minutes of AMI creation and image import.

What changed

  • New Step 7 gate (steps renumbered to 1-11): after the servers and manifest are written, the script pushes the compatibility tester to the build instance, runs it against the manifest, and on any failure prints the report, terminates the instance, and aborts before the AMI.
  • base64 portability: replaced the base64 -w0 <file> calls with the POSIX form base64 < file | tr -d '\n', so the script runs on macOS/BSD as well as GNU/Linux (the positional-file form only works on GNU base64). Output is byte-identical on Linux.
  • .gitignore: added build/ and .pytest_cache/.
  • README: realigned one project-structure comment (follow-up to the rename PR).

Testing

  • Broken server (lists zero tools): gate reports INCOMPATIBLE, terminates the build instance, and aborts before the AMI.
  • Valid config: gate reports OK, the build proceeds and completes to a RUNNING fleet. Verified end to end.
  • bash -n and scripts/ci_local.sh pass.

Add a validation gate (Step 7) to setup_mcp_forwarding.sh that runs the MCP
tool forwarding compatibility tester on the build instance, against the manifest
just written, before the AMI is created. If any configured server would fail to
forward (lists no tools, fails to spawn or handshake, or exceeds the 5s budget),
it prints the report, terminates the build instance, and aborts, saving the ~25
minutes of AMI creation and image import.

Also make the script's base64 calls portable so it runs on macOS/BSD as well as
GNU/Linux, and add build/ and .pytest_cache/ to .gitignore.
@morgnza
morgnza merged commit 2d9ef33 into aws-samples:main Jul 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants