# LexQ

Hooks an agent up to LexQ, where pricing, discounts and eligibility checks get edited without redeploying your service. Handy if those rules move often.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: lexq-io
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/lexq-io/lexq-cli
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/lexq

## What it does

LexQ takes business logic out of your codebase. Your service asks the LexQ API for a decision, while the rules themselves live in a console or in `@lexq/cli`. You can trial an edit against earlier runs or an uploaded dataset, then push it live without cutting an app release.

Over MCP the agent manages policy groups, versions, rules and facts, starts simulations and looks at how past decisions turned out. Deploy, rollback and undeploy tools carry a destructive flag, so the client may ask you to confirm. Two connection modes exist: the hosted endpoint `https://mcp.lexq.io` with OAuth 2.1, and a local stdio server started by `lexq serve --mcp`.

The stdio route needs an API key stored via `lexq auth login` in `~/.lexq/config.json`, or `LEXQ_API_KEY` set in the client's environment. The CLI asks for Node.js 22+. Skip the key and the local server won't come up. Skill files ship inside the package under `node_modules/@lexq/cli/skills/`, so the agent can read how each tool should be called.

## Requirements
- Needs: Node.js (commands run via npx)
- Remote server: `https://mcp.lexq.io/mcp`
- Environment variables: `LEXQ_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

1. **Platform CLI: remote server**
```bash
claude mcp add --transport http lexq https://mcp.lexq.io/mcp
```

2. **Platform CLI**
```bash
claude mcp add --env LEXQ_API_KEY=<LEXQ_API_KEY> --transport stdio lexq -- npx -y @lexq/cli
```
Replace <…> with your own values

### Codex

1. **Platform CLI: remote server**
```bash
codex mcp add lexq --url https://mcp.lexq.io/mcp
```

2. **Platform CLI**
```bash
codex mcp add lexq --env LEXQ_API_KEY=<LEXQ_API_KEY> -- npx -y @lexq/cli
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "lexq": {
            "url": "https://mcp.lexq.io/mcp"
        }
    }
}
```
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "lexq": {
            "command": "npx",
            "args": [
                "-y",
                "@lexq/cli"
            ],
            "env": {
                "LEXQ_API_KEY": "<LEXQ_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "lexq": {
            "type": "http",
            "url": "https://mcp.lexq.io/mcp"
        }
    }
}
```
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "lexq": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@lexq/cli"
            ],
            "env": {
                "LEXQ_API_KEY": "<LEXQ_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

1. **Platform CLI: remote server**
```bash
gemini mcp add -t http lexq https://mcp.lexq.io/mcp
```

2. **Platform CLI**
```bash
gemini mcp add -e LEXQ_API_KEY=<LEXQ_API_KEY> lexq npx -y @lexq/cli
```
Replace <…> with your own values

## When to use it
- tweak a discount or shipping threshold without shipping new service code
- test a rule edit against earlier decisions before going live
- let an agent reach policy groups and versions through MCP
- trace why a rule fired a certain way via execution history
- roll back a bad rules deploy with one command

## Example prompts
- List the policy groups in LexQ and their current versions.
- Run a dry-run of version `<VERSION_ID>` on facts `{"loyaltyTier":"PLATINUM","purchaseSubtotalUsd":150}` and explain the outcome.
- Publish version `<VERSION_ID>` in group `<GROUP_ID>` with the memo “v1”.

## Similar
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/decisionrules-mcp-server.md) — MCP server
- [modernize-review](https://affpapa.org/en/nevibecode/commands/modernize-review.md) — command · ★ 44770
- [business-rules-extractor](https://affpapa.org/en/nevibecode/agents/business-rules-extractor.md) — subagent · ★ 44770
- [mirofish-offline-simulation](https://affpapa.org/en/nevibecode/skills/mirofish-offline-simulation.md) — skill · 1400 installs
- [spice](https://affpapa.org/en/nevibecode/skills/spice.md) — skill · 624 installs
- [llmquant-portfolio-lab](https://affpapa.org/en/nevibecode/skills/llmquant-portfolio-lab.md) — skill · 479 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
