@frontic/ui 0.7.0 → 0.8.0

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/index.js CHANGED
@@ -2101,6 +2101,7 @@ const info = new Command().name("info").description("get information about your
2101
2101
  //#endregion
2102
2102
  //#region src/commands/mcp.ts
2103
2103
  const FRONTIC_MCP_VERSION = "latest";
2104
+ const REMOTE_MCP_URL = "https://ui.frontic.io/mcp";
2104
2105
  const CLIENTS = [
2105
2106
  {
2106
2107
  name: "claude",
@@ -2159,6 +2160,57 @@ args = ["@frontic/ui@${FRONTIC_MCP_VERSION}", "mcp"]
2159
2160
  }
2160
2161
  }
2161
2162
  ];
2163
+ const REMOTE_CLIENTS = [
2164
+ {
2165
+ name: "claude",
2166
+ label: "Claude Code",
2167
+ configPath: ".mcp.json",
2168
+ config: { mcpServers: { "frontic-ui": {
2169
+ type: "streamable-http",
2170
+ url: REMOTE_MCP_URL
2171
+ } } }
2172
+ },
2173
+ {
2174
+ name: "cursor",
2175
+ label: "Cursor",
2176
+ configPath: ".cursor/mcp.json",
2177
+ config: { mcpServers: { "frontic-ui": {
2178
+ command: "npx",
2179
+ args: ["mcp-remote", REMOTE_MCP_URL]
2180
+ } } }
2181
+ },
2182
+ {
2183
+ name: "vscode",
2184
+ label: "VS Code",
2185
+ configPath: ".vscode/mcp.json",
2186
+ config: { servers: { "frontic-ui": {
2187
+ type: "http",
2188
+ url: REMOTE_MCP_URL
2189
+ } } }
2190
+ },
2191
+ {
2192
+ name: "codex",
2193
+ label: "Codex",
2194
+ configPath: ".codex/config.toml",
2195
+ config: `[mcp_servers.frontic_ui]
2196
+ command = "npx"
2197
+ args = ["mcp-remote", "${REMOTE_MCP_URL}"]
2198
+ `
2199
+ },
2200
+ {
2201
+ name: "opencode",
2202
+ label: "Opencode",
2203
+ configPath: "opencode.json",
2204
+ config: {
2205
+ $schema: "https://opencode.ai/config.json",
2206
+ mcp: { "frontic-ui": {
2207
+ type: "remote",
2208
+ enabled: true,
2209
+ url: REMOTE_MCP_URL
2210
+ } }
2211
+ }
2212
+ }
2213
+ ];
2162
2214
  const DEPENDENCIES = [`@frontic/ui@${FRONTIC_MCP_VERSION}`];
2163
2215
  const mcp = new Command().name("mcp").description("MCP server and configuration commands").option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).action(async (options) => {
2164
2216
  try {
@@ -2178,12 +2230,14 @@ const mcpInitOptionsSchema = z$1.object({
2178
2230
  "codex",
2179
2231
  "opencode"
2180
2232
  ]),
2181
- cwd: z$1.string()
2233
+ cwd: z$1.string(),
2234
+ local: z$1.boolean().default(false)
2182
2235
  });
2183
- mcp.command("init").description("Initialize MCP configuration for your client").option("--client <client>", `MCP client (${CLIENTS.map((c) => c.name).join(", ")})`).action(async (opts, command) => {
2236
+ mcp.command("init").description("Initialize MCP configuration for your client").option("--client <client>", `MCP client (${CLIENTS.map((c) => c.name).join(", ")})`).option("--local", "Use local MCP server via npx instead of the hosted remote server", false).action(async (opts, command) => {
2184
2237
  try {
2185
2238
  const cwd = (command.parent?.opts() || {}).cwd || process.cwd();
2186
2239
  let client = opts.client;
2240
+ let local = opts.local;
2187
2241
  if (!client) {
2188
2242
  const response = await prompts({
2189
2243
  type: "select",
@@ -2200,10 +2254,58 @@ mcp.command("init").description("Initialize MCP configuration for your client").
2200
2254
  }
2201
2255
  client = response.client;
2202
2256
  }
2257
+ if (!local) {
2258
+ const modeResponse = await prompts({
2259
+ type: "select",
2260
+ name: "mode",
2261
+ message: "How do you want to run the MCP server?",
2262
+ choices: [{
2263
+ title: "Remote (hosted)",
2264
+ value: "remote",
2265
+ description: "Connects to hosted server — no install needed"
2266
+ }, {
2267
+ title: "Local (npx)",
2268
+ value: "local",
2269
+ description: "Runs locally via npx — requires Node.js"
2270
+ }]
2271
+ });
2272
+ if (!modeResponse.mode) {
2273
+ logger.break();
2274
+ process.exit(1);
2275
+ }
2276
+ local = modeResponse.mode === "local";
2277
+ }
2203
2278
  const options = mcpInitOptionsSchema.parse({
2204
2279
  client,
2205
- cwd
2280
+ cwd,
2281
+ local
2206
2282
  });
2283
+ if (!options.local) {
2284
+ const clientList = REMOTE_CLIENTS;
2285
+ const clientInfo = clientList.find((c) => c.name === options.client);
2286
+ if (!clientInfo) throw new Error(`Unknown client: ${options.client}`);
2287
+ if (options.client === "codex") {
2288
+ logger.break();
2289
+ logger.log("To configure the Frontic UI MCP server (remote) in Codex:");
2290
+ logger.break();
2291
+ logger.log(`1. Open or create the file ${highlighter.info("~/.codex/config.toml")}`);
2292
+ logger.log("2. Add the following configuration:");
2293
+ logger.log();
2294
+ logger.info(clientInfo.config);
2295
+ logger.break();
2296
+ logger.info("3. Restart Codex to load the MCP server");
2297
+ logger.break();
2298
+ process.exit(0);
2299
+ }
2300
+ const configSpinner$1 = spinner("Configuring remote MCP server...").start();
2301
+ const configPath$1 = await runMcpInit(options, clientList);
2302
+ configSpinner$1.succeed("Configuring remote MCP server.");
2303
+ logger.break();
2304
+ logger.success(`Configuration saved to ${configPath$1}.`);
2305
+ logger.info("Using hosted remote server — no local dependencies needed.");
2306
+ logger.break();
2307
+ return;
2308
+ }
2207
2309
  const config = await getConfig(options.cwd);
2208
2310
  if (options.client === "codex") {
2209
2311
  if (config) await updateDependencies([], DEPENDENCIES, config, { silent: false });
@@ -2257,9 +2359,9 @@ args = ["@frontic/ui@${FRONTIC_MCP_VERSION}", "mcp"]`);
2257
2359
  }
2258
2360
  });
2259
2361
  const overwriteMerge = (_destArray, sourceArray) => sourceArray;
2260
- async function runMcpInit(options) {
2362
+ async function runMcpInit(options, clientList = CLIENTS) {
2261
2363
  const { client, cwd } = options;
2262
- const clientInfo = CLIENTS.find((c) => c.name === client);
2364
+ const clientInfo = clientList.find((c) => c.name === client);
2263
2365
  if (!clientInfo) throw new Error(`Unknown client: ${client}. Available clients: ${CLIENTS.map((c) => c.name).join(", ")}`);
2264
2366
  const configPath = path.join(cwd, clientInfo.configPath);
2265
2367
  const dir = path.dirname(configPath);
@@ -2417,7 +2519,7 @@ const migrate = new Command().name("migrate").description("run a migration.").ar
2417
2519
 
2418
2520
  //#endregion
2419
2521
  //#region package.json
2420
- var version = "0.7.0";
2522
+ var version = "0.8.0";
2421
2523
 
2422
2524
  //#endregion
2423
2525
  //#region src/index.ts