Skip to main content

What is MCP?

The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools and data sources. LexQ provides a full MCP toolset covering the entire policy lifecycle. When connected, AI agents can manage your policies directly:
  • “Create a discount rule for VIP customers”
  • “Dry-run this version with loyaltyTier=‘PLATINUM’”
  • “Run an Impact Simulation comparing v3 and v4”

Two Connection Methods


Cloud — Claude.ai Custom Integration

The fastest way to connect. No installation, no terminal — just a URL.

Setup

  1. Go to Claude.ai → Settings → Connectors
  2. Click Add Custom Connector
  3. Enter: https://mcp.lexq.io
  4. Claude opens the LexQ connection page. It names the app the key will be sent to, such as claude.ai
  5. Sign in, or click I already have an API key and paste one (Signing in)
  6. Click Create a key and authorize. LexQ creates a Manage key for this connection and gives it to Claude. To keep your number of keys the same, click Replace next to an existing Manage key instead
  7. Done — the full toolset is now available in all conversations
Claude.ai handles the OAuth flow automatically — no config files needed.

Signing in

  • Google. The first time, this creates a LexQ account on the Free plan, and signing in means you agree to the Terms of Service. No credit card is needed.
  • Email and password. Sign up in the console first, then sign in here. If your email is not verified yet, the page shows Email verification is required. Please check your inbox. and a Resend verification email button. If you forgot your password, Forgot password? opens the console’s password reset in a new tab.
  • I already have an API key. Paste a key with Manage scope (Scope). An Execute only key is rejected with This key is Execute only. MCP needs a key with Scope: Manage.

Keys and your organization

  • Each connection uses its own Manage key. An organization can have up to 20 active API keys, including keys made in the console. At the limit, creating a key fails with Active API keys cannot exceed 20. Replace an existing key on the connection page, or revoke one in Console → Management → API Keys.
  • Replace turns the old key off and connects with a new one. Anything still using the old key stops working right away.
  • Only an organization admin can create API keys. An Operator or Viewer sees Only an organization admin can create API keys. Paste a Manage key that an admin gives you, or ask an admin to change your role to Admin.
  • Before you authorize, the page shows the account you signed in with, your organization’s time zone, and the key’s scope. Dates and billing periods follow the organization’s time zone. Change it in Console → Settings → Organization.
  • Keys created on this page are named after the app, such as MCP · claude.ai. To disconnect, remove the connector in Claude and revoke its key in Console → Management → API Keys.

Local — stdio MCP Server

For desktop AI tools that support local MCP servers.

Prerequisites

  1. Node.js 22+ installed
  2. Run lexq auth login once to store your API key

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
Restart Claude Desktop after editing.

VS Code / Cursor

Create .vscode/mcp.json (or .cursor/mcp.json):

Windsurf / Gemini CLI / Other MCP Clients

Any MCP-compatible client that supports stdio transport:
The stdio server reads the API key from ~/.lexq/config.json. Run lexq auth login before starting.

Available Tools

Tool names share a consistent lexq_ namespace grouped by resource — for example lexq_rules_create, lexq_versions_clone, lexq_deploy_rollback. Both connection methods expose the same toolset, except that only the local server has lexq_dataset_upload_file (below); see the Command Reference for the complete list with parameters. There is deliberately no PII reveal tool — revealing plaintext stays console-only and audited. Failure logs can be listed and read, but resolving or ignoring one is console-only: an organization admin does it under Management → Failure Logs.
LexQ exposes a large MCP toolset. Some MCP clients cap the number of active tools they send to the model, or degrade as the tool count grows — tools beyond a client’s limit may be dropped, sometimes with only a warning. If your client reports a tool limit, or the agent can’t find a tool you expect, disable the LexQ tools you don’t currently need in your client’s MCP settings.

Dataset files

lexq_dataset_upload_file uploads a CSV or JSON file from the computer the local server runs on. The server reads the file from disk, so its content never passes through the conversation. The cloud server does not have this tool.
  • file is an absolute path. A leading ~/ stands for your home directory.
  • The name must end in .csv or .json. A symbolic link is followed, and the file it points to must end in .csv or .json too.
  • A .json file must hold an array of records. The engine also accepts a single object such as {"facts": {...}}, but this tool refuses it; wrap it in [ ] first.
  • Size and encoding limits are the same as for any dataset upload.
It returns the stored path and a dataset block to pass to lexq_simulation_start. lexq_dataset_upload, which both servers have, sends the content inside the tool call, so it suits small datasets, and the cloud server limits the size of a request. For a larger file on Claude.ai, upload it in the Console or with lexq analytics dataset upload and give the agent the returned path.
The agent chooses the path. Instructions hidden in a web page or a file it has read can make it upload a different .csv or .json file than the one you meant. When your client asks you to approve the call, check the path.

Agent Best Practices

  1. Read skills first. Have the agent read skills/lexq-shared/SKILL.md before any task.
  2. Follow the standard workflow. Create group → version → facts → rules → dry-run → publish → deploy.
  3. Always dry-run before publishing.
  4. Handle the response envelope. Check result === "SUCCESS" — not success === true.
  5. Register facts you reference. Register every action target (the targetVar of SET_FACT and MUTATE_FACT) before saving the rule; otherwise the save fails with ACT-032. For a key the rule only reads, the create/update response includes a non-blocking warning naming it. Register it with lexq_facts_create to enable type validation, or call lexq_facts_unregistered to audit the whole version.
  6. Check the rules a value domain change lists. When lexq_facts_update changes a fact’s value domain and rules compare the fact with values the new domain does not accept, the result ends with a warning that lists them by version. The update is already saved. Fix the listed conditions in drafts, or in a clone of the deployed version, before publishing (details).
  7. Read the group before rolling back. lexq_deploy_rollback requires expectedCurrentVersionId and expectedCurrentDeploymentId. Pass the currentVersionId and currentDeploymentId that lexq_groups_get returned. A 409 with P-062 or P-063 means the group changed after that read: read it again and confirm with the user before retrying (details).

Troubleshooting

Remove the connector in Settings → Connectors, then re-add https://mcp.lexq.io. Sign in and click Create a key and authorize. Re-adding uses one more API key unless you click Replace next to the key the old connection used. See Troubleshooting for the messages the connection page shows.
Run lexq auth login to store your API key before starting the MCP server.
Ensure Node.js 22+ is installed. Run node --version to verify.
Restart your AI client (Claude Desktop, VS Code, etc.) after adding the MCP configuration.

Next Steps

Command Reference

Full list of all CLI commands mapped to MCP tools.

Policy Rules

Condition syntax and action types for rule creation.

Dry Run

Validate rules before publishing.