@ractive-ch/tab-mcp 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ractive-ch/tab-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Relay that lets AI agents call the MCP tools of a web page open in a browser tab",
5
5
  "type": "module",
6
6
  "bin": {
package/relay.d.ts CHANGED
@@ -13,6 +13,12 @@ export interface CreateRelayOptions extends Omit<Partial<RelayConfig>, "store">
13
13
  /** Logger; defaults to JSON lines on stdout at `logLevel`. */
14
14
  logger?: Logger;
15
15
  }
16
+ /**
17
+ * The public URL in development without `publicUrl`: the loopback address the
18
+ * relay listens on, so the addresses match the URL the page was given;
19
+ * `localhost` for any other host (`0.0.0.0`, `::`, a name).
20
+ */
21
+ export declare function developmentUrl(host: string, port: number): string;
16
22
  export interface Relay {
17
23
  /** The external origin (issuer and address base). */
18
24
  readonly url: string;
package/testing.d.ts CHANGED
@@ -1,5 +1,36 @@
1
1
  /**
2
- * `@ractive-ch/tab-mcp/testing`: the `TokenStore` conformance suite for
3
- * `bun test` (DEC-041).
2
+ * `@ractive-ch/tab-mcp/testing`: helpers for `bun test`. The `TokenStore`
3
+ * conformance suite (DEC-041), and an in-process relay with a token helper
4
+ * for end-to-end tests of a page's tools without pairing by hand.
4
5
  */
6
+ import { type CreateRelayOptions, type Relay } from "./relay.js";
7
+ import type { TokenStore } from "./store/types.js";
5
8
  export { tokenStoreConformance } from "./store/conformance.js";
9
+ /** A relay started by `startTestRelay`. */
10
+ export interface TestRelay {
11
+ relay: Relay;
12
+ /** The relay's token store, for `tokenFor`. */
13
+ store: TokenStore;
14
+ /** The relay's URL, for the page's `relay` option: `http://127.0.0.1:<port>`. */
15
+ url: string;
16
+ stop(): Promise<void>;
17
+ }
18
+ /**
19
+ * Start a relay in this process on a free port of 127.0.0.1, in development
20
+ * mode, open to every page origin, with a memory store and no log output
21
+ * (unless `logger` or `logLevel` is given). `options` override any of that.
22
+ * For tests only: it accepts any origin.
23
+ */
24
+ export declare function startTestRelay(options?: Omit<CreateRelayOptions, "store"> & {
25
+ store?: TokenStore;
26
+ }): TestRelay;
27
+ /**
28
+ * An access token for a page's MCP address, written straight into the relay's
29
+ * token store, as if an AI app had paired. Use it as `Authorization: Bearer
30
+ * <token>` with an MCP client. It lasts an hour unless `ttlMs` says otherwise.
31
+ */
32
+ export declare function tokenFor(store: TokenStore, address: string, options?: {
33
+ clientId?: string;
34
+ clientName?: string;
35
+ ttlMs?: number;
36
+ }): Promise<string>;