Skip to main content
The GoRules CLI (@gorules/cli) is an open-source command-line tool for GoRules BRMS. It exposes an MCP (Model Context Protocol) server so AI-powered editors like Claude Code, Cursor, and Windsurf can read, evaluate, and interact with your decision logic directly, and it ships rules from BRMS into your own infrastructure with gorules pull. npm: @gorules/cli

Installation

Quick start

Start the MCP bridge:
This launches a local server on port 41919 that:
  1. Exposes an MCP endpoint for AI tools to discover and call GoRules tools
  2. Exposes REST endpoints for evaluating decisions and fetching decision files
  3. Opens a WebSocket connection that the GoRules browser editor connects to
Once running, open your GoRules project in the browser and click Connect MCP to link the editor to your local CLI.

Commands

gorules mcp start

Start the MCP bridge server.

gorules pull

Download the rules artifact for a project target. See Pulling rules into a pipeline.

Pulling rules into a pipeline

gorules pull resolves a target in BRMS through the Rules Sync API and downloads the matching rules artifact. It is the building block for shipping rules from BRMS into your own infrastructure: a CI job pulls the artifact and uploads it wherever your runtime - typically the Agent - reads it from. For end-to-end pipelines - BRMS webhook to object storage, with environment routing - see the CI/CD integration guides for GitHub Actions, GitLab CI, and Azure DevOps.
Run it in a pipeline with npx:
For reproducible production pipelines, pin a released version (@gorules/cli@<version>, action/template tag cli-v<version>) instead of tracking latest.

Targets

Naming the output

By default the artifact is written as <project-key> with no .zip suffix, because the Agent’s S3, GCS, and Azure Blob providers use the object name verbatim as the project key. The Agent’s local zip provider is the opposite - it reads <root>/<project>.zip and strips the suffix itself - so that destination needs --name pricing.zip. With --unpack, --name is the sub-directory to extract into (default: the project key, the layout the Agent’s filesystem provider expects). Pass --name . to extract straight into --out, which is what you want when baking rules into a container image:
Extraction behaves like aws s3 sync: byte-identical files are left untouched, changed files are written atomically, and files the artifact does not carry are preserved. Add --delete for s3 sync --delete semantics, so rules deleted in BRMS are deleted on disk too. As a guard against wiping a directory it does not own, --delete refuses a non-empty destination without a .config/project.json from a previous pull.

Exit codes

Pipelines branch on the exit code:

GitHub Actions

A composite action lives in the gorules/cli repository, so the tag you pin is the CLI version you get. A payload sent by a BRMS webhook via workflow_dispatch is picked up automatically.
The action outputs project, target (payload-aware), changed, release, version, commit, sha256, and files, so the workflow routes on what was actually pulled and a scheduled workflow can skip the upload when nothing moved.

GitLab CI

templates/gitlab-ci-pull.yml defines a hidden job you extend. GORULES_URL and GORULES_TOKEN are CI/CD variables; mask and protect the token.
The job publishes RULES_CHANGED, RULES_PROJECT, RULES_TARGET, RULES_VERSION, RULES_RELEASE, and RULES_SHA256 as a dotenv report, so later jobs read them as ordinary variables.

Azure Pipelines

templates/azure-pipelines-pull.yml is a steps template: it pulls the artifact and sets result variables, and you append your own publish step in the same job. GORULES_TOKEN must exist as a secret pipeline variable or in a linked variable group.
The template sets rulesChanged, rulesProject, rulesTarget (payload-aware), rulesVersion, rulesRelease, and rulesSha256 for the steps that follow.
For BRMS-triggered runs, the pipeline must accept the GRL_PAYLOAD variable at queue time: add a pipeline variable named GRL_PAYLOAD with “Let users override this value when running this pipeline” checked. Organizations with “Limit variables that can be set at queue time” enabled reject the queue request otherwise.

REST API

When the bridge is running, it exposes HTTP endpoints for local development.

Evaluate a decision

Response:
Optional body fields: trace (boolean), maxDepth (number).

Retrieve a decision file

Returns the raw decision graph JSON. You can use this as a loader for the ZEN Engine:

How it works

The CLI acts as a bridge between AI tools and the GoRules browser editor:
  1. The CLI starts and generates a connection token
  2. The GoRules browser editor connects via WebSocket using the token
  3. The editor sends a tool manifest - the list of available tools for that project
  4. AI tools discover these tools via MCP and invoke them
  5. The CLI forwards tool calls to the browser, which executes them and returns results
The CLI is stateless - it doesn’t store credentials or project data. All tool execution happens in the browser editor, which has an authenticated session with the GoRules platform.

License

MIT