pega

amribhatt/pega

3.1

If you are the rightful owner of pega and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is designed to interface with the Pega Platform, providing tools and resources for efficient case management.

Tools
3
Resources
0
Prompts
0

Pega MCP + ADK Agent

A complete setup for Pega case management using MCP (Model Context Protocol) server and ADK (Agent Development Kit) agent.

Overview

This repository contains two main components:

  • Pega MCP Server (pega-mcp/) - Connects to Pega Platform APIs
  • Pega ADK Agent (pega-adk/) - AI agent that uses MCP tools to manage Pega cases

Quick Start

1. Clone the Repository

git clone https://github.com/amribhatt/pega.git
cd pega

2. Configure Environment

# Copy environment templates
cd pega-mcp
copy env.template .env

cd ../pega-adk
copy env.template .env

Edit the .env files with your actual credentials:

  • pega-mcp/.env - Pega Platform credentials
  • pega-adk/.env - ADK agent configuration

3. Create Virtual Environments

# Create virtual environment for MCP server
cd pega-mcp
python -m venv .venv
.venv\Scripts\activate  # On Windows
# source .venv/bin/activate  # On Linux/Mac

# Install MCP server dependencies
pip install -r requirements.txt

# Create virtual environment for ADK agent
cd ../pega-adk
python -m venv .venv
.venv\Scripts\activate  # On Windows
# source .venv/bin/activate  # On Linux/Mac

# Install ADK agent dependencies
pip install -r requirements.txt

4. Start the System

Terminal 1 - Start MCP Server:

cd pega-mcp
.venv\Scripts\activate  # On Windows
# source .venv/bin/activate  # On Linux/Mac
python server.py

Terminal 2 - Start ADK Agent:

cd pega-adk
.venv\Scripts\activate  # On Windows
# source .venv/bin/activate  # On Linux/Mac
adk run pega_adk_agent

Or to start with web interface:

cd pega-adk
.venv\Scripts\activate  # On Windows
# source .venv/bin/activate  # On Linux/Mac
adk web

Configuration

Required Pega Credentials

You'll need these from your Pega Platform:

  • Pega Platform URL - Your Pega instance URL
  • OAuth Client ID - OAuth2 client identifier
  • OAuth Client Secret - OAuth2 client secret
  • Application Alias - Your Pega application alias

Environment Files

Copy the template files and edit with your credentials:

pega-mcp/.env - MCP Server Configuration:

PEGA_BASE_URL=https://your-pega-instance.com
PEGA_CLIENT_ID=your_client_id
PEGA_CLIENT_SECRET=your_client_secret
APP_ALIAS=your_app_alias

pega-adk/.env - ADK Agent Configuration:

MCP_SERVER_URL=http://localhost:8080/mcp/
AI_MODEL=gemini-2.0-flash
AGENT_NAME=pega_adk_agent

Usage

MCP Server Features

The MCP server provides these tools:

  • Verify Connectivity - Test connection to Pega Platform
  • Get Case Types - List available case types
  • Create Case - Create new cases with specified case type

ADK Agent Features

The ADK agent can:

  • Connect to Pega Platform via MCP tools
  • List available case types
  • Create new cases
  • Provide natural language responses about case management

Example Interactions

User: "List available case types"
Agent: "Found 3 case types:
  1. Home Loan Application (ID: H-28021)
  2. Credit Card Application (ID: C-15045)
  3. Personal Loan Request (ID: P-89012)"

User: "Create a home loan case"
Agent: "Case created successfully with ID: LOAN-2024-001"

Project Structure

pega/
ā”œā”€ā”€ README.md               # This file
ā”œā”€ā”€ pega-mcp/              # MCP Server
│   ā”œā”€ā”€ server.py          # MCP server implementation
│   ā”œā”€ā”€ tools.py           # Pega API tools
│   ā”œā”€ā”€ resources.py       # MCP resources
│   ā”œā”€ā”€ requirements.txt   # MCP dependencies
│   ā”œā”€ā”€ env.template      # Environment template
│   └── dx-apis/          # API documentation
└── pega-adk/             # ADK Agent
    ā”œā”€ā”€ pega_adk_agent/
    │   └── agent.py      # ADK agent implementation
    ā”œā”€ā”€ requirements.txt   # ADK dependencies
    └── env.template      # Environment template

Troubleshooting

Common Issues

  1. "Missing configuration" error

    • Copy env.template to .env in both directories
    • Edit .env files with your actual credentials
    • Ensure all required Pega credentials are provided
  2. Connection failed

    • Verify your Pega Platform URL is correct
    • Check OAuth credentials are valid
    • Ensure network connectivity to Pega instance
  3. MCP server won't start

    • Check port 8080 is available
    • Verify virtual environment is activated
    • Verify all dependencies are installed
    • Check .env file exists in pega-mcp/ directory
  4. ADK agent can't connect

    • Ensure MCP server is running on localhost:8080
    • Check MCP server URL in pega-adk/.env
    • Verify virtual environment is activated
    • Verify ADK dependencies are installed
    • Use adk run pega_adk_agent or adk web to start the agent

Security Notes

  • .env files are excluded from Git (see .gitignore)
  • Never commit real credentials to version control
  • Keep your OAuth credentials secure
  • The setup script masks secret input for security

Development

Adding New Tools

To add new Pega API tools:

  1. Add function to pega-mcp/tools.py
  2. Register tool in pega-mcp/server.py
  3. Update agent instructions in pega-adk/pega_adk_agent/agent.py

Customizing the Agent

Edit pega-adk/pega_adk_agent/agent.py to:

  • Change AI model
  • Modify agent instructions
  • Add custom tools
  • Update agent behavior

ADK Commands

  • adk run pega_adk_agent - Start agent in terminal mode
  • adk web - Start agent with web interface
  • adk --help - Show all available commands

License

This project is for educational and development purposes. Ensure compliance with your organization's policies when using with production Pega systems.