@fusedashlabs/ui9000-workspace
Version:
UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.
58 lines (57 loc) • 2.52 kB
TypeScript
/**
* Public data-link API: `signDataLink` / `readDataLink`.
*
* Assembled from mcp-ui `createDataLink` / `getDataLink`
* (`src/utils/dataLinkHandlers.ts`) and the TTL resolution in
* `chartDataLinkHelper.ts`. The signing and verification steps are unchanged —
* see `signature.ts`.
*
* These two functions satisfy the `SignDataLink` / `ReadDataLink` contract in
* `src/tool/data-channel.ts`: the payload never reaches the spec, only an
* opaque `/v1/data-links/:id?sig=&exp=` handle does.
*/
import { type PersistFetch } from './hosted.js';
import { type TtlStore } from './store.js';
/** Matches `SignedLink` in `src/tool/data-channel.ts`. */
export type SignedLink = {
dataUrl: string;
};
export declare const DEFAULT_TTL_HOURS = 24;
export declare const DEFAULT_MAX_PAYLOAD_SIZE_MB = 1.5;
/** Same hosted origin mcp-ui npx uses. Override with loopback `MCP_BASE_URL` for local `mcp:serve`. */
export declare const DEFAULT_BASE_URL = "https://mcp.ui9000.com";
export type DataLinkOptions = {
baseUrl?: string;
secret?: string;
env?: NodeJS.ProcessEnv;
store?: TtlStore;
fetchImpl?: PersistFetch;
};
/** mcp-ui `getDataLinkTtlHours`: DATA_LINK_TTL_HOURS, floored, min 1, default 24. */
export declare function getDataLinkTtlHours(env?: NodeJS.ProcessEnv): number;
/** MAX_PAYLOAD_SIZE_MB, default 1.5. */
export declare function getMaxPayloadSizeMb(env?: NodeJS.ProcessEnv): number;
/**
* Strip a trailing `/mcp` so `https://host/mcp` and `https://host` share the
* same `/v1/data-links` API root (mcp-ui `normalizeDataLinkBaseUrl`).
*/
export declare function normalizeDataLinkBaseUrl(raw: string): string;
/**
* Persist the payload and return an opaque signed handle.
*
* Refuses payloads over MAX_PAYLOAD_SIZE_MB (1.5 MB) — the cap is on the
* serialized bytes, matching mcp-ui, so a link can never be larger than the
* host is willing to serve back.
*
* Hosted stdio (Cursor / Claude) POSTs to `MCP_BASE_URL` when
* `MCP_DATA_LINK_REMOTE_PERSIST` is set — same path as mcp-ui npx.
*/
export declare function signDataLink(payload: unknown, options?: DataLinkOptions): SignedLink | Promise<SignedLink>;
/**
* Resolve a signed handle back to its payload.
*
* Fails closed to `null` — an unparseable URL, a bad signature, an expired
* `exp`, or a missing/expired file all read the same way to the caller, so a
* forged handle learns nothing from the response.
*/
export declare function readDataLink(link: SignedLink, options?: DataLinkOptions): unknown;