mcp-use 2.0.0-beta.13 → 2.0.0-beta.15
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/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-XKJP5S7C.js → chunk-E7M6OYZ5.js} +5 -2
- package/dist/{chunk-XKJP5S7C.js.map → chunk-E7M6OYZ5.js.map} +1 -1
- package/dist/{chunk-STCR3P5O.js → chunk-XUI7QE2D.js} +4 -1
- package/dist/chunk-XUI7QE2D.js.map +1 -0
- package/dist/{chunk-JEVBOMCE.js → chunk-ZJJD33SF.js} +2 -2
- package/dist/chunk-ZJJD33SF.js.map +1 -0
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/views-plugin.d.ts.map +1 -1
- package/dist/commands/build.js +2 -2
- package/dist/commands/dev.js +2 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +212 -41
- package/dist/index.js.map +1 -1
- package/dist/inspector-shell.d.ts.map +1 -1
- package/dist/{landing-handler-Z7WDR4S2.js → landing-handler-WE66NIGB.js} +2 -2
- package/dist/landing.js +1 -1
- package/dist/middleware/mcp-middleware.d.ts +142 -102
- package/dist/middleware/mcp-middleware.d.ts.map +1 -1
- package/dist/react/components/theme-provider.d.ts +3 -0
- package/dist/react/components/theme-provider.d.ts.map +1 -1
- package/dist/react/hooks/use-host-context.d.ts +5 -0
- package/dist/react/hooks/use-host-context.d.ts.map +1 -1
- package/dist/react/index.js +58 -1
- package/dist/react/index.js.map +1 -1
- package/dist/server.d.ts +6 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/views/document.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-JEVBOMCE.js.map +0 -1
- package/dist/chunk-STCR3P5O.js.map +0 -1
- /package/dist/{landing-handler-Z7WDR4S2.js.map → landing-handler-WE66NIGB.js.map} +0 -0
|
@@ -191,7 +191,10 @@ function mcpUseViewsPlugin(options) {
|
|
|
191
191
|
},
|
|
192
192
|
load(id) {
|
|
193
193
|
if (id === VIRTUAL_TAILWIND_RESOLVED_ID) {
|
|
194
|
-
return
|
|
194
|
+
return [
|
|
195
|
+
'@import "tailwindcss";',
|
|
196
|
+
"@custom-variant dark (&:where(.dark, .dark *, [data-theme=dark], [data-theme=dark] *));"
|
|
197
|
+
].join("\n");
|
|
195
198
|
}
|
|
196
199
|
if (!id.startsWith(VIRTUAL_VIEW_RESOLVED_PREFIX)) {
|
|
197
200
|
return void 0;
|
|
@@ -237,4 +240,4 @@ export {
|
|
|
237
240
|
createBindingValidationServer,
|
|
238
241
|
mcpUseViewsPlugin
|
|
239
242
|
};
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-E7M6OYZ5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/entry.ts","../src/cli/vite-config.ts","../src/cli/mcp-env-declaration.ts","../src/cli/workspace.ts","../src/cli/views.ts","../src/cli/views-plugin.ts"],"sourcesContent":["/**\n * Server-entry discovery for `mcp-use build` and `mcp-use dev`.\n *\n * The entry contract (CLI_SPEC.md): the user's entry module default-exports\n * the `MCPServer` instance and never calls `listen()` itself — the CLI owns\n * the socket.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { isAbsolute, join, resolve } from \"node:path\";\n\n/**\n * Conventional entry locations, checked in order relative to the project\n * root; the first existing file wins.\n *\n * @internal\n */\nexport const ENTRY_CANDIDATES = [\n \"src/index.ts\",\n \"src/server.ts\",\n \"index.ts\",\n \"server.ts\",\n] as const;\n\n/**\n * Locate the server entry for a project.\n *\n * With `override` set (the `--entry` flag), the path is resolved against\n * `cwd` and must exist. Otherwise the {@link ENTRY_CANDIDATES} are probed in\n * order and the first hit wins.\n *\n * @param cwd - Absolute path to the project root.\n * @param override - Explicit entry path (`--entry`), absolute or relative to `cwd`.\n * @returns Absolute path to the entry file.\n * @throws If the override does not exist, or no conventional candidate is\n * found — the error lists every location that was checked.\n *\n * @internal\n */\nexport function discoverEntry(cwd: string, override?: string): string {\n if (override !== undefined) {\n const entry = isAbsolute(override) ? override : resolve(cwd, override);\n if (!existsSync(entry)) {\n throw new Error(`Entry not found: ${entry} (from --entry \"${override}\")`);\n }\n return entry;\n }\n for (const candidate of ENTRY_CANDIDATES) {\n const entry = join(cwd, candidate);\n if (existsSync(entry)) {\n return entry;\n }\n }\n throw new Error(\n `No server entry found in ${cwd}. Looked for: ` +\n `${ENTRY_CANDIDATES.join(\", \")}. ` +\n `Create one of these (default-exporting your MCPServer instance) ` +\n `or pass --entry <path>.`\n );\n}\n","/**\n * Resolve the project-level Vite config used only by the views client build.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst VITE_CONFIG_CANDIDATES = [\n \"vite.config.ts\",\n \"vite.config.js\",\n \"vite.config.mts\",\n \"vite.config.cjs\",\n] as const;\n\n/**\n * Locate a project Vite config, or disable config loading when absent.\n *\n * @param cwd - Absolute project root.\n * @returns Absolute config path or `false`.\n *\n * @internal\n */\nexport function resolveUserViteConfig(cwd: string): string | false {\n for (const name of VITE_CONFIG_CANDIDATES) {\n const path = join(cwd, name);\n if (existsSync(path)) return path;\n }\n return false;\n}\n\n/**\n * Resolve the framework-owned Tailwind stylesheet for project CSS imports.\n *\n * @returns Absolute path exported by the installed `tailwindcss` dependency.\n *\n * @internal\n */\nexport function resolveTailwindCss(): string {\n return fileURLToPath(import.meta.resolve(\"tailwindcss/index.css\"));\n}\n","/**\n * Root-level MCP env declaration shared by `mcp-use dev` and `mcp-use build`.\n *\n * Combines CSS module typing and a live type-only edge to the server entry so\n * exported `ToolRef`s update in TypeScript without rerunning the CLI.\n */\n\nimport { writeFile } from \"node:fs/promises\";\nimport { extname, join, relative, sep } from \"node:path\";\n\n/** Filename of the project-owned MCP env declaration. */\nexport const MCP_ENV_DECLARATION_NAME = \"mcp-env.d.ts\";\n\nfunction declarationImportPath(cwd: string, entry: string): string {\n let importPath = relative(cwd, entry).split(sep).join(\"/\");\n const extension = extname(importPath);\n const runtimeExtension =\n extension === \".mts\"\n ? \".mjs\"\n : extension === \".cts\"\n ? \".cjs\"\n : extension === \".ts\" || extension === \".tsx\"\n ? \".js\"\n : extension;\n\n if (extension !== runtimeExtension) {\n importPath = `${importPath.slice(0, -extension.length)}${runtimeExtension}`;\n }\n return importPath.startsWith(\".\") ? importPath : `./${importPath}`;\n}\n\n/** Build the stable declaration contents for a discovered server entry. */\nexport function renderMcpEnvDeclaration(cwd: string, entry: string): string {\n const importPath = declarationImportPath(cwd, entry);\n return [\n \"// mcp-use generated env declaration\",\n 'declare module \"*.css\";',\n \"\",\n 'declare module \"mcp-use/react\" {',\n \" interface Register {\",\n ` tools: typeof import(${JSON.stringify(importPath)});`,\n \" }\",\n \"}\",\n \"\",\n \"export {};\",\n \"\",\n ].join(\"\\n\");\n}\n\n/**\n * Create the root `mcp-env.d.ts` if absent.\n *\n * Exclusive-create mode makes this safe when dev and build start together and\n * guarantees that a user-authored declaration is never truncated or replaced.\n *\n * @returns `true` when this invocation created the file.\n */\nexport async function ensureMcpEnvDeclaration(\n cwd: string,\n entry: string\n): Promise<boolean> {\n const declarationPath = join(cwd, MCP_ENV_DECLARATION_NAME);\n try {\n await writeFile(declarationPath, renderMcpEnvDeclaration(cwd, entry), {\n encoding: \"utf8\",\n flag: \"wx\",\n });\n return true;\n } catch (error) {\n if (\n error !== null &&\n typeof error === \"object\" &&\n \"code\" in error &&\n error.code === \"EEXIST\"\n ) {\n return false;\n }\n throw error;\n }\n}\n","/**\n * The per-project `.mcp-use/` workspace convention — the Next.js `.next`\n * analog. Everything tooling writes for a project lives under this single,\n * gitignored directory so a checkout stays clean and `rm -rf .mcp-use` is\n * always safe.\n *\n * The layout is a fixed convention, not configuration: there is deliberately\n * no config file and no `outDir` knob (runtime/project configuration lives on\n * the `MCPServer` constructor).\n *\n * This module is PURE: it only derives path strings (no filesystem access).\n *\n * Layout (relative to the project root):\n *\n * ```text\n * .mcp-use/\n * ├─ build/ ← compiled server + manifest.json (this package)\n * ├─ generated/ ← output of the typegen escape-hatch command — reserved (VIEWS_SPEC.md)\n * ├─ cache/ ← disposable dev/build scratch\n * ├─ state/ ← mutable runtime state (e.g. tunnel.json)\n * └─ cloud/ ← cloud linkage (link.json)\n * ```\n *\n * `build/` must contain NO mutable runtime state (that is `state/`'s job) so\n * build output stays reproducible and disposable. This is the per-project\n * workspace, distinct from the global `~/.mcp-use/` store (CLI auth,\n * credentials, per-user caches).\n */\n\nimport { join } from \"node:path\";\n\n/**\n * Fixed name of the per-project workspace directory.\n *\n * @internal\n */\nexport const WORKSPACE_DIR_NAME = \".mcp-use\";\n\n/**\n * Basename of the build manifest written inside the build output directory.\n *\n * @internal\n */\nexport const BUILD_MANIFEST_NAME = \"manifest.json\";\n\n/**\n * Manifest written to `.mcp-use/build/manifest.json` by {@link runBuild} and\n * read back by `mcp-use start`.\n *\n * @internal\n */\nexport interface BuildManifest {\n /** Unique identifier for this build (random hex, regenerated per build). */\n buildId: string;\n /**\n * Filename of the emitted server entry, relative to the build directory\n * (e.g. `\"index.js\"`). `mcp-use start` imports `<build>/<entryPoint>` and\n * serves its default export.\n */\n entryPoint: string;\n /** ISO-8601 timestamp of when the build finished. */\n createdAt: string;\n /**\n * Whether the build was created with `mcp-use build --with-inspector`.\n * Consumed by `mcp-use start` to decide whether to mount the inspector shell.\n */\n inspector: boolean;\n}\n\n/**\n * Every resolved path for a project's `.mcp-use/` workspace.\n *\n * @internal\n */\nexport interface WorkspacePaths {\n /** The project root (the directory containing `.mcp-use/`). */\n projectRoot: string;\n /** The `.mcp-use/` workspace directory. */\n workspace: string;\n /** Build output directory: `.mcp-use/build`. */\n build: string;\n /**\n * Generated `.d.ts` artifacts directory — reserved for the typegen\n * escape-hatch command (VIEWS_SPEC.md § Typegen, demoted).\n */\n generated: string;\n /** Disposable dev/build scratch directory. */\n cache: string;\n /** Mutable runtime state directory. */\n state: string;\n /** Cloud linkage directory — reserved. */\n cloud: string;\n /** Build manifest: `<build>/manifest.json`. */\n buildManifest: string;\n /** Tunnel subdomain persistence: `<state>/tunnel.json`. */\n tunnel: string;\n}\n\n/**\n * Derive every workspace path for a project from its root. Pure — no\n * filesystem access.\n *\n * @param projectRoot - Absolute path to the project root.\n *\n * @example\n * ```ts\n * const paths = resolveWorkspacePaths(process.cwd());\n * console.log(paths.build); // <cwd>/.mcp-use/build\n * ```\n *\n * @internal\n */\nexport function resolveWorkspacePaths(projectRoot: string): WorkspacePaths {\n const workspace = join(projectRoot, WORKSPACE_DIR_NAME);\n const build = join(workspace, \"build\");\n return {\n projectRoot,\n workspace,\n build,\n generated: join(workspace, \"generated\"),\n cache: join(workspace, \"cache\"),\n state: join(workspace, \"state\"),\n cloud: join(workspace, \"cloud\"),\n buildManifest: join(build, BUILD_MANIFEST_NAME),\n tunnel: join(workspace, \"state\", \"tunnel.json\"),\n };\n}\n","/**\n * View discovery for `mcp-use build` / `mcp-use dev`.\n *\n * Views live under `views/<name>/view.tsx` (VIEWS_SPEC.md § File-based views).\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ViteDevServer } from \"vite\";\n\nimport type { ViewsManifest } from \"../views/types.js\";\n\n/** Author-facing view source directory at the project root. */\nexport const VIEWS_SOURCE_DIR = \"views\" as const;\n\n/** Prefix for per-view virtual entry modules (`virtual:mcp-use/views/<name>`). */\nexport const VIRTUAL_VIEW_PREFIX = \"virtual:mcp-use/views/\";\n\n/** Resolved virtual id prefix (Rollup null-prefixed module id). */\nexport const VIRTUAL_VIEW_RESOLVED_PREFIX = `\\0${VIRTUAL_VIEW_PREFIX}`;\n\n/**\n * One discovered view directory.\n *\n * @internal\n */\nexport interface DiscoveredView {\n /** View directory name (the `views/<name>` segment). */\n name: string;\n /** Absolute path to `views/<name>/view.tsx`. */\n entryPath: string;\n}\n\n/**\n * Scan `views/<name>/view.tsx` under the project root.\n *\n * A missing or empty `views/` directory yields an empty list — tool-only\n * projects keep byte-identical CLI behavior.\n *\n * @param cwd - Absolute project root.\n * @returns Discovered views sorted by name.\n *\n * @internal\n */\nexport function discoverViews(cwd: string): DiscoveredView[] {\n const viewsDir = join(cwd, VIEWS_SOURCE_DIR);\n if (!existsSync(viewsDir)) {\n return [];\n }\n\n const views: DiscoveredView[] = [];\n for (const entry of readdirSync(viewsDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) {\n continue;\n }\n const entryPath = join(viewsDir, entry.name, \"view.tsx\");\n if (existsSync(entryPath)) {\n views.push({ name: entry.name, entryPath });\n }\n }\n views.sort((a, b) => a.name.localeCompare(b.name));\n return views;\n}\n\n/**\n * Virtual module id for a view entry (`virtual:mcp-use/views/<name>`).\n *\n * @param name - View directory name.\n *\n * @internal\n */\nexport function virtualViewId(name: string): string {\n return `${VIRTUAL_VIEW_PREFIX}${name}`;\n}\n\n/**\n * Dev URL path Vite serves a resolved virtual module at (browser-loadable).\n *\n * @param name - View directory name.\n *\n * @internal\n */\nexport function devVirtualEntryPath(name: string): string {\n return `/@id/__x00__${VIRTUAL_VIEW_PREFIX}${name}`;\n}\n\n/**\n * Whether a filesystem path is a view component file or lives under a view dir.\n *\n * @internal\n */\nexport function isViewPath(file: string, cwd: string): boolean {\n const rel = file.startsWith(cwd) ? file.slice(cwd.length + 1) : file;\n return /^views\\/[^/]+\\//.test(rel) || /^views\\/[^/]+\\/view\\.tsx$/.test(rel);\n}\n\n/**\n * Whether a path is a view's `view.tsx` entry.\n *\n * @internal\n */\nexport function isViewEntryPath(file: string, cwd: string): boolean {\n const rel = file.startsWith(cwd) ? file.slice(cwd.length + 1) : file;\n return /^views\\/[^/]+\\/view\\.tsx$/.test(rel);\n}\n\n/**\n * Build a dev-shaped views manifest (Vite URLs, `/@vite/client` script hook).\n *\n * @internal\n */\nexport function buildDevViewsManifest(views: DiscoveredView[]): ViewsManifest {\n const manifest: ViewsManifest = {};\n for (const view of views) {\n manifest[view.name] = {\n kind: \"external\",\n entry: devVirtualEntryPath(view.name),\n css: [],\n scripts: [\"/@vite/client\"],\n };\n }\n return manifest;\n}\n\n/**\n * Create a temporary Vite dev server for build-time binding validation.\n *\n * @internal\n */\nexport async function createBindingValidationServer(\n cwd: string,\n cacheDir: string,\n configFile: string | false\n): Promise<ViteDevServer> {\n const { createServer } = await import(\"vite\");\n return createServer({\n root: cwd,\n configFile,\n envFile: false,\n logLevel: \"warn\",\n cacheDir,\n server: { middlewareMode: true, hmr: false },\n ssr: { external: true },\n });\n}\n","/**\n * Vite plugin: virtual view entry modules and optional SSR wrapper entry.\n */\n\nimport type { Plugin } from \"vite\";\n\nimport type { DiscoveredView } from \"./views.js\";\nimport {\n VIRTUAL_VIEW_PREFIX,\n VIRTUAL_VIEW_RESOLVED_PREFIX,\n virtualViewId,\n} from \"./views.js\";\n\nconst VIRTUAL_TAILWIND_ID = \"virtual:mcp-use/tailwind.css\";\nconst VIRTUAL_TAILWIND_RESOLVED_ID = `\\0${VIRTUAL_TAILWIND_ID}`;\n\n/**\n * Options for {@link mcpUseViewsPlugin}.\n *\n * @internal\n */\nexport interface McpUseViewsPluginOptions {\n /** Static list or live getter (dev rediscovery). */\n getViews: () => DiscoveredView[];\n /**\n * Dev-mode entry shape. When present, every virtual entry self-accepts HMR\n * updates (`import.meta.hot.accept()`) so an update that propagates past the\n * view module re-runs the bootstrap instead of full-reloading the iframe\n * document (which would wipe bridge state). Absent for builds — entries stay\n * byte-identical to the production contract.\n */\n dev?: {\n /**\n * Whether React Fast Refresh is active (`@vitejs/plugin-react` resolved).\n * When `true`, entries import the plugin's virtual refresh preamble\n * (`@vitejs/plugin-react/preamble`) before any component module so the\n * refresh runtime hooks the document — the role `transformIndexHtml`\n * plays for Vite-served HTML, which synthesized srcdoc documents never\n * pass through.\n */\n reactRefresh: boolean;\n };\n}\n\n/**\n * Vite plugin that resolves `virtual:mcp-use/views/<name>` to bootstrap code.\n *\n * Applies only to the **client** environment.\n *\n * @internal\n */\nexport function mcpUseViewsPlugin(options: McpUseViewsPluginOptions): Plugin {\n return {\n name: \"mcp-use-views\",\n applyToEnvironment(environment) {\n return environment.name === \"client\";\n },\n resolveId(id) {\n if (id === VIRTUAL_TAILWIND_ID) {\n return VIRTUAL_TAILWIND_RESOLVED_ID;\n }\n if (!id.startsWith(VIRTUAL_VIEW_PREFIX)) {\n return undefined;\n }\n return `\\0${id}`;\n },\n load(id) {\n if (id === VIRTUAL_TAILWIND_RESOLVED_ID) {\n return `@import \"tailwindcss\";`;\n }\n if (!id.startsWith(VIRTUAL_VIEW_RESOLVED_PREFIX)) {\n return undefined;\n }\n const name = id.slice(VIRTUAL_VIEW_RESOLVED_PREFIX.length);\n const view = options.getViews().find((v) => v.name === name);\n if (view === undefined) {\n return undefined;\n }\n const lines: string[] = [];\n if (options.dev?.reactRefresh === true) {\n // Must be the first import: the preamble hooks the refresh runtime\n // into the window before react-dom (via the bootstrap import below)\n // or any refresh-wrapped view module evaluates.\n lines.push(`import \"@vitejs/plugin-react/preamble\";`);\n }\n lines.push(`import ${JSON.stringify(VIRTUAL_TAILWIND_ID)};`);\n lines.push(\n `import { bootstrapView } from \"mcp-use/react\";`,\n `import * as viewModule from ${JSON.stringify(view.entryPath)};`,\n `bootstrapView(viewModule);`\n );\n if (options.dev !== undefined) {\n lines.push(\n `if (import.meta.hot) {`,\n ` import.meta.hot.accept();`,\n `}`\n );\n }\n lines.push(\"\");\n return lines.join(\"\\n\");\n },\n };\n}\n\n/**\n * Rollup input map for a client views build (one entry per view).\n *\n * @internal\n */\nexport function clientBuildInputs(\n views: DiscoveredView[]\n): Record<string, string> {\n const input: Record<string, string> = {};\n for (const view of views) {\n input[view.name] = virtualViewId(view.name);\n }\n return input;\n}\n"],"mappings":";AAQA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,MAAM,eAAe;AAQnC,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,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UACA;AAAA,QACF;AAAA,MACF;AACA,YAAM,KAAK,EAAE;AACb,aAAO,MAAM,KAAK,IAAI;AAAA,IACxB;AAAA,EACF;AACF;","names":["existsSync","join","join","join","existsSync","join"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/entry.ts","../src/cli/vite-config.ts","../src/cli/mcp-env-declaration.ts","../src/cli/workspace.ts","../src/cli/views.ts","../src/cli/views-plugin.ts"],"sourcesContent":["/**\n * Server-entry discovery for `mcp-use build` and `mcp-use dev`.\n *\n * The entry contract (CLI_SPEC.md): the user's entry module default-exports\n * the `MCPServer` instance and never calls `listen()` itself — the CLI owns\n * the socket.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { isAbsolute, join, resolve } from \"node:path\";\n\n/**\n * Conventional entry locations, checked in order relative to the project\n * root; the first existing file wins.\n *\n * @internal\n */\nexport const ENTRY_CANDIDATES = [\n \"src/index.ts\",\n \"src/server.ts\",\n \"index.ts\",\n \"server.ts\",\n] as const;\n\n/**\n * Locate the server entry for a project.\n *\n * With `override` set (the `--entry` flag), the path is resolved against\n * `cwd` and must exist. Otherwise the {@link ENTRY_CANDIDATES} are probed in\n * order and the first hit wins.\n *\n * @param cwd - Absolute path to the project root.\n * @param override - Explicit entry path (`--entry`), absolute or relative to `cwd`.\n * @returns Absolute path to the entry file.\n * @throws If the override does not exist, or no conventional candidate is\n * found — the error lists every location that was checked.\n *\n * @internal\n */\nexport function discoverEntry(cwd: string, override?: string): string {\n if (override !== undefined) {\n const entry = isAbsolute(override) ? override : resolve(cwd, override);\n if (!existsSync(entry)) {\n throw new Error(`Entry not found: ${entry} (from --entry \"${override}\")`);\n }\n return entry;\n }\n for (const candidate of ENTRY_CANDIDATES) {\n const entry = join(cwd, candidate);\n if (existsSync(entry)) {\n return entry;\n }\n }\n throw new Error(\n `No server entry found in ${cwd}. Looked for: ` +\n `${ENTRY_CANDIDATES.join(\", \")}. ` +\n `Create one of these (default-exporting your MCPServer instance) ` +\n `or pass --entry <path>.`\n );\n}\n","/**\n * Resolve the project-level Vite config used only by the views client build.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst VITE_CONFIG_CANDIDATES = [\n \"vite.config.ts\",\n \"vite.config.js\",\n \"vite.config.mts\",\n \"vite.config.cjs\",\n] as const;\n\n/**\n * Locate a project Vite config, or disable config loading when absent.\n *\n * @param cwd - Absolute project root.\n * @returns Absolute config path or `false`.\n *\n * @internal\n */\nexport function resolveUserViteConfig(cwd: string): string | false {\n for (const name of VITE_CONFIG_CANDIDATES) {\n const path = join(cwd, name);\n if (existsSync(path)) return path;\n }\n return false;\n}\n\n/**\n * Resolve the framework-owned Tailwind stylesheet for project CSS imports.\n *\n * @returns Absolute path exported by the installed `tailwindcss` dependency.\n *\n * @internal\n */\nexport function resolveTailwindCss(): string {\n return fileURLToPath(import.meta.resolve(\"tailwindcss/index.css\"));\n}\n","/**\n * Root-level MCP env declaration shared by `mcp-use dev` and `mcp-use build`.\n *\n * Combines CSS module typing and a live type-only edge to the server entry so\n * exported `ToolRef`s update in TypeScript without rerunning the CLI.\n */\n\nimport { writeFile } from \"node:fs/promises\";\nimport { extname, join, relative, sep } from \"node:path\";\n\n/** Filename of the project-owned MCP env declaration. */\nexport const MCP_ENV_DECLARATION_NAME = \"mcp-env.d.ts\";\n\nfunction declarationImportPath(cwd: string, entry: string): string {\n let importPath = relative(cwd, entry).split(sep).join(\"/\");\n const extension = extname(importPath);\n const runtimeExtension =\n extension === \".mts\"\n ? \".mjs\"\n : extension === \".cts\"\n ? \".cjs\"\n : extension === \".ts\" || extension === \".tsx\"\n ? \".js\"\n : extension;\n\n if (extension !== runtimeExtension) {\n importPath = `${importPath.slice(0, -extension.length)}${runtimeExtension}`;\n }\n return importPath.startsWith(\".\") ? importPath : `./${importPath}`;\n}\n\n/** Build the stable declaration contents for a discovered server entry. */\nexport function renderMcpEnvDeclaration(cwd: string, entry: string): string {\n const importPath = declarationImportPath(cwd, entry);\n return [\n \"// mcp-use generated env declaration\",\n 'declare module \"*.css\";',\n \"\",\n 'declare module \"mcp-use/react\" {',\n \" interface Register {\",\n ` tools: typeof import(${JSON.stringify(importPath)});`,\n \" }\",\n \"}\",\n \"\",\n \"export {};\",\n \"\",\n ].join(\"\\n\");\n}\n\n/**\n * Create the root `mcp-env.d.ts` if absent.\n *\n * Exclusive-create mode makes this safe when dev and build start together and\n * guarantees that a user-authored declaration is never truncated or replaced.\n *\n * @returns `true` when this invocation created the file.\n */\nexport async function ensureMcpEnvDeclaration(\n cwd: string,\n entry: string\n): Promise<boolean> {\n const declarationPath = join(cwd, MCP_ENV_DECLARATION_NAME);\n try {\n await writeFile(declarationPath, renderMcpEnvDeclaration(cwd, entry), {\n encoding: \"utf8\",\n flag: \"wx\",\n });\n return true;\n } catch (error) {\n if (\n error !== null &&\n typeof error === \"object\" &&\n \"code\" in error &&\n error.code === \"EEXIST\"\n ) {\n return false;\n }\n throw error;\n }\n}\n","/**\n * The per-project `.mcp-use/` workspace convention — the Next.js `.next`\n * analog. Everything tooling writes for a project lives under this single,\n * gitignored directory so a checkout stays clean and `rm -rf .mcp-use` is\n * always safe.\n *\n * The layout is a fixed convention, not configuration: there is deliberately\n * no config file and no `outDir` knob (runtime/project configuration lives on\n * the `MCPServer` constructor).\n *\n * This module is PURE: it only derives path strings (no filesystem access).\n *\n * Layout (relative to the project root):\n *\n * ```text\n * .mcp-use/\n * ├─ build/ ← compiled server + manifest.json (this package)\n * ├─ generated/ ← output of the typegen escape-hatch command — reserved (VIEWS_SPEC.md)\n * ├─ cache/ ← disposable dev/build scratch\n * ├─ state/ ← mutable runtime state (e.g. tunnel.json)\n * └─ cloud/ ← cloud linkage (link.json)\n * ```\n *\n * `build/` must contain NO mutable runtime state (that is `state/`'s job) so\n * build output stays reproducible and disposable. This is the per-project\n * workspace, distinct from the global `~/.mcp-use/` store (CLI auth,\n * credentials, per-user caches).\n */\n\nimport { join } from \"node:path\";\n\n/**\n * Fixed name of the per-project workspace directory.\n *\n * @internal\n */\nexport const WORKSPACE_DIR_NAME = \".mcp-use\";\n\n/**\n * Basename of the build manifest written inside the build output directory.\n *\n * @internal\n */\nexport const BUILD_MANIFEST_NAME = \"manifest.json\";\n\n/**\n * Manifest written to `.mcp-use/build/manifest.json` by {@link runBuild} and\n * read back by `mcp-use start`.\n *\n * @internal\n */\nexport interface BuildManifest {\n /** Unique identifier for this build (random hex, regenerated per build). */\n buildId: string;\n /**\n * Filename of the emitted server entry, relative to the build directory\n * (e.g. `\"index.js\"`). `mcp-use start` imports `<build>/<entryPoint>` and\n * serves its default export.\n */\n entryPoint: string;\n /** ISO-8601 timestamp of when the build finished. */\n createdAt: string;\n /**\n * Whether the build was created with `mcp-use build --with-inspector`.\n * Consumed by `mcp-use start` to decide whether to mount the inspector shell.\n */\n inspector: boolean;\n}\n\n/**\n * Every resolved path for a project's `.mcp-use/` workspace.\n *\n * @internal\n */\nexport interface WorkspacePaths {\n /** The project root (the directory containing `.mcp-use/`). */\n projectRoot: string;\n /** The `.mcp-use/` workspace directory. */\n workspace: string;\n /** Build output directory: `.mcp-use/build`. */\n build: string;\n /**\n * Generated `.d.ts` artifacts directory — reserved for the typegen\n * escape-hatch command (VIEWS_SPEC.md § Typegen, demoted).\n */\n generated: string;\n /** Disposable dev/build scratch directory. */\n cache: string;\n /** Mutable runtime state directory. */\n state: string;\n /** Cloud linkage directory — reserved. */\n cloud: string;\n /** Build manifest: `<build>/manifest.json`. */\n buildManifest: string;\n /** Tunnel subdomain persistence: `<state>/tunnel.json`. */\n tunnel: string;\n}\n\n/**\n * Derive every workspace path for a project from its root. Pure — no\n * filesystem access.\n *\n * @param projectRoot - Absolute path to the project root.\n *\n * @example\n * ```ts\n * const paths = resolveWorkspacePaths(process.cwd());\n * console.log(paths.build); // <cwd>/.mcp-use/build\n * ```\n *\n * @internal\n */\nexport function resolveWorkspacePaths(projectRoot: string): WorkspacePaths {\n const workspace = join(projectRoot, WORKSPACE_DIR_NAME);\n const build = join(workspace, \"build\");\n return {\n projectRoot,\n workspace,\n build,\n generated: join(workspace, \"generated\"),\n cache: join(workspace, \"cache\"),\n state: join(workspace, \"state\"),\n cloud: join(workspace, \"cloud\"),\n buildManifest: join(build, BUILD_MANIFEST_NAME),\n tunnel: join(workspace, \"state\", \"tunnel.json\"),\n };\n}\n","/**\n * View discovery for `mcp-use build` / `mcp-use dev`.\n *\n * Views live under `views/<name>/view.tsx` (VIEWS_SPEC.md § File-based views).\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ViteDevServer } from \"vite\";\n\nimport type { ViewsManifest } from \"../views/types.js\";\n\n/** Author-facing view source directory at the project root. */\nexport const VIEWS_SOURCE_DIR = \"views\" as const;\n\n/** Prefix for per-view virtual entry modules (`virtual:mcp-use/views/<name>`). */\nexport const VIRTUAL_VIEW_PREFIX = \"virtual:mcp-use/views/\";\n\n/** Resolved virtual id prefix (Rollup null-prefixed module id). */\nexport const VIRTUAL_VIEW_RESOLVED_PREFIX = `\\0${VIRTUAL_VIEW_PREFIX}`;\n\n/**\n * One discovered view directory.\n *\n * @internal\n */\nexport interface DiscoveredView {\n /** View directory name (the `views/<name>` segment). */\n name: string;\n /** Absolute path to `views/<name>/view.tsx`. */\n entryPath: string;\n}\n\n/**\n * Scan `views/<name>/view.tsx` under the project root.\n *\n * A missing or empty `views/` directory yields an empty list — tool-only\n * projects keep byte-identical CLI behavior.\n *\n * @param cwd - Absolute project root.\n * @returns Discovered views sorted by name.\n *\n * @internal\n */\nexport function discoverViews(cwd: string): DiscoveredView[] {\n const viewsDir = join(cwd, VIEWS_SOURCE_DIR);\n if (!existsSync(viewsDir)) {\n return [];\n }\n\n const views: DiscoveredView[] = [];\n for (const entry of readdirSync(viewsDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) {\n continue;\n }\n const entryPath = join(viewsDir, entry.name, \"view.tsx\");\n if (existsSync(entryPath)) {\n views.push({ name: entry.name, entryPath });\n }\n }\n views.sort((a, b) => a.name.localeCompare(b.name));\n return views;\n}\n\n/**\n * Virtual module id for a view entry (`virtual:mcp-use/views/<name>`).\n *\n * @param name - View directory name.\n *\n * @internal\n */\nexport function virtualViewId(name: string): string {\n return `${VIRTUAL_VIEW_PREFIX}${name}`;\n}\n\n/**\n * Dev URL path Vite serves a resolved virtual module at (browser-loadable).\n *\n * @param name - View directory name.\n *\n * @internal\n */\nexport function devVirtualEntryPath(name: string): string {\n return `/@id/__x00__${VIRTUAL_VIEW_PREFIX}${name}`;\n}\n\n/**\n * Whether a filesystem path is a view component file or lives under a view dir.\n *\n * @internal\n */\nexport function isViewPath(file: string, cwd: string): boolean {\n const rel = file.startsWith(cwd) ? file.slice(cwd.length + 1) : file;\n return /^views\\/[^/]+\\//.test(rel) || /^views\\/[^/]+\\/view\\.tsx$/.test(rel);\n}\n\n/**\n * Whether a path is a view's `view.tsx` entry.\n *\n * @internal\n */\nexport function isViewEntryPath(file: string, cwd: string): boolean {\n const rel = file.startsWith(cwd) ? file.slice(cwd.length + 1) : file;\n return /^views\\/[^/]+\\/view\\.tsx$/.test(rel);\n}\n\n/**\n * Build a dev-shaped views manifest (Vite URLs, `/@vite/client` script hook).\n *\n * @internal\n */\nexport function buildDevViewsManifest(views: DiscoveredView[]): ViewsManifest {\n const manifest: ViewsManifest = {};\n for (const view of views) {\n manifest[view.name] = {\n kind: \"external\",\n entry: devVirtualEntryPath(view.name),\n css: [],\n scripts: [\"/@vite/client\"],\n };\n }\n return manifest;\n}\n\n/**\n * Create a temporary Vite dev server for build-time binding validation.\n *\n * @internal\n */\nexport async function createBindingValidationServer(\n cwd: string,\n cacheDir: string,\n configFile: string | false\n): Promise<ViteDevServer> {\n const { createServer } = await import(\"vite\");\n return createServer({\n root: cwd,\n configFile,\n envFile: false,\n logLevel: \"warn\",\n cacheDir,\n server: { middlewareMode: true, hmr: false },\n ssr: { external: true },\n });\n}\n","/**\n * Vite plugin: virtual view entry modules and optional SSR wrapper entry.\n */\n\nimport type { Plugin } from \"vite\";\n\nimport type { DiscoveredView } from \"./views.js\";\nimport {\n VIRTUAL_VIEW_PREFIX,\n VIRTUAL_VIEW_RESOLVED_PREFIX,\n virtualViewId,\n} from \"./views.js\";\n\nconst VIRTUAL_TAILWIND_ID = \"virtual:mcp-use/tailwind.css\";\nconst VIRTUAL_TAILWIND_RESOLVED_ID = `\\0${VIRTUAL_TAILWIND_ID}`;\n\n/**\n * Options for {@link mcpUseViewsPlugin}.\n *\n * @internal\n */\nexport interface McpUseViewsPluginOptions {\n /** Static list or live getter (dev rediscovery). */\n getViews: () => DiscoveredView[];\n /**\n * Dev-mode entry shape. When present, every virtual entry self-accepts HMR\n * updates (`import.meta.hot.accept()`) so an update that propagates past the\n * view module re-runs the bootstrap instead of full-reloading the iframe\n * document (which would wipe bridge state). Absent for builds — entries stay\n * byte-identical to the production contract.\n */\n dev?: {\n /**\n * Whether React Fast Refresh is active (`@vitejs/plugin-react` resolved).\n * When `true`, entries import the plugin's virtual refresh preamble\n * (`@vitejs/plugin-react/preamble`) before any component module so the\n * refresh runtime hooks the document — the role `transformIndexHtml`\n * plays for Vite-served HTML, which synthesized srcdoc documents never\n * pass through.\n */\n reactRefresh: boolean;\n };\n}\n\n/**\n * Vite plugin that resolves `virtual:mcp-use/views/<name>` to bootstrap code.\n *\n * Applies only to the **client** environment.\n *\n * @internal\n */\nexport function mcpUseViewsPlugin(options: McpUseViewsPluginOptions): Plugin {\n return {\n name: \"mcp-use-views\",\n applyToEnvironment(environment) {\n return environment.name === \"client\";\n },\n resolveId(id) {\n if (id === VIRTUAL_TAILWIND_ID) {\n return VIRTUAL_TAILWIND_RESOLVED_ID;\n }\n if (!id.startsWith(VIRTUAL_VIEW_PREFIX)) {\n return undefined;\n }\n return `\\0${id}`;\n },\n load(id) {\n if (id === VIRTUAL_TAILWIND_RESOLVED_ID) {\n // Host theme is applied via ext-apps applyDocumentTheme (data-theme on\n // html) and optional .dark wrappers — not OS prefers-color-scheme.\n return [\n '@import \"tailwindcss\";',\n \"@custom-variant dark (&:where(.dark, .dark *, [data-theme=dark], [data-theme=dark] *));\",\n ].join(\"\\n\");\n }\n if (!id.startsWith(VIRTUAL_VIEW_RESOLVED_PREFIX)) {\n return undefined;\n }\n const name = id.slice(VIRTUAL_VIEW_RESOLVED_PREFIX.length);\n const view = options.getViews().find((v) => v.name === name);\n if (view === undefined) {\n return undefined;\n }\n const lines: string[] = [];\n if (options.dev?.reactRefresh === true) {\n // Must be the first import: the preamble hooks the refresh runtime\n // into the window before react-dom (via the bootstrap import below)\n // or any refresh-wrapped view module evaluates.\n lines.push(`import \"@vitejs/plugin-react/preamble\";`);\n }\n lines.push(`import ${JSON.stringify(VIRTUAL_TAILWIND_ID)};`);\n lines.push(\n `import { bootstrapView } from \"mcp-use/react\";`,\n `import * as viewModule from ${JSON.stringify(view.entryPath)};`,\n `bootstrapView(viewModule);`\n );\n if (options.dev !== undefined) {\n lines.push(\n `if (import.meta.hot) {`,\n ` import.meta.hot.accept();`,\n `}`\n );\n }\n lines.push(\"\");\n return lines.join(\"\\n\");\n },\n };\n}\n\n/**\n * Rollup input map for a client views build (one entry per view).\n *\n * @internal\n */\nexport function clientBuildInputs(\n views: DiscoveredView[]\n): Record<string, string> {\n const input: Record<string, string> = {};\n for (const view of views) {\n input[view.name] = virtualViewId(view.name);\n }\n return input;\n}\n"],"mappings":";AAQA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,MAAM,eAAe;AAQnC,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,SAAS,cAAc,KAAa,UAA2B;AACpE,MAAI,aAAa,QAAW;AAC1B,UAAM,QAAQ,WAAW,QAAQ,IAAI,WAAW,QAAQ,KAAK,QAAQ;AACrE,QAAI,CAAC,WAAW,KAAK,GAAG;AACtB,YAAM,IAAI,MAAM,oBAAoB,KAAK,mBAAmB,QAAQ,IAAI;AAAA,IAC1E;AACA,WAAO;AAAA,EACT;AACA,aAAW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,sBAAsB;AAC5B,IAAM,+BAA+B,KAAK,mBAAmB;AAqCtD,SAAS,kBAAkB,SAA2C;AAC3E,SAAO;AAAA,IACL,MAAM;AAAA,IACN,mBAAmB,aAAa;AAC9B,aAAO,YAAY,SAAS;AAAA,IAC9B;AAAA,IACA,UAAU,IAAI;AACZ,UAAI,OAAO,qBAAqB;AAC9B,eAAO;AAAA,MACT;AACA,UAAI,CAAC,GAAG,WAAW,mBAAmB,GAAG;AACvC,eAAO;AAAA,MACT;AACA,aAAO,KAAK,EAAE;AAAA,IAChB;AAAA,IACA,KAAK,IAAI;AACP,UAAI,OAAO,8BAA8B;AAGvC,eAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF,EAAE,KAAK,IAAI;AAAA,MACb;AACA,UAAI,CAAC,GAAG,WAAW,4BAA4B,GAAG;AAChD,eAAO;AAAA,MACT;AACA,YAAM,OAAO,GAAG,MAAM,6BAA6B,MAAM;AACzD,YAAM,OAAO,QAAQ,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAC3D,UAAI,SAAS,QAAW;AACtB,eAAO;AAAA,MACT;AACA,YAAM,QAAkB,CAAC;AACzB,UAAI,QAAQ,KAAK,iBAAiB,MAAM;AAItC,cAAM,KAAK,yCAAyC;AAAA,MACtD;AACA,YAAM,KAAK,UAAU,KAAK,UAAU,mBAAmB,CAAC,GAAG;AAC3D,YAAM;AAAA,QACJ;AAAA,QACA,+BAA+B,KAAK,UAAU,KAAK,SAAS,CAAC;AAAA,QAC7D;AAAA,MACF;AACA,UAAI,QAAQ,QAAQ,QAAW;AAC7B,cAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,YAAM,KAAK,EAAE;AACb,aAAO,MAAM,KAAK,IAAI;AAAA,IACxB;AAAA,EACF;AACF;","names":["existsSync","join","join","join","existsSync","join"]}
|
|
@@ -35,6 +35,7 @@ function escapeInlineStyle(css) {
|
|
|
35
35
|
function escapeHtml(value) {
|
|
36
36
|
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
37
37
|
}
|
|
38
|
+
var TRANSPARENT_IFRAME_STYLE = "<style>html,body,#root{background:transparent}</style>";
|
|
38
39
|
function synthesizeViewDocument(entry, assetsBase, basePath, viewName) {
|
|
39
40
|
const viewConfig = {
|
|
40
41
|
publicBase: resolvePublicBase(assetsBase, basePath)
|
|
@@ -48,6 +49,7 @@ function synthesizeViewDocument(entry, assetsBase, basePath, viewName) {
|
|
|
48
49
|
<head>
|
|
49
50
|
<meta charset="utf-8">
|
|
50
51
|
${configScript}
|
|
52
|
+
${TRANSPARENT_IFRAME_STYLE}
|
|
51
53
|
${styleTag}
|
|
52
54
|
</head>
|
|
53
55
|
<body>
|
|
@@ -78,6 +80,7 @@ ${moduleScript}
|
|
|
78
80
|
<head>
|
|
79
81
|
<meta charset="utf-8">
|
|
80
82
|
${configScript}
|
|
83
|
+
${TRANSPARENT_IFRAME_STYLE}
|
|
81
84
|
${cssLinks}
|
|
82
85
|
</head>
|
|
83
86
|
<body>
|
|
@@ -92,4 +95,4 @@ export {
|
|
|
92
95
|
viewAssetsBasePath,
|
|
93
96
|
synthesizeViewDocument
|
|
94
97
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-XUI7QE2D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/document.ts"],"sourcesContent":["import type { McpUseViewConfig } from \"../react/public-assets.js\";\nimport { pathUnderBase } from \"../fetch-app.js\";\nimport type { ViewManifestEntry } from \"./types.js\";\n\n/**\n * Resolve a manifest asset path to an absolute URL for embedding in the\n * synthesized view document.\n *\n * External manifest entries are origin-absolute `/`-prefixed paths by\n * contract ({@link ExternalViewManifestEntry}).\n *\n * @param assetPath - Origin-absolute path starting with `/`.\n * @param origin - Request-resolved public origin.\n * @returns Absolute URL `${origin}${assetPath}`.\n * @throws When `assetPath` does not start with `/`.\n */\nexport function resolveAssetUrl(assetPath: string, origin: string): string {\n if (!assetPath.startsWith(\"/\")) {\n throw new Error(\n `View manifest asset path must be origin-absolute (start with \"/\"); got ${JSON.stringify(assetPath)}`\n );\n }\n return `${origin}${assetPath}`;\n}\n\n/**\n * Build the HTTP path prefix for a view's built assets (no origin).\n *\n * @param basePath - MCP mount prefix (e.g. `/mcp`).\n * @param viewName - View directory / manifest key.\n */\nexport function viewAssetsBasePath(basePath: string, viewName: string): string {\n return `${pathUnderBase(basePath, `_mcp-use/views/${viewName}`)}/`;\n}\n\n/**\n * Resolve a production or dev external asset path to an absolute URL.\n *\n * @param assetPath - Full CDN URL, origin-absolute dev path (`/…`), or\n * view-relative production path (`assets/…`).\n * @param assetsBase - Assets URL prefix (origin + optional path).\n * @param basePath - MCP mount prefix.\n * @param viewName - View directory / manifest key (required for view-relative paths).\n */\nexport function resolveExternalAssetUrl(\n assetPath: string,\n assetsBase: string,\n basePath: string,\n viewName: string\n): string {\n if (\n assetPath.startsWith(\"http://\") ||\n assetPath.startsWith(\"https://\") ||\n assetPath.startsWith(\"data:\")\n ) {\n return assetPath;\n }\n if (assetPath.startsWith(\"/\")) {\n return resolveAssetUrl(assetPath, assetsBase);\n }\n return `${assetsBase}${viewAssetsBasePath(basePath, viewName)}${assetPath.replace(/^\\/+/, \"\")}`;\n}\n\n/**\n * Resolve the absolute URL prefix for the project's `public/` directory.\n *\n * @param assetsBase - Assets URL prefix (origin + optional path).\n * @param basePath - MCP mount prefix (e.g. `/mcp`).\n * @returns Absolute prefix with trailing slash.\n */\nexport function resolvePublicBase(\n assetsBase: string,\n basePath: string\n): string {\n return `${assetsBase}${pathUnderBase(basePath, \"_mcp-use/public\")}/`;\n}\n\n/**\n * Escape view JS so it can sit inside a HTML `<script>` element without\n * premature termination or comment-open sequences.\n *\n * @param code - Raw module source.\n */\nfunction escapeInlineScript(code: string): string {\n return code\n .replaceAll(/<\\/script/gi, \"<\\\\/script\")\n .replaceAll(\"<!--\", \"\\\\x3C!--\");\n}\n\n/**\n * Escape CSS so it can sit inside a HTML `<style>` element without premature\n * termination.\n *\n * @param css - Raw stylesheet text.\n */\nfunction escapeInlineStyle(css: string): string {\n return css.replaceAll(/<\\/style/gi, \"<\\\\/style\");\n}\n\nfunction escapeHtml(value: string): string {\n return value\n .replaceAll(\"&\", \"&\")\n .replaceAll('\"', \""\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\");\n}\n\n/** Transparent iframe canvas before React mounts (rounded views show host bg). */\nconst TRANSPARENT_IFRAME_STYLE =\n \"<style>html,body,#root{background:transparent}</style>\";\n\n/**\n * Synthesize a complete HTML document for a view from manifest data.\n *\n * Production (`kind: \"external\"`) loads built assets over HTTP with absolute\n * URLs. Legacy `kind: \"inline\"` embeds JS/CSS directly. Dev uses Vite module\n * URLs (`kind: \"external\"` with origin-absolute paths).\n *\n * @param entry - Primed manifest entry for the view.\n * @param assetsBase - Request-resolved assets URL prefix for absolute asset URLs.\n * @param basePath - MCP mount prefix (e.g. `/mcp`).\n * @param viewName - View directory / manifest key (required for production external paths).\n */\nexport function synthesizeViewDocument(\n entry: ViewManifestEntry,\n assetsBase: string,\n basePath: string,\n viewName?: string\n): string {\n const viewConfig: McpUseViewConfig = {\n publicBase: resolvePublicBase(assetsBase, basePath),\n };\n const configScript = `<script>globalThis.__mcpUseViewConfig=${JSON.stringify(viewConfig)};</script>`;\n\n if (entry.kind === \"inline\") {\n const styleTag =\n entry.css.length > 0\n ? `<style>${escapeInlineStyle(entry.css)}</style>`\n : \"\";\n const moduleScript = `<script type=\"module\">${escapeInlineScript(entry.js)}</script>`;\n return `<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n${configScript}\n${TRANSPARENT_IFRAME_STYLE}\n${styleTag}\n</head>\n<body>\n<div id=\"root\"></div>\n${moduleScript}\n</body>\n</html>`;\n }\n\n if (viewName === undefined) {\n throw new Error(\n \"viewName is required when synthesizing an external view document.\"\n );\n }\n\n const cssLinks = entry.css\n .map(\n (path) =>\n `<link rel=\"stylesheet\" href=\"${escapeHtml(resolveExternalAssetUrl(path, assetsBase, basePath, viewName))}\">`\n )\n .join(\"\\n\");\n\n const scriptTags = (entry.scripts ?? [])\n .map(\n (path) =>\n `<script type=\"module\" src=\"${escapeHtml(resolveExternalAssetUrl(path, assetsBase, basePath, viewName))}\"></script>`\n )\n .join(\"\\n\");\n\n const entryUrl = resolveExternalAssetUrl(\n entry.entry,\n assetsBase,\n basePath,\n viewName\n );\n\n return `<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n${configScript}\n${TRANSPARENT_IFRAME_STYLE}\n${cssLinks}\n</head>\n<body>\n<div id=\"root\"></div>\n${scriptTags}\n<script type=\"module\" src=\"${escapeHtml(entryUrl)}\"></script>\n</body>\n</html>`;\n}\n"],"mappings":";;;;;AAgBO,SAAS,gBAAgB,WAAmB,QAAwB;AACzE,MAAI,CAAC,UAAU,WAAW,GAAG,GAAG;AAC9B,UAAM,IAAI;AAAA,MACR,0EAA0E,KAAK,UAAU,SAAS,CAAC;AAAA,IACrG;AAAA,EACF;AACA,SAAO,GAAG,MAAM,GAAG,SAAS;AAC9B;AAQO,SAAS,mBAAmB,UAAkB,UAA0B;AAC7E,SAAO,GAAG,cAAc,UAAU,kBAAkB,QAAQ,EAAE,CAAC;AACjE;AAWO,SAAS,wBACd,WACA,YACA,UACA,UACQ;AACR,MACE,UAAU,WAAW,SAAS,KAC9B,UAAU,WAAW,UAAU,KAC/B,UAAU,WAAW,OAAO,GAC5B;AACA,WAAO;AAAA,EACT;AACA,MAAI,UAAU,WAAW,GAAG,GAAG;AAC7B,WAAO,gBAAgB,WAAW,UAAU;AAAA,EAC9C;AACA,SAAO,GAAG,UAAU,GAAG,mBAAmB,UAAU,QAAQ,CAAC,GAAG,UAAU,QAAQ,QAAQ,EAAE,CAAC;AAC/F;AASO,SAAS,kBACd,YACA,UACQ;AACR,SAAO,GAAG,UAAU,GAAG,cAAc,UAAU,iBA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N;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AAAA;AAAA;AAAA;AAAA,EAIP,YAAY;AAAA,EACZ,wBAAwB;AAAA,EACxB,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIR,UAAU;AAAA,6BACiB,WAAW,QAAQ,CAAC;AAAA;AAAA;AAGjD;","names":[]}
|
|
@@ -60,7 +60,7 @@ in vec4 a_position;
|
|
|
60
60
|
out vec2 v_objectUV;
|
|
61
61
|
void main(){
|
|
62
62
|
gl_Position=a_position;
|
|
63
|
-
v_objectUV=a_position.xy*0.5
|
|
63
|
+
v_objectUV=a_position.xy*0.5;
|
|
64
64
|
}`;
|
|
65
65
|
const FRAG = `#version 300 es
|
|
66
66
|
precision mediump float;
|
|
@@ -738,4 +738,4 @@ a:hover { text-decoration: underline; }
|
|
|
738
738
|
export {
|
|
739
739
|
generateLandingPage
|
|
740
740
|
};
|
|
741
|
-
//# sourceMappingURL=chunk-
|
|
741
|
+
//# sourceMappingURL=chunk-ZJJD33SF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/landing.ts"],"sourcesContent":["/**\n * Landing page generator for MCP server endpoints\n *\n * Generates SEO-friendly HTML with connection instructions for MCP servers\n * from Claude Code, Cursor, VS Code, ChatGPT, and Manufact Inspector (hosted).\n */\n\n/**\n * Escapes HTML special characters to prevent XSS in user-provided content.\n */\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\n/** Serialize data for an inline JSON script without creating an HTML end tag. */\nfunction serializeScriptJson(value: unknown): string {\n return JSON.stringify(value)\n .replace(/</g, \"\\\\u003c\")\n .replace(/>/g, \"\\\\u003e\");\n}\n\n/**\n * Sanitizes a server name for use in filenames and URLs.\n * Replaces non-alphanumeric characters with underscores and converts to lowercase.\n */\nfunction sanitizeServerName(name: string): string {\n return name.replace(/[^a-zA-Z0-9-_]/g, \"_\").toLowerCase();\n}\n\n/**\n * Generates a Cursor deep link for installing an MCP server.\n * The config is base64-encoded JSON containing the server URL.\n */\nfunction generateCursorDeepLink(url: string, name: string): string {\n const config = { url };\n const configJson = JSON.stringify(config);\n\n // Use Buffer in Node.js or btoa in browser-like environments\n const base64Config =\n typeof Buffer !== \"undefined\"\n ? Buffer.from(configJson).toString(\"base64\")\n : btoa(configJson);\n\n const sanitizedName = sanitizeServerName(name);\n return `cursor://anysphere.cursor-deeplink/mcp/install?config=${encodeURIComponent(base64Config)}&name=${encodeURIComponent(sanitizedName)}`;\n}\n\n/**\n * Generates a VS Code deep link for installing an MCP server.\n * The config is URL-encoded JSON containing the server URL.\n */\nfunction generateVSCodeDeepLink(url: string, name: string): string {\n const config = {\n url,\n name: sanitizeServerName(name),\n type: \"http\",\n };\n const configJson = JSON.stringify(config);\n const urlEncodedConfig = encodeURIComponent(configJson);\n return `vscode:mcp/install?${urlEncodedConfig}`;\n}\n\n/**\n * Generates a VS Code Insiders deep link for installing an MCP server.\n * The config is URL-encoded JSON containing the server URL.\n */\nfunction generateVSCodeInsidersDeepLink(url: string, name: string): string {\n const config = {\n url,\n name: sanitizeServerName(name),\n type: \"http\",\n };\n const configJson = JSON.stringify(config);\n const urlEncodedConfig = encodeURIComponent(configJson);\n return `vscode-insiders:mcp/install?${urlEncodedConfig}`;\n}\n\n/**\n * Generates a Claude Code CLI command for adding an MCP server.\n */\nfunction generateClaudeCommand(url: string, name: string): string {\n const sanitizedName = sanitizeServerName(name);\n const quotedUrl = `'${url.replace(/'/g, \"'\\\\''\")}'`;\n return `claude mcp add --transport http \"${sanitizedName}\" ${quotedUrl}`;\n}\n\n/** Hosted Manufact Inspector base (same as cloud deploy “Open in new tab”). */\nconst MANUFACT_INSPECTOR_ORIGIN = \"https://inspector.manufact.com\";\n\n/**\n * Deep link to hosted Manufact Inspector with this MCP server URL pre-filled\n * and the Chat tab selected (`tab=chat`).\n */\nfunction getManufactInspectorUrl(serverUrl: string): string {\n const params = new URLSearchParams({\n autoConnect: serverUrl,\n tab: \"chat\",\n });\n return `${MANUFACT_INSPECTOR_ORIGIN}/inspector?${params.toString()}`;\n}\n\nconst LOGO_SVG_PATHS = {\n path1:\n \"M105.933 0C164.437 0.000115889 211.865 47.607 211.865 106.333C211.865 131.828 210.494 158.401 221.068 181.6L228.976 198.947C243.585 230.997 269.266 256.7 301.304 271.336L316.156 278.121C340.143 289.079 367.695 287.335 394.067 287.335C452.572 287.335 500 334.942 500 393.668C500 452.394 452.572 500.001 394.067 500.001C335.563 500.001 288.135 452.394 288.135 393.668C288.135 368.974 289.241 343.275 278.992 320.807L270.587 302.38C255.949 270.289 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.92992e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z\",\n circle: { cx: 100.426, cy: 399.575, r: 100.426 },\n path2:\n \"M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z\",\n};\n\nconst LINE_INTERSECTION_PATH =\n \"M10.5 4C10.5 7.31371 7.81371 10 4.5 10H0.5V11H4.5C7.81371 11 10.5 13.6863 10.5 17V21H11.5V17C11.5 13.6863 14.1863 11 17.5 11H21.5V10H17.5C14.1863 10 11.5 7.31371 11.5 4V0H10.5V4Z\";\n\n/** Returns the inline WebGL mesh gradient script (no deps). */\nfunction getMeshGradientScript(): string {\n const VERT = `#version 300 es\nin vec4 a_position;\nout vec2 v_objectUV;\nvoid main(){\n gl_Position=a_position;\n v_objectUV=a_position.xy*0.5;\n}`;\n\n const FRAG = `#version 300 es\nprecision mediump float;\nuniform float u_time;\nuniform vec4 u_colors[4];\nuniform float u_colorsCount;\nuniform float u_distortion;\nuniform float u_swirl;\nuniform float u_grainMixer;\nuniform float u_grainOverlay;\nin vec2 v_objectUV;\nout vec4 fragColor;\n#define PI 3.14159265359\nvec2 rotate(vec2 uv,float th){return mat2(cos(th),sin(th),-sin(th),cos(th))*uv;}\nfloat hash21(vec2 p){\n p=fract(p*vec2(0.3183099,0.3678794))+0.1;\n p+=dot(p,p+19.19);\n return fract(p.x*p.y);\n}\nfloat valueNoise(vec2 st){\n vec2 i=floor(st);vec2 f=fract(st);\n float a=hash21(i),b=hash21(i+vec2(1.,0.)),c=hash21(i+vec2(0.,1.)),d=hash21(i+vec2(1.,1.));\n vec2 u=f*f*(3.-2.*f);\n return mix(mix(a,b,u.x),mix(c,d,u.x),u.y);\n}\nvec2 getPosition(int i,float t){\n float a=float(i)*.37,b=.6+fract(float(i)/3.)*.9,c=.8+fract(float(i+1)/4.);\n float x=sin(t*b+a),y=cos(t*c+a*1.5);\n return .5+.5*vec2(x,y);\n}\nvoid main(){\n vec2 uv=v_objectUV;uv+=.5;\n vec2 grainUV=uv*1000.;\n float grain=valueNoise(grainUV);\n float mixerGrain=.4*u_grainMixer*(grain-.5);\n float t=.5*(u_time+41.5);\n float radius=smoothstep(0.,1.,length(uv-.5));\n float center=1.-radius;\n for(float i=1.;i<=2.;i++){\n uv.x+=u_distortion*center/i*sin(t+i*.4*smoothstep(0.,1.,uv.y))*cos(.2*t+i*2.4*smoothstep(0.,1.,uv.y));\n uv.y+=u_distortion*center/i*cos(t+i*2.*smoothstep(0.,1.,uv.x));\n }\n vec2 uvR=uv-vec2(.5);\n float angle=3.*u_swirl*radius;\n uvR=rotate(uvR,-angle);uvR+=vec2(.5);\n vec3 color=vec3(0.);float opacity=0.,totalWeight=0.;\n for(int i=0;i<4;i++){\n if(i>=int(u_colorsCount))break;\n vec2 pos=getPosition(i,t)+mixerGrain;\n vec3 cf=u_colors[i].rgb*u_colors[i].a;\n float opacityF=u_colors[i].a;\n float dist=length(uvR-pos);\n dist=pow(dist,3.5);\n float w=1./(dist+1e-3);\n color+=cf*w;opacity+=opacityF*w;totalWeight+=w;\n }\n color/=max(1e-4,totalWeight);\n opacity/=max(1e-4,totalWeight);\n float grainO=valueNoise(rotate(grainUV,1.)+vec2(3.));\n grainO=mix(grainO,valueNoise(rotate(grainUV,2.)+vec2(-1.)),.5);\n grainO=pow(grainO,1.3);\n float grainOV=grainO*2.-1.;\n vec3 grainOC=vec3(step(0.,grainOV));\n float grainOS=u_grainOverlay*abs(grainOV);\n grainOS=pow(grainOS,.8);\n color=mix(color,grainOC,.35*grainOS);\n opacity+=.5*grainOS;\n fragColor=vec4(color,clamp(opacity,0.,1.));\n}`;\n\n return `(function(){\nvar c=document.getElementById('mesh-bg');\nif(!c)return;\nvar wrap=c.parentElement;\nif(!wrap)return;\nvar gl=c.getContext('webgl2');\nif(!gl)return;\nfunction compileShader(typ,src){\n var s=gl.createShader(typ);\n gl.shaderSource(s,src);\n gl.compileShader(s);\n if(!gl.getShaderParameter(s,gl.COMPILE_STATUS)){console.error(gl.getShaderInfoLog(s));return null;}\n return s;\n}\nvar vs=compileShader(gl.VERTEX_SHADER,${JSON.stringify(VERT)});\nvar fs=compileShader(gl.FRAGMENT_SHADER,${JSON.stringify(FRAG)});\nif(!vs||!fs)return;\nvar prog=gl.createProgram();\ngl.attachShader(prog,vs);\ngl.attachShader(prog,fs);\ngl.linkProgram(prog);\nif(!gl.getProgramParameter(prog,gl.LINK_STATUS)){console.error(gl.getProgramInfoLog(prog));return;}\ngl.useProgram(prog);\nvar posLoc=gl.getAttribLocation(prog,'a_position');\nvar buf=gl.createBuffer();\ngl.bindBuffer(gl.ARRAY_BUFFER,buf);\ngl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),gl.STATIC_DRAW);\ngl.enableVertexAttribArray(posLoc);\ngl.vertexAttribPointer(posLoc,2,gl.FLOAT,false,0,0);\nfunction hexToRgba(hex){\n var r=(parseInt(hex.slice(1,3),16))/255;\n var g=(parseInt(hex.slice(3,5),16))/255;\n var b=(parseInt(hex.slice(5,7),16))/255;\n return[r,g,b,1];\n}\nvar colors=[hexToRgba('#e0eaff'),hexToRgba('#f9ffbd'),hexToRgba('#dedede'),hexToRgba('#ffffff')];\nvar uTime=gl.getUniformLocation(prog,'u_time');\nvar uColors=[gl.getUniformLocation(prog,'u_colors[0]'),gl.getUniformLocation(prog,'u_colors[1]'),gl.getUniformLocation(prog,'u_colors[2]'),gl.getUniformLocation(prog,'u_colors[3]')];\nvar uColorsCount=gl.getUniformLocation(prog,'u_colorsCount');\nvar uDistortion=gl.getUniformLocation(prog,'u_distortion');\nvar uSwirl=gl.getUniformLocation(prog,'u_swirl');\nvar uGrainMixer=gl.getUniformLocation(prog,'u_grainMixer');\nvar uGrainOverlay=gl.getUniformLocation(prog,'u_grainOverlay');\nvar time=0,speed=1,raf;\nfunction resize(){\n var dpr=Math.min(2,window.devicePixelRatio||1);\n c.width=Math.floor(wrap.clientWidth*dpr);\n c.height=Math.floor(wrap.clientHeight*dpr);\n gl.viewport(0,0,c.width,c.height);\n}\nfunction draw(){\n if(document.hidden){raf=requestAnimationFrame(draw);return;}\n time+=0.016*speed;\n gl.uniform1f(uTime,time);\n for(var i=0;i<4;i++)gl.uniform4fv(uColors[i],colors[i]);\n gl.uniform1f(uColorsCount,4);\n gl.uniform1f(uDistortion,0.8);\n gl.uniform1f(uSwirl,0.1);\n gl.uniform1f(uGrainMixer,0);\n gl.uniform1f(uGrainOverlay,0.3);\n gl.drawArrays(gl.TRIANGLES,0,6);\n raf=requestAnimationFrame(draw);\n}\nresize();\nnew ResizeObserver(resize).observe(wrap);\ndraw();\n})();`;\n}\n\n/** A tool shown in the landing page's primitives list. */\nexport interface LandingPageTool {\n /** Protocol-facing tool name. */\n name: string;\n\n /** Optional human-readable tool title. */\n title?: string;\n\n /** Optional tool description. */\n description?: string;\n}\n\n/** A prompt shown in the landing page's primitives list. */\nexport interface LandingPagePrompt {\n /** Protocol-facing prompt name. */\n name: string;\n\n /** Optional human-readable prompt title. */\n title?: string;\n\n /** Optional prompt description. */\n description?: string;\n}\n\n/** A static resource shown in the landing page's primitives list. */\nexport interface LandingPageResource {\n /** Resource URI. */\n uri: string;\n\n /** Optional protocol-facing resource name. */\n name?: string;\n\n /** Optional human-readable resource title. */\n title?: string;\n\n /** Optional resource description. */\n description?: string;\n}\n\n/** Inputs used to render the v1-compatible MCP server landing page. */\nexport interface LandingPageOptions {\n /** Protocol-facing server name. */\n name: string;\n\n /** Optional human-readable server title used as the page heading. */\n title?: string;\n\n /** Server version shown beside the heading. */\n version: string;\n\n /** Absolute public URL of the MCP endpoint. */\n url: string;\n\n /** Optional server description. */\n description?: string;\n\n /** Optional tools shown in the primitives list. */\n tools?: readonly LandingPageTool[];\n\n /** Optional prompts shown in the primitives list. */\n prompts?: readonly LandingPagePrompt[];\n\n /** Optional static resources shown in the primitives list. */\n resources?: readonly LandingPageResource[];\n\n /** Optional absolute URL for the icon displayed above the server heading. */\n iconUrl?: string;\n /** MIME type for the favicon link tag when known. */\n iconType?: string;\n}\n\n/**\n * Generates an HTML landing page with connection instructions\n * for Claude Code, Cursor, VS Code, ChatGPT, and Manufact Inspector.\n *\n * @param options - Server identity, endpoint, icon, and primitive metadata.\n * @returns HTML landing page with connection instructions\n */\nexport function generateLandingPage(options: LandingPageOptions): string {\n const {\n name: protocolName,\n title,\n version,\n url,\n description,\n tools,\n prompts,\n resources,\n iconUrl,\n iconType,\n } = options;\n const name = title ?? protocolName;\n const cursorDeepLink = generateCursorDeepLink(url, name);\n const vscodeDeepLink = generateVSCodeDeepLink(url, name);\n const vscodeInsidersDeepLink = generateVSCodeInsidersDeepLink(url, name);\n const claudeCommand = generateClaudeCommand(url, name);\n const manufactInspectorUrl = getManufactInspectorUrl(url);\n\n const safeName = escapeHtml(name);\n const safeDescription = description ? escapeHtml(description) : \"\";\n const rawMetaDescription =\n description ||\n `${name} MCP Server — Connect with Claude Code, Cursor, and VS Code. Model Context Protocol server.`;\n const metaDescription = escapeHtml(rawMetaDescription);\n const pageTitle = `${safeName} MCP Server — Connect with Claude Code, Cursor & VS Code`;\n\n const jsonLd = serializeScriptJson({\n \"@context\": \"https://schema.org\",\n \"@type\": \"SoftwareApplication\",\n name: name,\n softwareVersion: version,\n description: rawMetaDescription,\n applicationCategory: \"DeveloperApplication\",\n });\n\n const normalizedTools: LandingPageTool[] =\n tools && tools.length > 0\n ? tools.map((tool) => ({\n name: tool.title ?? tool.name,\n ...(tool.description !== undefined && {\n description: tool.description,\n }),\n }))\n : [];\n\n const toolsListHtml =\n normalizedTools.length > 0\n ? normalizedTools\n .map(\n (t) =>\n `<div class=\"spec-item\"><code class=\"spec-name\">${escapeHtml(t.name)}</code>${t.description ? `<p class=\"spec-desc\">${escapeHtml(t.description)}</p>` : \"\"}</div>`\n )\n .join(\"\\n\")\n : \"\";\n\n const promptsListHtml =\n prompts && prompts.length > 0\n ? prompts\n .map(\n (p) =>\n `<div class=\"spec-item\"><code class=\"spec-name\">${escapeHtml(p.title ?? p.name)}</code>${p.description ? `<p class=\"spec-desc\">${escapeHtml(p.description)}</p>` : \"\"}</div>`\n )\n .join(\"\\n\")\n : \"\";\n\n const resourcesListHtml =\n resources && resources.length > 0\n ? resources\n .map(\n (r) =>\n `<div class=\"spec-item\"><code class=\"spec-uri\">${escapeHtml(r.uri)}</code>${r.description ? `<p class=\"spec-desc\">${escapeHtml(r.description)}</p>` : \"\"}</div>`\n )\n .join(\"\\n\")\n : \"\";\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${pageTitle}</title>\n<meta name=\"description\" content=\"${metaDescription}\">\n<meta property=\"og:title\" content=\"${pageTitle}\">\n<meta property=\"og:description\" content=\"${metaDescription}\">\n<meta property=\"og:type\" content=\"website\">\n<meta name=\"twitter:card\" content=\"summary\">\n<meta name=\"twitter:title\" content=\"${pageTitle}\">\n<meta name=\"twitter:description\" content=\"${metaDescription}\">\n${iconUrl ? `<link rel=\"icon\"${iconType ? ` type=\"${escapeHtml(iconType)}\"` : \"\"} href=\"${escapeHtml(iconUrl)}\">` : \"\"}\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">\n<script type=\"application/ld+json\">${jsonLd}</script>\n<style>\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n color: #1e293b;\n background-color: #fdfcfc;\n min-height: 100vh;\n}\n.layout {\n max-width: 48rem;\n margin: 0 auto;\n padding: 2rem 1.5rem;\n position: relative;\n}\n.rail-left, .rail-right {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n background: rgba(0,0,0,0.08);\n}\n.rail-left { left: 1.5rem; }\n.rail-right { right: 1.5rem; }\n.rail-top, .rail-bottom {\n height: 1px;\n background: rgba(0,0,0,0.08);\n position: absolute;\n left: 1.5rem;\n right: 1.5rem;\n}\n.rail-top { top: 0; }\n.rail-bottom { bottom: 0; }\n.corner {\n position: absolute;\n width: 22px;\n height: 21px;\n color: rgba(0,0,0,0.08);\n}\n.corner-tl { left: 1.5rem; top: 0; transform: translate(-50%, -50%); }\n.corner-tr { right: 1.5rem; top: 0; transform: translate(50%, -50%); left: auto; }\n.corner-bl { left: 1.5rem; bottom: 0; transform: translate(-50%, 50%); top: auto; }\n.corner-br { right: 1.5rem; bottom: 0; transform: translate(50%, 50%); left: auto; top: auto; }\n.card {\n background: #fff;\n border-top: 1px solid rgba(0,0,0,0.08);\n border-bottom: 1px solid rgba(0,0,0,0.08);\n margin-bottom: 1.5rem;\n overflow: hidden;\n}\n.card-header {\n padding: 1.5rem 1.5rem 0.5rem;\n}\n.card-content { padding: 0 1.5rem 1.5rem; }\n.hero-card .card-header {\n text-align: center;\n padding: 0 1.5rem 1.25rem;\n}\n.hero-card .card-header.has-icon {\n padding-top: 1.5rem;\n}\n.hero-icon {\n width: 64px;\n height: 64px;\n border-radius: 14px;\n object-fit: contain;\n margin-bottom: 0.75rem;\n}\n.hero-row {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.75rem;\n margin-bottom: 0.35rem;\n}\n.hero h1 {\n font-size: 1.75rem;\n font-weight: 700;\n color: #172037;\n margin: 0.75rem 0 0;\n}\n.hero-card .card-header.has-icon .hero h1 { margin-top: 0; }\n.hero .version { font-size: 0.95rem; color: #64748b; font-weight: 500; }\n.hero-description {\n color: rgba(23,32,55,0.8);\n font-size: 1rem;\n margin: 0.35rem 0 0;\n max-width: 36rem;\n margin-left: auto;\n margin-right: auto;\n}\n.logo-symbol {\n display: inline-block;\n cursor: default;\n flex-shrink: 0;\n}\n.logo-symbol svg {\n width: 32px;\n height: 32px;\n color: #172037;\n}\n.logo-fill { transition: opacity 0.2s ease; }\n.logo-stroke path,\n.logo-stroke circle {\n fill: none;\n stroke: currentColor;\n stroke-width: 6;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-dasharray: 2000;\n stroke-dashoffset: 2000;\n opacity: 0;\n}\n.logo-symbol:hover .logo-fill {\n animation: logo-fill-out 0.2s forwards, logo-fill-in 0.6s 0.9s forwards;\n}\n.logo-symbol:hover .logo-stroke path,\n.logo-symbol:hover .logo-stroke circle {\n opacity: 1;\n animation: logo-draw 0.7s 0.2s ease-in-out forwards;\n}\n@keyframes logo-fill-out { to { opacity: 0; } }\n@keyframes logo-fill-in { to { opacity: 1; } }\n@keyframes logo-draw { to { stroke-dashoffset: 0; } }\n.footer-content { text-align: center; padding: 2.5rem 1.5rem; border-top: 1px solid rgba(0,0,0,0.08); display: flex; justify-content: center; align-items: center; }\n.footer-brand-link { justify-content: center; }\n.footer-brand-link .logo-symbol svg { width: 22px; height: 22px; }\n.hero-powered { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; margin-top: 0.75rem; font-family: \"Outfit\", -apple-system, BlinkMacSystemFont, sans-serif; font-size: 0.875rem; font-weight: 500; color: rgba(23,32,55,0.6); }\n.hero-powered a { color: #000; text-decoration: none; display: inline-flex; align-items: center; }\n.hero-powered a:hover { text-decoration: underline; }\n.footer-brand-link { display: inline-flex; align-items: center; gap: 0.5rem; font-family: \"Outfit\", -apple-system, BlinkMacSystemFont, sans-serif; font-size: 1.5rem; font-weight: 600; color: #172037; text-decoration: none; }\n.footer-brand-link:hover { color: #0f172a; }\n.hero-url-block { display: flex; justify-content: center; margin: 0.75rem 0; }\n.hero-cta-row {\n display: flex;\n justify-content: center;\n margin: 0.35rem 0 0.5rem;\n}\n.hero-primary-btn {\n display: inline-block;\n padding: 0.625rem 1.25rem;\n background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);\n color: #fff;\n border-radius: 9999px;\n text-decoration: none;\n font-weight: 600;\n font-size: 0.9375rem;\n box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 2px 8px rgba(15,23,42,0.15);\n transition: background 0.15s;\n border: 1px solid rgba(0,0,0,0.12);\n}\n.hero-primary-btn:hover {\n background: linear-gradient(180deg, #334155 0%, #1e293b 100%);\n text-decoration: none;\n color: #fff;\n}\n.hero-url-block .url-block { max-width: 100%; }\n.hero-url-block .url-box {\n font-size: 0.938rem;\n background: #fff;\n border: 1px solid rgba(0,0,0,0.12);\n border-radius: 9999px;\n padding: 0.75rem 3rem 0.75rem 1rem;\n margin: 1rem 0;\n}\n.hero-powered .gh-icon { width: 18px; height: 18px; margin-right: 0.25rem; vertical-align: -0.2em; }\n.hero-powered .gh-shield { height: 18px; width: auto; margin-left: 0.4rem; vertical-align: -0.2em; }\n.card-title { font-size: 1.25rem; font-weight: 600; color: #172037; margin: 0 0 0.25rem; }\n.card-desc { font-size: 0.875rem; color: rgba(23,32,55,0.8); margin: 0 0 1rem; }\n.url-block {\n position: relative;\n margin: 1rem 0;\n}\n.url-block .url-box {\n margin: 0;\n padding-right: 2.75rem;\n}\n.url-block .copy-btn { top: 50%; right: 0.5rem; transform: translateY(-50%); }\n.url-box {\n font-family: ui-monospace, monospace;\n font-size: 0.813rem;\n background: #f8fafc;\n padding: 0.5rem 0.75rem;\n border-radius: 6px;\n color: #475569;\n margin: 1rem 0;\n}\n.spec-section { margin-top: 1.5rem; }\n.spec-section h3 { font-size: 1rem; font-weight: 600; color: #172037; margin: 0 0 0.75rem; }\n.spec-item { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f1f5f9; }\n.spec-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }\n.spec-name, .spec-uri { font-family: ui-monospace, monospace; font-size: 0.813rem; background: #f1f5f9; padding: 0.2rem 0.4rem; border-radius: 4px; }\n.spec-uri { word-break: break-all; }\n.spec-desc { margin: 0.5rem 0 0; font-size: 0.875rem; color: #64748b; line-height: 1.5; }\n.tabs-row {\n display: flex;\n gap: 2px;\n background: rgba(23,32,55,0.05);\n padding: 3px;\n border-radius: 8px;\n margin-bottom: 1.5rem;\n flex-wrap: wrap;\n}\n.tab {\n flex: 1;\n min-width: 80px;\n padding: 0.5rem 0.75rem;\n font-size: 0.813rem;\n font-weight: 500;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: #64748b;\n cursor: pointer;\n transition: background 0.15s, color 0.15s;\n}\n.tab:hover { color: #172037; background: rgba(255,255,255,0.6); }\n.tab.active { background: #fff; color: #172037; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }\n.tab-panel { display: none; }\n.tab-panel.active { display: block; }\n.tab-panel h3 { font-size: 1.125rem; font-weight: 600; color: #172037; margin: 0 0 1rem; }\n.install-btn {\n display: inline-block;\n padding: 0.375rem 0.875rem;\n background: #0f172a;\n color: #fff;\n border-radius: 9999px;\n text-decoration: none;\n font-weight: 500;\n font-size: 0.813rem;\n margin-bottom: 1rem;\n transition: background 0.15s;\n}\n.install-btn:hover { background: #1e293b; }\n.code-block {\n position: relative;\n margin: 1rem 0;\n}\n.code-block pre {\n margin: 0;\n padding: 0.5rem 0.75rem;\n background: #f8fafc;\n color: #475569;\n border-radius: 8px;\n font-family: ui-monospace, monospace;\n font-size: 0.875rem;\n overflow-x: auto;\n border: 1px solid rgba(0,0,0,0.08);\n}\n.code-block .copy-btn { top: 50%; right: 0.375rem; transform: translateY(-50%); }\n.copy-btn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n width: 2rem;\n height: 2rem;\n padding: 0;\n border: none;\n border-radius: 6px;\n background: #fff;\n color: #172037;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.15s;\n}\n.copy-btn:hover { background: #f1f5f9; }\n.copy-btn.copied { background: #fff; color: #172037; }\n.copy-btn svg { width: 14px; height: 14px; }\nol.steps { margin: 0; padding-left: 1.25rem; }\nol.steps li { margin: 0.5rem 0; color: #475569; }\na { color: #0522a5; text-decoration: none; }\na:hover { text-decoration: underline; }\n.hero-gradient-wrap {\n position: relative;\n padding: 1.5rem;\n overflow: hidden;\n}\n.hero-gradient-wrap canvas {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: block;\n}\n.hero-inner {\n position: relative;\n z-index: 1;\n background: rgba(253,252,252,0.9);\n -webkit-backdrop-filter: blur(12px);\n backdrop-filter: blur(12px);\n padding: 1.25rem 1.5rem;\n border: 1px solid rgba(0,0,0,0.06);\n}\n.hero-inner .card-header { padding: 0; }\n.hero-inner .card-header.has-icon { padding-top: 0.5rem; }\n</style>\n</head>\n<body>\n<div class=\"layout\">\n <div class=\"rail-left\"></div>\n <div class=\"rail-right\"></div>\n <div class=\"rail-top\"></div>\n <div class=\"rail-bottom\"></div>\n <svg class=\"corner corner-tl\" viewBox=\"0 0 22 21\" fill=\"none\"><path d=\"${LINE_INTERSECTION_PATH}\" fill=\"currentColor\"/></svg>\n <svg class=\"corner corner-tr\" viewBox=\"0 0 22 21\" fill=\"none\"><path d=\"${LINE_INTERSECTION_PATH}\" fill=\"currentColor\"/></svg>\n <svg class=\"corner corner-bl\" viewBox=\"0 0 22 21\" fill=\"none\"><path d=\"${LINE_INTERSECTION_PATH}\" fill=\"currentColor\"/></svg>\n <svg class=\"corner corner-br\" viewBox=\"0 0 22 21\" fill=\"none\"><path d=\"${LINE_INTERSECTION_PATH}\" fill=\"currentColor\"/></svg>\n\n <div class=\"card hero-card\">\n <div class=\"hero-gradient-wrap\" id=\"hero-gradient-wrap\">\n <canvas id=\"mesh-bg\" aria-hidden=\"true\"></canvas>\n <div class=\"hero-inner\">\n <div class=\"card-header ${iconUrl ? \"has-icon\" : \"\"}\">\n ${iconUrl ? `<img src=\"${escapeHtml(iconUrl)}\" alt=\"\" class=\"hero-icon\" width=\"64\" height=\"64\" />` : \"\"}\n <div class=\"hero-row\">\n <h1>${safeName} <span class=\"version\">(v${escapeHtml(version)})</span></h1>\n </div>\n ${safeDescription ? `<p class=\"hero-description\">${safeDescription}</p>` : \"\"}\n <div class=\"hero-url-block\">\n <div class=\"url-block\">\n <div class=\"url-box\" data-copy=\"${escapeHtml(url)}\">${escapeHtml(url)}</div>\n <button type=\"button\" class=\"copy-btn\" data-copy=\"${escapeHtml(url)}\" aria-label=\"Copy URL\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg></button>\n </div>\n </div>\n <div class=\"hero-cta-row\">\n <a href=\"${escapeHtml(manufactInspectorUrl)}\" class=\"hero-primary-btn\" target=\"_blank\" rel=\"noopener noreferrer\">Open in Inspector</a>\n </div>\n <div class=\"hero-powered\">\n <span>Powered by</span>\n <a href=\"https://github.com/mcp-use/mcp-use\" target=\"_blank\" rel=\"noopener noreferrer\">\n <svg class=\"gh-icon\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\"/></svg>\n github.com/mcp-use/mcp-use\n <img src=\"https://img.shields.io/github/stars/mcp-use/mcp-use\" alt=\"GitHub stars\" class=\"gh-shield\" width=\"90\" height=\"18\" loading=\"lazy\" />\n </a>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"card\">\n <div class=\"card-header\">\n <h2 class=\"card-title\">Installation Guide</h2>\n <p class=\"card-desc\">Choose your preferred MCP client</p>\n </div>\n <div class=\"card-content\">\n <div class=\"tabs-row\" role=\"tablist\">\n <button type=\"button\" class=\"tab active\" role=\"tab\" data-tab=\"claude-code\" aria-selected=\"true\">Claude Code</button>\n <button type=\"button\" class=\"tab\" role=\"tab\" data-tab=\"cursor\" aria-selected=\"false\">Cursor</button>\n <button type=\"button\" class=\"tab\" role=\"tab\" data-tab=\"vscode\" aria-selected=\"false\">VS Code</button>\n <button type=\"button\" class=\"tab\" role=\"tab\" data-tab=\"vscode-insiders\" aria-selected=\"false\">VS Code Insiders</button>\n <button type=\"button\" class=\"tab\" role=\"tab\" data-tab=\"chatgpt\" aria-selected=\"false\">ChatGPT</button>\n </div>\n\n <div id=\"panel-claude-code\" class=\"tab-panel active\">\n <h3>Install in Claude Code</h3>\n <p>Run this command in your terminal:</p>\n <div class=\"code-block\">\n <pre data-copy=\"${escapeHtml(claudeCommand)}\">${escapeHtml(claudeCommand)}</pre>\n <button type=\"button\" class=\"copy-btn\" aria-label=\"Copy\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg></button>\n </div>\n </div>\n\n <div id=\"panel-cursor\" class=\"tab-panel\">\n <h3>Install in Cursor</h3>\n <p>Click the button below to add this MCP server to Cursor:</p>\n <a href=\"${cursorDeepLink}\" class=\"install-btn\">Open in Cursor</a>\n <p>Or add manually: Settings → MCP → Add server</p>\n </div>\n\n <div id=\"panel-vscode\" class=\"tab-panel\">\n <h3>Install in VS Code</h3>\n <p>Click the button below to add this MCP server to VS Code:</p>\n <a href=\"${vscodeDeepLink}\" class=\"install-btn\">Open in VS Code</a>\n <p>Or add manually: Settings → MCP → Add server</p>\n </div>\n\n <div id=\"panel-vscode-insiders\" class=\"tab-panel\">\n <h3>Install in VS Code Insiders</h3>\n <p>Click the button below to add this MCP server to VS Code Insiders:</p>\n <a href=\"${vscodeInsidersDeepLink}\" class=\"install-btn\">Open in VS Code Insiders</a>\n <p>Or add manually: Settings → MCP → Add server</p>\n </div>\n\n <div id=\"panel-chatgpt\" class=\"tab-panel\">\n <h3>Connect with ChatGPT</h3>\n <ol class=\"steps\">\n <li><strong>Enable Developer Mode:</strong> Settings → Connectors → Advanced → Developer mode</li>\n <li><strong>Import this MCP server:</strong> Go to Connectors tab and add: ${escapeHtml(url)}</li>\n <li><strong>Use in conversations:</strong> Choose the MCP server from the Plus menu</li>\n </ol>\n </div>\n </div>\n </div>\n\n ${\n toolsListHtml || promptsListHtml || resourcesListHtml\n ? `\n <div class=\"card\">\n <div class=\"card-header\">\n <h2 class=\"card-title\">Primitives</h2>\n ${toolsListHtml ? `<div class=\"spec-section\"><h3>Tools (${normalizedTools.length})</h3>${toolsListHtml}</div>` : \"\"}\n ${promptsListHtml ? `<div class=\"spec-section\"><h3>Prompts (${prompts!.length})</h3>${promptsListHtml}</div>` : \"\"}\n ${resourcesListHtml ? `<div class=\"spec-section\"><h3>Resources (${resources!.length})</h3>${resourcesListHtml}</div>` : \"\"}\n </div>\n </div>\n `\n : \"\"\n }\n\n <footer class=\"footer-content\">\n <a href=\"https://manufact.com\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"footer-brand-link\" aria-label=\"Manufact\">\n <span class=\"logo-symbol\">\n <svg viewBox=\"0 0 500 500\" xmlns=\"http://www.w3.org/2000/svg\">\n <g class=\"logo-fill\" fill=\"currentColor\" fill-rule=\"nonzero\">\n <path d=\"${LOGO_SVG_PATHS.path1}\"/>\n <circle cx=\"${LOGO_SVG_PATHS.circle.cx}\" cy=\"${LOGO_SVG_PATHS.circle.cy}\" r=\"${LOGO_SVG_PATHS.circle.r}\"/>\n <path d=\"${LOGO_SVG_PATHS.path2}\"/>\n </g>\n <g class=\"logo-stroke\">\n <path d=\"${LOGO_SVG_PATHS.path1}\"/>\n <circle cx=\"${LOGO_SVG_PATHS.circle.cx}\" cy=\"${LOGO_SVG_PATHS.circle.cy}\" r=\"${LOGO_SVG_PATHS.circle.r}\"/>\n <path d=\"${LOGO_SVG_PATHS.path2}\"/>\n </g>\n </svg>\n </span>\n <span>Manufact</span>\n </a>\n </footer>\n</div>\n\n<script>${getMeshGradientScript()}</script>\n<script>\n(function(){\n var tabs = document.querySelectorAll('.tab');\n var panels = document.querySelectorAll('.tab-panel');\n tabs.forEach(function(tab){\n tab.addEventListener('click', function(){\n var target = tab.getAttribute('data-tab');\n tabs.forEach(function(t){ t.classList.remove('active'); t.setAttribute('aria-selected','false'); });\n panels.forEach(function(p){\n var match = p.id === 'panel-' + target;\n p.classList.toggle('active', match);\n p.hidden = !match;\n });\n tab.classList.add('active');\n tab.setAttribute('aria-selected','true');\n });\n });\n var copySvg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg>';\n var checkSvg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6L9 17l-5-5\"/></svg>';\n document.querySelectorAll('.copy-btn').forEach(function(btn){\n btn.addEventListener('click', function(){\n var text = btn.getAttribute('data-copy');\n if (!text) {\n var pre = btn.parentElement.querySelector('pre');\n text = pre ? (pre.getAttribute('data-copy') || pre.textContent) : '';\n }\n if (text) navigator.clipboard.writeText(text).then(function(){\n btn.classList.add('copied');\n btn.innerHTML = checkSvg;\n setTimeout(function(){ btn.classList.remove('copied'); btn.innerHTML = copySvg; }, 2000);\n });\n });\n });\n panels.forEach(function(p){ if(!p.classList.contains('active')) p.hidden = true; });\n})();\n</script>\n</body>\n</html>`;\n}\n"],"mappings":";AAUA,SAAS,WAAW,MAAsB;AACxC,SAAO,KACJ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ,EACtB,QAAQ,MAAM,OAAO;AAC1B;AAGA,SAAS,oBAAoB,OAAwB;AACnD,SAAO,KAAK,UAAU,KAAK,EACxB,QAAQ,MAAM,SAAS,EACvB,QAAQ,MAAM,SAAS;AAC5B;AAMA,SAAS,mBAAmB,MAAsB;AAChD,SAAO,KAAK,QAAQ,mBAAmB,G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AAA,uBAC3F,eAAe,KAAK;AAAA;AAAA;AAAA,uBAGpB,eAAe,KAAK;AAAA,0BACjB,eAAe,OAAO,EAAE,SAAS,eAAe,OAAO,EAAE,QAAQ,eAAe,OAAO,CAAC;AAAA,uBAC3F,eAAe,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UASjC,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCjC;","names":[]}
|
package/dist/cli/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyDH;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAwID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyDH;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAwID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyb/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views-plugin.d.ts","sourceRoot":"","sources":["../../src/cli/views-plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,QAAQ,EAAE,MAAM,cAAc,EAAE,CAAC;IACjC;;;;;;OAMG;IACH,GAAG,CAAC,EAAE;QACJ;;;;;;;WAOG;QACH,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"views-plugin.d.ts","sourceRoot":"","sources":["../../src/cli/views-plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,QAAQ,EAAE,MAAM,cAAc,EAAE,CAAC;IACjC;;;;;;OAMG;IACH,GAAG,CAAC,EAAE;QACJ;;;;;;;WAOG;QACH,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAwD3E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB"}
|
package/dist/commands/build.js
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
resolveUserViteConfig,
|
|
9
9
|
resolveWorkspacePaths,
|
|
10
10
|
virtualViewId
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-E7M6OYZ5.js";
|
|
12
12
|
import {
|
|
13
13
|
viewAssetsBasePath
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-XUI7QE2D.js";
|
|
15
15
|
import {
|
|
16
16
|
normalizeAssetsBaseUrl
|
|
17
17
|
} from "../chunk-FC2Z2VFO.js";
|
package/dist/commands/dev.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveTailwindCss,
|
|
12
12
|
resolveUserViteConfig,
|
|
13
13
|
resolveWorkspacePaths
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-E7M6OYZ5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/dev.ts
|
|
17
17
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -411,6 +411,7 @@ function serverFrom(moduleExports) {
|
|
|
411
411
|
return candidate;
|
|
412
412
|
}
|
|
413
413
|
async function runDev(options) {
|
|
414
|
+
process.env.MCP_USE_DEV_CLI = "1";
|
|
414
415
|
const host = options.host ?? "127.0.0.1";
|
|
415
416
|
const paths = resolveWorkspacePaths(options.cwd);
|
|
416
417
|
const eventBus = new InMemoryServerEventBus((error) => {
|