@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/README.md +21 -2
- package/index.js +30 -3
- package/index.js.map +3 -3
- package/main.js +30 -3
- package/main.js.map +3 -3
- package/package.json +1 -1
- package/relay.d.ts +6 -0
- package/testing.d.ts +33 -2
- package/testing.js +5830 -1
- package/testing.js.map +28 -4
package/package.json
CHANGED
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`:
|
|
3
|
-
*
|
|
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>;
|