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
- Go to Claude.ai → Settings → Connectors
- Click Add Custom Connector
- Enter:
https://mcp.lexq.io - Claude opens the LexQ login page
- Sign in with Google, email/password, or paste an API Key directly
- Select or generate an API Key → click Authorize
- Done — the full toolset is now available in all conversations
Claude.ai handles the full OAuth flow automatically. Your API Key is securely stored as a Bearer token — no config files needed.
Architecture
Local — stdio MCP Server
For desktop AI tools that support local MCP servers.Prerequisites
- Node.js 22+ installed
- Run
lexq auth loginonce to store your API key
Claude Desktop
- macOS
- Windows
Edit
~/Library/Application Support/Claude/claude_desktop_config.json: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.
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: there, it would read files on LexQ’s server, not on your computer.
fileis an absolute path. A leading~/stands for your home directory.- The name must end in
.csvor.json. A symbolic link is followed, and the file it points to must end in.csvor.jsontoo. - A
.jsonfile 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.
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.
Agent Best Practices
- Read skills first. Have the agent read
skills/lexq-shared/SKILL.mdbefore any task. - Follow the standard workflow. Create group → version → facts → rules → dry-run → publish → deploy.
- Always dry-run before publishing.
- Handle the response envelope. Check
result === "SUCCESS"— notsuccess === true. - Register facts you reference. Register every action target (the
targetVarofSET_FACTandMUTATE_FACT) before saving the rule; otherwise the save fails withACT-032. For a key the rule only reads, thecreate/updateresponse includes a non-blocking warning naming it. Register it withlexq_facts_createto enable type validation, or calllexq_facts_unregisteredto audit the whole version. - Check the rules a value domain change lists. When
lexq_facts_updatechanges 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). - Read the group before rolling back.
lexq_deploy_rollbackrequiresexpectedCurrentVersionIdandexpectedCurrentDeploymentId. Pass thecurrentVersionIdandcurrentDeploymentIdthatlexq_groups_getreturned. A409withP-062orP-063means the group changed after that read: read it again and confirm with the user before retrying (details).
Troubleshooting
stdio: 'API key not found'
stdio: 'API key not found'
Run
lexq auth login to store your API key before starting the MCP server.stdio: 'npx: command not found'
stdio: 'npx: command not found'
Ensure Node.js 22+ is installed. Run
node --version to verify.stdio: Tools aren't visible after setup
stdio: Tools aren't visible after setup
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.

