@womp/openai-plugin 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,7 +39,7 @@ src/
39
39
 
40
40
  | Export | Purpose |
41
41
  |---|---|
42
- | `createServer({ backend, subject?, onError?, instructions?, liveViewOrigin?, linkOrigins? })` | the MCP server for one request |
42
+ | `createServer({ backend, subject?, onError?, instructions?, liveViewOrigin?, linkOrigins?, wwwAuthenticate? })` | the MCP server for one request |
43
43
  | `WompBackend` | the contract the host implements |
44
44
  | `BackendRefusal` | an error whose message reaches the model as worded |
45
45
  | `CheckoutSession`, `CompleteCheckoutArgs` | ChatGPT's payment sheet: the session it takes, and what it hands `complete_checkout` |
@@ -50,6 +50,8 @@ server instructions, for tools the host registers itself. `liveViewOrigin` is
50
50
  the one origin the design card may frame, for a live view. `linkOrigins` are
51
51
  the origins of the web pages the cards open (checkout, an order's status, an
52
52
  account), which ChatGPT then opens without asking the user first.
53
+ `wwwAuthenticate` is the host's OAuth challenge for a request with no valid
54
+ sign-in.
53
55
 
54
56
  ## Contract
55
57
 
@@ -74,10 +76,10 @@ changes an earlier one.
74
76
 
75
77
  ### Plugin → model and cards
76
78
 
77
- - **Identity.** Every tool acts as `subject`. Tool arguments and client `_meta` are never read for identity. Without a subject every tool call fails.
79
+ - **Identity.** Every tool acts as `subject`, the signed-in Womp account. Tool arguments and client `_meta` are never read for identity. Without a subject every tool call fails; with `wwwAuthenticate`, the failure carries that challenge in `_meta["mcp/www_authenticate"]`, so ChatGPT offers to link the account.
78
80
  - **Errors.** A `BackendRefusal` message reaches the model as is. Any other error is one generic failure, reported to `onError`.
79
81
  - **Tool metadata states facts.** Descriptions, input schemas and server instructions say what a tool does, never how the model should behave. Behaviour lives in `prompts/` and reaches the model in `load_scene_skill`'s result.
80
- - **Every tool** declares `ui.visibility`, explicit annotation hints, and `securitySchemes: noauth`. Tools only a card calls are `ui.visibility: ["app"]`.
82
+ - **Every tool** declares `ui.visibility`, explicit annotation hints, and `securitySchemes: oauth2` with the `mcp:generate` scope. Tools only a card calls are `ui.visibility: ["app"]`.
81
83
  - **Card data** is the tool result's `structuredContent`, typed by the card's `data.ts`. Tools map backend types to it; a card never receives backend types. What only the card may see is in the result's `_meta`, typed by the same `data.ts`: a link that is a credential, and a quote or an order, which the model would otherwise draw as a card of its own.
82
84
  - **Cards** are MCP Apps resources (`text/html;profile=mcp-app`): one self-contained HTML file each, loading nothing from outside, with a `ui://` URI that changes with its content.
83
85
 
package/dist/index.d.ts CHANGED
@@ -334,7 +334,13 @@ interface ServerOptions {
334
334
  * an https origin is left out.
335
335
  */
336
336
  linkOrigins?: string[];
337
+ /**
338
+ * The host's OAuth challenge, a `WWW-Authenticate` value, for a request whose sign-in is missing or not valid. With
339
+ * it and no subject, every tool call fails with the challenge in `_meta["mcp/www_authenticate"]`, which is what
340
+ * makes ChatGPT offer to link the account.
341
+ */
342
+ wwwAuthenticate?: string;
337
343
  }
338
- declare function createServer({ backend, subject, onError, instructions, liveViewOrigin, linkOrigins }: ServerOptions): McpServer;
344
+ declare function createServer({ backend, subject, onError, instructions, liveViewOrigin, linkOrigins, wwwAuthenticate }: ServerOptions): McpServer;
339
345
 
340
346
  export { BackendRefusal, type CheckoutSession, type ClaimLink, type CompleteCheckoutArgs, type LiveView, type WompBackend, createServer };