-
Notifications
You must be signed in to change notification settings - Fork 302
Expose Runtime.connect's options shape as a public type #199
Copy link
Copy link
Open
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Metadata
Metadata
Assignees
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Runtime.connectaccepts an options object at runtime, but the type signature indist/runtime.d.tsonly exposes the bare positional signature:Consumers that need to wrap or override
connect— e.g. a long-running daemon forcingdisableOAuth: trueon every internal call fromcallTool/listTools— have no public type for the options shape. The existing workaround isRecord<string, any>on the parameter, which throws away type safety on a small but load-bearing surface (cache control + OAuth suppression).Why this matters
connect's options object is already the public-facing primitive for cross-cutting concerns: cache identity (skipCache), OAuth posture (maxOAuthAttempts,disableOAuthonce #198 lands,allowCachedAuth), and OAuth session forwarding (oauthSessionOptions). Consumers that need to enforce one of these choices end up writing aconnectwrapper — and that wrapper has to know the shape.Concrete in-the-wild example. evie-platform's daemon wraps
Runtimeso every internal connect call ends up daemon-safe (source):Every consumer that builds something similar (any headless / daemon / CI / scripted caller per the same niche #197 + #198 address) ends up either widening to
Record<string, any>like this or copying mcporter's internal option fields locally and drifting from upstream.Proposed API
Export the options shape under a stable name:
(
OAuthSessionOptionswould likely need to be a named public export too if it isn't already — same rationale asConnectOptions.)Tighten
Runtime'sconnectsignature:Scope
This issue is scoped to the options shape only. The other casts a consumer like the evie daemon currently uses — the
as anyto mutate the runtime in place, and theas anyto readClientContextfields off the awaited connect promise — are separate concerns that would need their own changes (e.g. exportingClientContextpublicly, or moving consumers off prototype monkey-patching). Filing those separately keeps each ask easy to accept.Backward compatibility
Strictly additive. Existing callers passing only the server name keep working (options arg is optional). Existing callers passing arbitrary objects keep working (TypeScript widens structurally). Old code paths using
as anycan drop the casts at their leisure.Related
disableOAuthconnect option —maxOAuthAttempts: 0defeats the connection cache #197 / fix(runtime): preserve disableOAuth across headless paths #198 — AdddisableOAuthconnect option —maxOAuthAttempts: 0defeats the connection cache #197 reported thatmaxOAuthAttempts: 0defeats the connection cache; fix(runtime): preserve disableOAuth across headless paths #198 is the PR closing it by addingdisableOAuthas the cache-friendly OAuth-suppression primitive. This issue is the natural type-side follow-up: now thatdisableOAuthis the load-bearing option for headless callers, make it (and its sibling fields) discoverable throughRuntime's public types so the wrappers needed to use it don't have to cast their way around.Use-case context
Same daemon shape as #197 — a long-running process polling a hosted MCP server every ~30s, no GUI, needs to ensure no internal mcporter code path can reach
openExternal. The daemon wrapsRuntimeitself today; getting the options shape typed publicly is the difference between threeas anycasts and zero.