MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionPoolKey

Function connectionPoolKey

packages/plugins/mcp/src/sdk/plugin.ts:804–847  ·  view source on GitHub ↗
(
  input: PoolableConnectorInput,
  template: string,
  values: Record<string, string | null>,
  /** The connection this lease belongs to. Part of the identity, not a
   *  detail: an app-server session accumulates the user's approvals ("for
   *  this conversation"), and a no-credential integration hashes to the same
   *  key for every connection without it — so two owners would share one
   *  session, and one owner's approval would answer the other's prompt. */
  identity: { readonly owner: string; readonly connection: string },
)

Source from the content-addressed store, hash-verified

802 input.transport === "remote" || input.appServer !== undefined || input.spawnPerCall !== true;
803
804export const connectionPoolKey = (
805 input: PoolableConnectorInput,
806 template: string,
807 values: Record<string, string | null>,
808 /** The connection this lease belongs to. Part of the identity, not a
809 * detail: an app-server session accumulates the user's approvals ("for
810 * this conversation"), and a no-credential integration hashes to the same
811 * key for every connection without it — so two owners would share one
812 * session, and one owner's approval would answer the other's prompt. */
813 identity: { readonly owner: string; readonly connection: string },
814): Effect.Effect<string> =>
815 sha256Hex(
816 JSON.stringify(
817 input.transport === "remote"
818 ? {
819 owner: identity.owner,
820 connection: identity.connection,
821 endpoint: input.endpoint,
822 transport: input.transport,
823 remoteTransport: input.remoteTransport,
824 headers: sortedRecord(input.headers),
825 queryParams: sortedRecord(input.queryParams),
826 template,
827 values: sortedRecord(values),
828 }
829 : {
830 owner: identity.owner,
831 connection: identity.connection,
832 transport: input.appServer !== undefined ? "appserver" : "stdio",
833 command: input.command,
834 args: input.args ?? [],
835 cwd: input.cwd ?? null,
836 env: sortedRecord(input.env),
837 // Plain stdio negotiates the protocol at connect, so two configs
838 // that handshake differently must never share a parked session.
839 versionNegotiation: input.versionNegotiation ?? null,
840 server: input.appServer?.server ?? null,
841 surface: input.appServer?.surface ?? null,
842 modulePath: input.appServer?.modulePath ?? null,
843 template,
844 values: sortedRecord(values),
845 },
846 ),
847 );
848
849// ---------------------------------------------------------------------------
850// Declared auth methods — project the stored MCP config into the catalog's

Callers 2

plugin.tsFile · 0.85

Calls 2

sha256HexFunction · 0.90
sortedRecordFunction · 0.85

Tested by

no test coverage detected