@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.
71 lines (70 loc) • 3.57 kB
TypeScript
/**
* S3-26 wiring: the stdio MCP server with the real `handleShowWorkspace`.
*
* Junior modules stay untouched — this file imports `createServer`,
* `loadWorkspaceCatalog`, `profileColumns`, and `signDataLink`.
*/
import { TtlStore } from './migrate/datalink/index.js';
import { type Table } from './profiler/table.js';
import { type McpServer, type ShowWorkspaceHandler, type ShowWorkspaceToolInfo, type StdioStreams } from './server/index.js';
import type { Disconnect } from './server/stdio.js';
export declare const WORKSPACE_DATA_PATH_ENV = "WORKSPACE_DATA_PATH";
/**
* Same public FuseDash charts key mcp-ui bakes as `MCP_MAPBOX_TOKEN`.
* Maps always have a token on this server — do not require `WORKSPACE_HAS_MAP_TOKEN`.
*/
export declare const WORKSPACE_MAPBOX_TOKEN = "pk.eyJ1IjoiYW5keWsxOTg3IiwiYSI6ImNqeHJtdGJjNTA5bWwzbW1mcXA0cTZuMmkifQ.qAhmQzT0m6-KuvZt7-C83A";
/**
* Fill hosted defaults so Cursor/Claude stdio starts with no mcp.json env.
* Does not mutate the input object.
*/
export declare function applyWorkspaceHostDefaults(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
/** Local `.env` only, and only for a real process start. Does not override a key already set. */
export declare function readDotEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
export type CreateWorkspaceServerOptions = {
env?: NodeJS.ProcessEnv;
table?: Table;
dataPath?: string;
store?: TtlStore;
/** Override package root when resolving a relative data path. Tests only. */
root?: string;
/** Tests inject hosted App View HTML so resources/read does not hit the network. */
loadChartHtml?: () => string | Promise<string>;
/**
* HTTP forces this off. Stdio local/dev keeps url and path unless the env is
* production-like.
*/
allowRemoteSources?: boolean;
};
export type WiredWorkspace = {
handler: ShowWorkspaceHandler;
info: ShowWorkspaceToolInfo;
};
/** Shipped demo CSV so HTTP/Claude connectors have rows without WORKSPACE_DATA_PATH. */
export declare function workspaceDemoCsvPath(): string;
export declare function wireWorkspace(options?: CreateWorkspaceServerOptions): WiredWorkspace;
/**
* Bind catalog + profile into `createServer(handleShowWorkspace)`.
* The model still only sends `{ intent }`. Rows live on the server and leave as
* an opaque handle, never as tool arguments or result rows.
*
* Stdio (`startWorkspaceServer`) applies hosted defaults: `MCP_BASE_URL`
* → `https://mcp.ui9000.com`, Mapbox token always present, remote persist on.
* A host `env` without `store` still uses `env.STORAGE_DIR`, not `process.env`.
*
* `createWorkspaceServer` stays on the hand-rolled JSON-RPC handle() used by
* in-process tests. Live stdio (bin / injected streams) always uses the SDK.
*/
export declare function createWorkspaceServer(options?: CreateWorkspaceServerOptions): McpServer;
/**
* Stdio entry used by `yarn workspace @fusedashlabs/ui9000-workspace start` and the bin.
* Always MCP SDK + ext-apps so Cursor issues `resources/read` — including when
* tests inject streams.
*/
export declare function startWorkspaceServer(streams?: StdioStreams, options?: CreateWorkspaceServerOptions): Promise<Disconnect>;
/**
* Absolute paths are kept. Relative paths resolve against `packages/core`,
* same as `STORAGE_DIR` — Cursor/Claude stdio often have cwd=$HOME.
*/
export declare function resolveWorkspaceDataPath(raw: string | undefined, root?: string): string | undefined;
export declare function loadWorkspaceTable(dataPath: string | undefined, root?: string): Table;