@fluidgrids/cli 2026.1124.1 → 2026.1124.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +20 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7844,7 +7844,7 @@ class TokenSource {
7844
7844
  async renew() {
7845
7845
  const { options } = this;
7846
7846
  if (!this.fresh(this.app)) {
7847
- const data = await graphql(options.fetch, options.globalEndpoint, "mutation ($input: APIKeyInput!) { authenticateAPIKey(input: $input) { success token expiresIn } }", { input: { apiKey: options.apiKey, apiSecret: options.apiSecret } }).catch((error) => {
7847
+ const data = await graphql(options.fetch, options.globalEndpoint, "mutation ($input: APIKeyInput!) { authenticateAPIKey(input: $input) { success token expiresIn } }", { input: { apiKey: options.apiKey, apiSecret: options.apiSecret } }, { ...options.extraHeaders }).catch((error) => {
7848
7848
  throw new Error(`The API key was not accepted: ${error instanceof Error ? error.message : "unknown error"}`);
7849
7849
  });
7850
7850
  const token = data.authenticateAPIKey?.token;
@@ -7865,6 +7865,7 @@ class TokenSource {
7865
7865
  if (options.organizationId)
7866
7866
  input.organizationId = options.organizationId;
7867
7867
  const data = await graphql(options.fetch, options.workspaceEndpoint, "mutation ($input: IssueWorkspaceTokenInput!) { issueWorkspaceToken(input: $input) { token } }", { input }, {
7868
+ ...options.extraHeaders,
7868
7869
  authorization: `Bearer ${app.value}`,
7869
7870
  ...options.productOrigin ? { origin: options.productOrigin } : {}
7870
7871
  }).catch((error) => {
@@ -8024,6 +8025,7 @@ class McpBridge {
8024
8025
  async post(body, retried) {
8025
8026
  const tokens = await this.options.tokens.get();
8026
8027
  const headers = {
8028
+ ...this.options.extraHeaders,
8027
8029
  "content-type": "application/json",
8028
8030
  accept: "application/json, text/event-stream",
8029
8031
  authorization: `Bearer ${tokens.appToken}`,
@@ -8060,6 +8062,12 @@ async function runMcpConnect(options, io) {
8060
8062
  if (!apiKey || !apiSecret) {
8061
8063
  throw new McpBridgeConfigError(`Set ${API_KEY_ENV} and ${API_SECRET_ENV} to the API key and secret of an app authorised for the workspace`);
8062
8064
  }
8065
+ const cfId = io.env[CF_ACCESS_ID_ENV]?.trim();
8066
+ const cfSecret = io.env[CF_ACCESS_SECRET_ENV]?.trim();
8067
+ if (!cfId !== !cfSecret) {
8068
+ throw new McpBridgeConfigError(`Set both ${CF_ACCESS_ID_ENV} and ${CF_ACCESS_SECRET_ENV}, or neither`);
8069
+ }
8070
+ const extraHeaders = cfId && cfSecret ? { "cf-access-client-id": cfId, "cf-access-client-secret": cfSecret } : {};
8063
8071
  const target = parseMcpTarget(options.url, options.workspaceEndpoint);
8064
8072
  const tokens = new TokenSource({
8065
8073
  apiKey,
@@ -8069,15 +8077,23 @@ async function runMcpConnect(options, io) {
8069
8077
  globalEndpoint: options.globalEndpoint,
8070
8078
  workspaceEndpoint: options.workspaceEndpoint,
8071
8079
  ...options.productOrigin ? { productOrigin: options.productOrigin } : {},
8080
+ extraHeaders,
8072
8081
  fetch: io.fetch
8073
8082
  });
8074
- const bridge = new McpBridge({ target, tokens, fetch: io.fetch, send: io.send, log: io.log });
8083
+ const bridge = new McpBridge({
8084
+ target,
8085
+ tokens,
8086
+ fetch: io.fetch,
8087
+ send: io.send,
8088
+ log: io.log,
8089
+ extraHeaders
8090
+ });
8075
8091
  io.log(`mcp connect: relaying to ${target.url.origin}${target.url.pathname}` + (target.serverPath ? ` (MCP Server Trigger "${target.serverPath}")` : " (published tool set)"));
8076
8092
  for await (const line of io.lines)
8077
8093
  bridge.accept(line);
8078
8094
  await bridge.drain();
8079
8095
  }
8080
- var MCP_PATH, RENEW_MARGIN_MS = 60000, WORKSPACE_TOKEN_FALLBACK_MS, REQUEST_TIMEOUT_MS2 = 90000, API_KEY_ENV = "FLUIDGRIDS_MCP_API_KEY", API_SECRET_ENV = "FLUIDGRIDS_MCP_API_SECRET", McpBridgeConfigError;
8096
+ var MCP_PATH, RENEW_MARGIN_MS = 60000, WORKSPACE_TOKEN_FALLBACK_MS, REQUEST_TIMEOUT_MS2 = 90000, API_KEY_ENV = "FLUIDGRIDS_MCP_API_KEY", API_SECRET_ENV = "FLUIDGRIDS_MCP_API_SECRET", CF_ACCESS_ID_ENV = "FLUIDGRIDS_CF_ACCESS_CLIENT_ID", CF_ACCESS_SECRET_ENV = "FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET", McpBridgeConfigError;
8081
8097
  var init_bridge = __esm(() => {
8082
8098
  MCP_PATH = /^\/mcp\/([a-z][a-z0-9-]{1,63})\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\/s\/([a-z0-9][a-z0-9-]{2,63})(?:\/test)?)?\/?$/i;
8083
8099
  WORKSPACE_TOKEN_FALLBACK_MS = 15 * 60000;
@@ -11836,6 +11852,7 @@ var mcpModule = {
11836
11852
  " fluidgrids mcp connect https://graphqlworkspaces.burdenoff.com/mcp/fluidgrids/<workspace id>/s/crm-tools",
11837
11853
  "",
11838
11854
  "stdout carries MCP messages only; the client starts this command and talks to it over stdio.",
11855
+ "A gateway behind Cloudflare Access also needs FLUIDGRIDS_CF_ACCESS_CLIENT_ID and FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET.",
11839
11856
  "Documentation: https://docs.fluidgrids.ai/users/mcp-server-trigger"
11840
11857
  ].join(`
11841
11858
  `)).action(async (url, flags) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidgrids/cli",
3
- "version": "2026.1124.1",
3
+ "version": "2026.1124.2",
4
4
  "description": "CLI tool for FluidGrids — workflow automation management (thin shell over @burdenoff/cli-sdk)",
5
5
  "type": "module",
6
6
  "private": false,