Skip to content

feat(hub)!: pin discovery to the credential's origin via @corbits/credential-http - #15

Merged
TheGreatAxios merged 1 commit into
cl-9390-mcp-align-repo-scaffolding-with-the-package-standardfrom
cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9390-mcp-align-repo-scaffolding-with-the-package-standardfrom
cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Replaces @corbits/credential-mcp with @corbits/credential-http and removes the last provider-specific origin from this package's dependency path.

@corbits/mcp never named a vendor itself; @corbits/credential-mcp's mcpOriginPinnedFetch carried a built-in allowance from one vendor's origin to another. @corbits/credential-http has no built-ins, so nothing is allowed off the pinned origin unless the host says so.

Changes

  • src/hub/discover.ts imports createOriginPinnedFetch and MCP_NO_TOKEN_SENTINEL from @corbits/credential-http.
  • Discovery that sends a secret pins to the origin of the credential's provider apiBaseUrl, as @corbits/credential-http handles do. Before, it pinned to whatever URL the request named, so any origin could receive the secret.
  • New extraOrigins?: Readonly<Record<string, readonly string[]>> on MountMcpDiscoveryOpts and discoverMcpServer, keyed by pinned origin (normalized with new URL(key).origin, as credential-http does) and passed through to @corbits/credential-http. Default {}. Interchange has no analogue, so the name matches @corbits/credential-http.
  • A keyless (MCP_NO_TOKEN_SENTINEL) credential sends nothing, so it pins to the URL's origin, not its provider's apiBaseUrl, as the README says.
  • extraOrigins is host-wide: an entry applies to every tenant's credential pinned to that origin. The README and the option's doc comment say so.
  • discoverMcpLoginEntry's fallback (authorization-server metadata served at the resource) now requires metadata.issuer to equal the issuer the resource URL identifies (RFC 8414 §3.3), with the same trailing-slash normalization as the well-known URL. @corbits/oauth-core 0.2.0 does not export such a helper, so it stays local.
  • readCredentialSecret is now readCredential and returns { secret, origin? }. discoverMcpServer takes credential instead of secret.
  • Tests: a credential is refused off its origin by default, refused when only another origin is configured, and allowed when its own pinned origin lists the target. A secret whose provider has no apiBaseUrl is refused; a keyless credential needs none. A redirect is refused even to an allowed origin. A keyless credential with a mismatched apiBaseUrl pins to the URL's origin. Fallback metadata naming another issuer is refused; a trailing-slash difference is accepted.
  • The @corbits/oauth-core dependency moves to ^0.2.0.
  • README and AGENTS.md updated; the Reference documents extraOrigins with example hosts.

Breaking

Yes, marked !. It is part of the pending 0.2.0 release, so there is no extra version bump.

Review

An independent gaas:critique review found key normalization, keyless credentials and an id in an error message; all three are fixed.

Checks

bun run check (typecheck, oxlint, oxfmt --check, tests), bun run build, and the Node pack smoke all pass locally.

Closes CL-9051

@TheGreatAxios
TheGreatAxios added this pull request to stack #12 September 26, 2026 14:47
@TheGreatAxios
TheGreatAxios force-pushed the cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http branch 2 times, most recently from 7ed522a to 4f19763 Compare September 27, 2026 18:35
…dential-http

Replace @corbits/credential-mcp with @corbits/credential-http. Discovery that
sends a secret now pins to the credential's provider apiBaseUrl origin, and a
host allows extra origins per pinned origin with `extraOrigins`. No origin is
allowed by default, which drops the built-in vendor allowance credential-mcp
carried. A keyless credential pins to the URL's origin. OAuth discovery's
fallback now requires the resource-served metadata to name the resource's own
issuer (RFC 8414 §3.3).

BREAKING CHANGE: readCredentialSecret is now readCredential and returns
{ secret, origin? }; discoverMcpServer takes `credential` instead of `secret`;
a credential with a secret whose provider has no apiBaseUrl, or a URL off its
origin without `extraOrigins`, is refused.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9051-mcp-import-pinned-fetch-from-corbitscredential-http branch from 4f19763 to 873f4f6 Compare September 27, 2026 18:49
@TheGreatAxios
TheGreatAxios merged commit 355d32f into main Sep 27, 2026
1 check 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.

1 participant