Fix MCP credential-handle grammar violation (mcp:<slug> -> mcp.<slug>) - #98
Merged
Conversation
…alHandle PR #97's render path parses a folded run's credential bindings through @intx/types' CredentialBinding schema and fails closed: mcp-credential- bindings.ts minted handle: "mcp:<slug>", but ToolCredentialHandle is /^[a-z0-9][a-z0-9._-]*$/ -- no colon. Every MCP-pinned launch would hit this at render time; any future strict CredentialBinding consumer breaks the same way. Changes the handle shape to mcp.<slug> (dots are legal) at every mint and resolve site: mcpCredentialHandle() in @corbits/mcp-tools (the resolve-key builder), apps/hub's mcp-credential-bindings.ts (the binding minter, already wired into launchFoldedRun/wakeFoldedRun on main), and the test fixtures/comments across folded-runs and sidecar that stood in for either. The mcp:<slug> PROVIDER row naming (@workbench/connections' provider table, credential-expiry-sweep.ts, mcp-server-store.ts) is untouched -- that's a separate, unconstrained namespace CredentialBinding.provider (plain string) resolves against, not the handle grammar. Stored-data note: createMcpCredentialBindingsFor is already wired into apps/hub's folded-run launch path on main, so any dev deployment that pinned @corbits/mcp-tools and actually launched before this fix may have a workflow-definition tree with the old mcp:<slug> handle baked into its credentialBindings. Nothing on main parsed that field before now, so it never failed loudly; a re-seed/re-deploy of such tenants after this change produces a conforming handle. Per repo policy, dev data gets wiped/re-seeded rather than migrated in place.
This was referenced Aug 20, 2026
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.
What this does
apps/hub/src/mcp-credential-bindings.tsmintedhandle: "mcp:<slug>"for every tenant-connected MCP server, but@intx/types'ToolCredentialHandlegrammar is/^[a-z0-9][a-z0-9._-]*$/— no colon. Nothing parsed the handle before, so it slid through silently; PR #97's render path is the first strict consumer and fails closed on it.Changes the handle shape to
mcp.<slug>(dots are legal in the grammar) at every mint and resolve site:packages/mcp-tools/src/tool.ts—mcpCredentialHandle(slug), the single function both the credential-resolve call (env.credentials.resolve(...)) and the binding minter build on.apps/hub/src/mcp-credential-bindings.ts— theCredentialBinding.handleminted per tenant connection.packages/folded-runsandapps/sidecar.CredentialBinding.providerand the storedprovidertable row name (mcp:<slug>,@workbench/connections'mcp-server-store.ts/credential-expiry-sweep.ts/index.ts) are untouched —provideris a plain unconstrained string in the schema, a separate namespace from the handle grammar.Red/green
packages/mcp-tools/src/tool.test.tsadds:mcpCredentialHandlemints a handle that parses underToolCredentialHandle.CredentialBindingbuilt on that handle parses under@intx/types'CredentialBindingschema.mcp_callresolves credentials with the exact handlemcpCredentialHandlemints (spied via a fakeCredentialCapability).Verified red on the pre-fix
mcp:<slug>shape, green after.Stored-data note
createMcpCredentialBindingsForis already wired intoapps/hub's folded-run launch path onmain. Any dev tenant that pinned@corbits/mcp-toolsand launched a folded run before this fix may have a workflow-definition tree with the oldmcp:<slug>handle baked into itscredentialBindings— nothing parsed that field before, so it never surfaced. A re-seed/re-deploy after this change produces a conforming handle; per repo policy dev data gets wiped/re-seeded rather than migrated in place.Testing
Package-scoped, per shell rules (one heavy process at a time):
bun test packages/mcp-tools— 25 passbun test apps/hub— 130 passbun test apps/sidecar— 146 passbun test packages/folded-runs— 42 passtsc --noEmitclean in all four packagesprettier --check/eslintclean on every touched file