History

Auto-connect stdio MCP servers; store env as connection secrets (#1129)

* Auto-connect stdio MCP servers; store env as connection secrets Adding a stdio MCP server registered an integration but no connection, so the v1.5 per-connection tool model produced zero tools on a fresh install. Auto-create the default connection on add (no-auth, or one-shot env values), declare secret env vars as a stdio_env auth method whose values live on the connection's secret store, add a boot-time reconcile for pre-existing stdio integrations, and give the add form a TagInput for declaring env var names. * Derive stdio MCP display name from the package, not the runner The stdio add form fell back to the bare command (npx, uvx, ...) for both the display name and namespace, so every npm-launched server landed as "npx". Derive a name from the package/module being run instead: skip the runner and its flags/subcommands, drop the npm scope, version, path, and the usual MCP affixes (mcp-server-, server-, -mcp), then title-case. So "npx -y @modelcontextprotocol/server-github" becomes "Github MCP" and "uvx mcp-server-time" becomes "Time MCP", falling back to the raw command when nothing meaningful can be extracted. * Run the local e2e project in CI The local vitest project (e2e/local/**, including the stdio MCP auto-connect coverage) was excluded from both the default e2e chain and root `bun run test`, so it never ran in CI. Add a test:local script and a dedicated CI job that boots the scenarios with Node 22 and Chromium installed, since each one launches a real executor web server and some drive a browser. * Fix ci.yml: restore desktop-smoke job header The previous commit's edit consumed the desktop-smoke job header when inserting e2e-local, leaving its body orphaned with a duplicate steps key. GitHub rejected the workflow on startup. Restore the header. * Make local e2e reliable in CI: serialize boots, add headless shell The local project booted its executor web servers with file parallelism on, the only server-booting project that did. On a CI runner several cold vite boots at once thrashed past the token-URL wait, timing out stdio-mcp and auth. Run the files serially like every other server-booting project so the first boot warms the vite cache. Also install chromium-headless-shell, which the browser scenarios launch and which does not come with the chromium download. * Install Playwright browsers via e2e's pinned version Running the install from the repo root let bunx float to the latest playwright, which fetched a browser build the test runtime (playwright 1.60.0, pinned in e2e) never looks for, so the browser scenarios failed to launch. Install from e2e so the resolved playwright matches the one the scenarios use. * Scope the e2e CI job to the stdio MCP scenario Running the whole local project in one CI job stacked several executor web + vite boots on the runner; a later boot would intermittently stall past the token-URL wait, and the auth scenario carries its own pre-existing browser flakiness. Run just the stdio MCP scenario, the auto-connect / env-as-secret regression guard, on its own so the job is a reliable gate. Also give the cold-boot wait headroom (120s to 180s) for CI runners. Expanding to the full local suite is a follow-up once the rest is stabilized.

Rhys Sullivan committed 4 months ago

Commit 44fff2f1 parent add2e4023 files · +914 −102Browse files

Showing the changes to .github (1 of 23 files). Show all

Unified · Split

.github/workflows/ci.yml+38−0
@@ -74,6 +74,44 @@ jobs: · 73 unmodified lines
74 74
75 - run: bun run test75 - run: bun run test
76 76
77 e2e-local:
78 name: E2E (stdio MCP)
79 runs-on: ubuntu-latest
80 steps:
81 - uses: actions/checkout@v4
82
83 - uses: oven-sh/setup-bun@v2
84 with:
85 bun-version: 1.3.11
86
87 # The local scenarios boot a real `executor web` (which spawns a Node
88 # sidecar) and some drive a browser, so pin Node 22 and install Chromium.
89 - uses: actions/setup-node@v4
90 with:
91 node-version: 22
92
93 - run: bun install --frozen-lockfile
94
95 # `chromium` and the new `chromium-headless-shell` ship as separate
96 # downloads; the browser-driven scenarios launch the headless shell.
97 # Install from e2e so bunx resolves ITS pinned playwright (the version the
98 # tests run against) rather than floating to the latest, which would fetch
99 # a browser build the test runtime does not look for.
100 - name: Install Playwright Chromium
101 run: bunx playwright install --with-deps chromium chromium-headless-shell
102 working-directory: e2e
103
104 # The `local` project is excluded from the default `test` chain (each
105 # scenario boots its own `executor web`). Run just the stdio MCP scenario
106 # here: it is the auto-connect / env-as-secret regression guard, and
107 # running it alone avoids the boot-resource accumulation and the
108 # pre-existing browser flakiness of the rest of the local suite. Expanding
109 # to the full `local` project (bun run test:local) is a follow-up once
110 # those are stabilized.
111 - name: Run the stdio MCP scenario
112 run: bunx vitest run --project local local/stdio-mcp.test.ts
113 working-directory: e2e
114
77 desktop-smoke:115 desktop-smoke:
78 name: Desktop smoke build116 name: Desktop smoke build
79 runs-on: ubuntu-latest117 runs-on: ubuntu-latest