What is MCP?
The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools and data sources. LexQ CLI includes a built-in MCP server that exposes the entire LexQ API as 53 tools. When connected, AI agents can manage your policies directly:- “Create a discount rule for VIP customers”
- “Dry-run this version with payment_amount=200000”
- “Run a batch simulation comparing v3 and v4”
Quick Start
- Node.js 18+ installed
- Run
lexq auth loginonce to store your API key - Start the server:
The MCP server uses the same API key and base URL from
~/.lexq/config.json. No additional authentication setup is needed.Setup Guides
Claude Desktop
- macOS
- Windows
Edit
~/Library/Application Support/Claude/claude_desktop_config.json:Claude.ai (Web)
Go to Settings → MCP Servers → Add, set Command:npx, Args: -y @lexq/cli serve --mcp.
VS Code / Cursor
Create.vscode/mcp.json (or .cursor/mcp.json):
Windsurf / Other MCP Clients
Available Tools — 53
| Domain | Tools | Description |
|---|---|---|
| Status | 1 | lexq_whoami |
| Groups | 8 | CRUD + A/B test |
| Versions | 6 | CRUD + clone |
| Rules | 7 | CRUD + reorder + toggle |
| Facts | 4 | CRUD |
| Deploy | 7 | publish, live, rollback, undeploy, history, detail, overview |
| Analytics | 8 | dry-run, compare, requirements, simulation × 5 |
| History | 3 | list, get, stats |
| Integrations | 5 | list, get, save, delete, config-spec |
| Logs | 4 | list, get, action, bulk-action |
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.
Troubleshooting
”Error: API key not found”
Runlexq auth login before starting the MCP server.
MCP server starts but tools aren’t visible
Restart your AI client after adding the MCP configuration.Connection timeout
The MCP server uses stdio transport — it doesn’t open network ports. Ensure your client supports stdio transport.Next Steps
Command Reference
Full list of all CLI commands mapped to MCP tools.
Policy Rules
Condition syntax and action types for rule creation.

