Pega AI plugin: connecting to multiple environments
Pega ships a Claude plugin for Infinity AI authoring: pegasystems/infinity-ai-plugins. Install it by following the repo’s own README.
Once installed, the plugin is a single global install - one plugin, one MCP server, one Pega endpoint. If you work across multiple Pega environments (dev, QA, different client labs), the out-of-the-box setup forces you to reconfigure the Pega endpoint using the bundled pega-setup skill every time you switch context.
This article covers how to make that one installed plugin connect to a different Pega environment per project, in Claude Code CLI and Claude Code Desktop.
The plugin’s bundled MCP server (infinity-rules-mcp.jar) reads its connection details from a JSON config file. By default it always reads ~/.infinity-rules-mcp/config.json - a single file for your user account. The jar does support an environment variable override, INFINITY_RULES_MCP_CONFIG_FILE, pointing to an alternate config path.
The setup
1. Install the plugin normally. Via Claude Code Desktop’s UI or claude plugin install pega-infinity-authoring@Pega - nothing special here.
2. Optionally run the pega-setup skill
to generate a sample ~/.infinity-rules-mcp/config.json with the base URL and other expected settings.
3. Per project, create a local config file:
You may copy and update the sample created in the previous step.
<project-root>/.infinity-rules-mcp/config.json
{
"pega_base_url": "https://your-pega-instance.domain.com/"
}
(add any other settings the sample file included)
4. Per project, point the override at it via .claude/settings.local.json:
<project-root>/.claude/settings.local.json
With the following exact content, or add the env part to the existing file:
{
"env": {
"INFINITY_RULES_MCP_CONFIG_FILE": "${CLAUDE_PROJECT_DIR}/.infinity-rules-mcp/config.json"
}
}
Note: the bundled
pega-setupskill always writes to~/.infinity-rules-mcp/config.jsonregardless of any override in effect, so it won’t update the endpoint for any particular project after the above configuration.
Why it works
Claude Code loads project settings - including the top-level env block - before it spawns plugin MCP servers. The java subprocess inherits that environment, and this jar genuinely respects the INFINITY_RULES_MCP_CONFIG_FILE variable, pointing the MCP server at the alternate config.
Surprisingly, this setup works in both Claude Code CLI and Claude Desktop when opened in the same project folder - apparently Desktop’s Code engine honors project-level settings.local.json too, not just global settings.