toolmark-monorepo / @toolmark/mcp / createPairingServer
Function: createPairingServer()
createPairingServer(
o):Promise<PairingServer>
Defined in: packages/mcp/src/pairing/ws-server.ts:103
Starts the pairing server (spec §11.3, §14, §23 "MCP pairing (R3)"): HTTP on 127.0.0.1 only (non-upgrade requests get 404), upgrades gated by isAllowedUpgrade (403 otherwise), one handshake at a time (4429), a pair / resume first frame of at most 1024 bytes within 3000 ms (4408, 4400), single-use codes (4401 on a miss; five misses rotate the code), no new handshake for 250 ms after any 4401 (4429), one valid session token at a time, and supersede (4409). Prints the listen line and every new pairing code to stderr.
Parameters
o
Port, allowed origins, call deadline, stderr sink and clock.
Returns
Promise<PairingServer>
The link, the bound port and close().
Throws
TypeError for invalid options; rejects with the listen error (e.g. EADDRINUSE).