pega-mcp-server
Generic TypeScript MCP server for Pega case operations with definition-driven tool registration.
Purpose
This project provides an MCP tool layer for reading and mutating cases in a flexible way. Tool wiring is metadata-based, so adding tools does not require editing server registration logic.
Supported MCP Tools
pega.get_cases- Input: optional
limit - Returns:
{ ok: true, data: { cases: [...] } }
- Input: optional
pega.get_case- Input:
caseId, optionalviewType,pageName,originChannel - Returns:
{ ok: true, data: { case: ... } }
- Input:
pega.get_case_actions- Input:
caseId, optionaloriginChannel - Returns:
{ ok: true, data: { actions: ... } }
- Input:
pega.get_case_views- Input:
caseId,viewId, optionaloriginChannel - Returns:
{ ok: true, data: { view: ... } }
- Input:
pega.attach_document_to_case- Input:
caseId,fileName,mimeType,fileContentBase64 - Returns:
{ ok: true, data: ... }
- Input:
pega.submit_case_action- Input:
caseId,action, optionalcontent - Returns:
{ ok: true, data: ... }
- Input:
All tools return a standard failure format:
{
"ok": false,
"error": {
"code": "INVALID_INPUT | NOT_FOUND_OR_FORBIDDEN | INTERNAL_ERROR",
"message": "Human-readable explanation",
"suggestion": "Optional recovery guidance"
}
}
Environment Variables
Required:
PEGA_BASE_URL(for examplehttps://your-pega-instance.example.com/prweb)PEGA_CLIENT_IDPEGA_CLIENT_SECRETPEGA_TOKEN_URL(for examplehttps://your-pega-instance.example.com/prweb/PRRestService/oauth2/v1/token)
Optional:
PEGA_CASES_API_BASE_PATH(default:/api/v1)- Common v2 path when base URL includes
/prweb:/api/application/v2 - Some deployments use app context:
/PRAuth/app/work-manager/api/application/v2
- Common v2 path when base URL includes
PEGA_CASES_LIST_DATA_VIEW(default:D_pyMyWorkList)- Used as a fallback for
pega.get_caseswhenGET /casesis not supported (HTTP 405) - Endpoint shape:
POST <PEGA_CASES_API_BASE_PATH>/data_views/<dataViewId>
- Used as a fallback for
PEGA_ENABLED_TOOLScomma-separated tool names to allowlist- Example:
pega.get_case,pega.get_case_actions
- Example:
PEGA_DISABLED_TOOLScomma-separated tool names to blocklist- Example:
pega.submit_case_action,pega.attach_document_to_case
- Example:
Run Locally
npm install
cp .env.example .env
npm run dev
Build
npm run build
npm start
Test
npm test
Example Outputs
pega.get_cases
{
"ok": true,
"data": {
"cases": [
{
"ID": "C-501",
"caseType": "Insurance Claim",
"status": "Pending Documents"
}
]
}
}
pega.get_case
{
"ok": true,
"data": {
"case": {
"ID": "C-501",
"caseType": "Insurance Claim",
"status": "Pending Documents",
"uiResources": {
"root": {
"type": "page"
}
}
}
}
}
Detailed request/response contracts: