Pega AI plugin: connecting to multiple environments

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-setup skill always writes to ~/.infinity-rules-mcp/config.json regardless 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.

Nice! I was always switching the config every time manually in the config file

To connect the Pega AI plugin to multiple environments, install the plugin once using the standard setup. Create a separate .infinity-rules-mcp/config.json file in each project with the correct Pega environment URL and settings. Next, update the project’s .claude/settings.local.json file to set the INFINITY_RULES_MCP_CONFIG_FILE environment variable to ${CLAUDE_PROJECT_DIR}/.infinity-rules-mcp/config.json. This allows the MCP server to automatically load the correct configuration for each project. You can then connect to Dev, QA, or other Pega environments without changing the global plugin settings. This approach works with Claude Code CLI and Desktop and makes managing multiple Pega environments easier