cli: address #1672 review nits — correct doc ref + hoist normalizeServerUrl
- The JSDoc referenced a non-existent `resolveServerConfig`; name the real `resolveServerConfigs` (core/mcp/node/config.ts) in plain text (it isn't imported here, so an @link wouldn't resolve). - Hoist the doubly-computed `normalizeServerUrl(serverUrl)` in buildHandoff to a single `normalizedUrl` reused for the query param and the serverUrl field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
This commit is contained in:
parent
93f3fb64f2
commit
ac49000738
1 changed files with 5 additions and 3 deletions
|
|
@ -541,7 +541,8 @@ async function waitForStoredToken(
|
|||
|
||||
/**
|
||||
* Derive the web deep-link `transport` value (`http` | `sse`) for a handoff.
|
||||
* Mirrors {@link resolveServerConfig}'s URL-path auto-detection (`/sse` → sse,
|
||||
* Mirrors `resolveServerConfigs` (core/mcp/node/config.ts) URL-path
|
||||
* auto-detection (`/sse` → sse,
|
||||
* everything else → http) but, unlike that resolver, defaults to `http` instead
|
||||
* of throwing on an ambiguous path — the handoff is best-effort, and the web
|
||||
* {@link parseDeepLink} likewise defaults an unknown/missing transport to http.
|
||||
|
|
@ -583,18 +584,19 @@ function buildHandoff(
|
|||
// Treat an empty MCP_INSPECTOR_API_TOKEN the same as unset — an empty token
|
||||
// can't satisfy the deep-link autoConnect gate.
|
||||
const apiToken = process.env.MCP_INSPECTOR_API_TOKEN || undefined;
|
||||
const normalizedUrl = normalizeServerUrl(serverUrl);
|
||||
// Canonical #1576 deep-link shape: the normalized serverUrl (matching the
|
||||
// OAuth-store key form the web app reuses) plus the resolved transport, gated
|
||||
// by `autoConnect=<token>` — the same per-launch token the web parser
|
||||
// requires. Omitted when no token is set; the `note` below flags that the
|
||||
// link will be rejected until the web inspector is launched with a token.
|
||||
const params = new URLSearchParams({
|
||||
serverUrl: normalizeServerUrl(serverUrl),
|
||||
serverUrl: normalizedUrl,
|
||||
transport: deepLinkTransport(serverUrl, transport),
|
||||
});
|
||||
if (apiToken) params.set("autoConnect", apiToken);
|
||||
return {
|
||||
serverUrl: normalizeServerUrl(serverUrl),
|
||||
serverUrl: normalizedUrl,
|
||||
deepLink: `http://${host}:${clientPort}/?${params.toString()}`,
|
||||
portForwardCmd: `coder port-forward <workspace> --tcp ${clientPort}:${clientPort} --tcp ${sandboxPort}:${sandboxPort}`,
|
||||
oauthStatePath: statePath,
|
||||
|
|
|
|||
Loading…
Reference in a new issue