Skip to content

refactor(examples/mcp-app): factory entry, src/mcp/<server-id>.ts convention, and the mcp run doc flow (RFC #50 Phase 2) - #56

Merged
ScriptedAlchemy merged 4 commits into
mainfrom
feat/mcp-app-phase2
Aug 31, 2026
Merged

ScriptedAlchemy merged 4 commits into
mainfrom
feat/mcp-app-phase2

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Phase-2 migration of examples/mcp-app onto the RFC #50 Phase-1 surface merged in #52. mcp-app is the raw v2-SDK witness for the generated stdio shell (audiobook-curator covers the RSC path), the only in-repo witness for the src/mcp/<server-id>.ts entry convention, and now the doc witness for agent-bundle mcp run.

  • Factory conversion — src/mcp-server.ts drops its self-connecting bootstrap (StdioServerTransport import + top-level await server.connect(...)) for a default-exported factory. The generated shell now owns the transport, console-to-stderr guard, SIGINT/SIGTERM (130/143), stdin-EOF exit 0, 5 s bounded shutdown, and heartbeat.
  • Entry convention — the file moves to src/mcp/status.ts (the declared server id) and the config drops its entry: line. agent-bundle inspect now reports the server with provenance: { kind: 'conventional' }; packageBuild stays absent so the default dist artifact output is untouched (no AB4706).
  • Script envelope — src/scripts/check-service-fixture.ts rewrites its self-executing try/catch to export const main returning 0/1; the generated process envelope owns argv and exit-code adoption. Stdout/stderr/exit contracts are byte-identical.
  • README — the authored-files prose names the new path, factory shape, and framework lifecycle; Noninteractive checks documents the verified agent-bundle mcp run --server status --target portable foreground flow (temp artifact when --artifact is absent, --artifact dist reuse, EOF → 0, Ctrl-C → 130, state under .agent-bundle/mcp-run/portable/status).

packages/agent-bundle/tests/examples-contract.test.ts needed zero edits — all migrations are behavior-preserving.

Verification

  • pnpm --filter @agent-bundle-example/mcp-app check — validate + build, zero diagnostics; all three targets emit the wrapped entry from src/mcp/status.ts.
  • agent-bundle eval --case status-is-healthy --trials 1 — 1 passed.
  • Examples-contract integration file (prebuilt flags) — all three it blocks pass untouched, including listMcp/invokeMcp through the wrapped factory, the inspect shape, payments-api present in every compiled MCP entry, and both script contracts (exact stdout; stale fixture exits 1 with the pinned stderr).
  • pnpm test:examples:browser — 4/4 pass in real Chrome, including the full MCP App workflow tour (App preview, protocol trace, session restart).
  • Root pnpm typecheck and pnpm lint — clean.
  • mcp run smoked three ways: against --artifact dist (initialize handshake on stdout, [status] heartbeat on stderr), without --artifact (temp artifact built in-project and removed), and SIGINT (exit 130).

Refs RFC #50 (Phase 2); builds on #52.

…ult-exported factory

The self-connecting bootstrap (StdioServerTransport import + top-level
server.connect) is deleted; the generated stdio shell from RFC #50 Phase 1
now owns the transport, console-to-stderr guard, signal handling, stdin-EOF
exit, bounded shutdown, and heartbeat. This is the raw v2-SDK witness for
the shell (audiobook-curator covers the RSC path).
…nvention

src/mcp-server.ts moves to src/mcp/status.ts (the declared server id) and
the config drops its entry: line — the framework discovers the entry
because the status server declares no entry/command/url, and inspect now
reports provenance kind 'conventional'. This is the only in-repo witness
for the convention.
The self-executing try/catch envelope becomes an exported main returning
0/1; the generated process envelope owns argv, awaiting, and exit-code
adoption. Stdout, stderr, and exit-code contracts are unchanged.
…un foreground flow

The authored-files prose now names src/mcp/status.ts, the factory shape,
and the generated lifecycle shell; Noninteractive checks gains the
verified `agent-bundle mcp run --server status --target portable` flow
(temp artifact when --artifact is absent, EOF exits 0, Ctrl-C exits 130).
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 88410b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T02:30:38.286406Z 88410b9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@56
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/rsc-runtime@56

commit: 88410b9

@ScriptedAlchemy
ScriptedAlchemy merged commit 58cd271 into main Aug 31, 2026
9 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the feat/mcp-app-phase2 branch August 31, 2026 02:41
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.

1 participant