MACP

MACP Example Showcase Service

Scenario catalog, compiler, and agent hosting service

File-backed example showcase service for Multi-Agent Coordination Protocol demos, combining scenario catalog, compilation, and example-agent bootstrap in a single service.

This service is a showcase/examples layer used to demonstrate scenarios and sample agents for MACP. It intentionally combines catalog, compilation, and sample agent hosting for simplicity. It is not the production system boundary.

Quick Start

npm install
npm run start:dev

The server starts on http://localhost:3000. Swagger docs are available at /docs in development mode.

Try it

# List packs
curl http://localhost:3000/packs

# List scenarios in a pack
curl http://localhost:3000/packs/fraud/scenarios

# Get launch schema with agent previews
curl http://localhost:3000/packs/fraud/scenarios/high-value-new-device/versions/1.0.0/launch-schema

# Compile an execution request
curl -X POST http://localhost:3000/launch/compile \
  -H 'Content-Type: application/json' \
  -d '{
    "scenarioRef": "fraud/high-value-new-device@1.0.0",
    "templateId": "default",
    "mode": "sandbox",
    "inputs": {
      "transactionAmount": 3200,
      "deviceTrustScore": 0.12,
      "accountAgeDays": 5,
      "isVipCustomer": true,
      "priorChargebacks": 1
    }
  }'

# Run a full example (compile + bootstrap agents, skip control plane)
curl -X POST http://localhost:3000/examples/run \
  -H 'Content-Type: application/json' \
  -d '{
    "scenarioRef": "fraud/high-value-new-device@1.0.0",
    "templateId": "strict-risk",
    "submitToControlPlane": false,
    "inputs": {
      "transactionAmount": 3200,
      "deviceTrustScore": 0.12,
      "accountAgeDays": 5,
      "isVipCustomer": true,
      "priorChargebacks": 1
    }
  }'

API Endpoints

MethodPathDescription
GET/healthzLiveness probe
GET/packsList all available scenario packs
GET/packs/:packSlug/scenariosList scenarios with versions, templates, and agent refs
GET/packs/:packSlug/scenarios/:scenarioSlug/versions/:version/launch-schemaGet form schema, defaults, and agent previews
POST/launch/compileValidate and compile inputs into an ExecutionRequest
POST/examples/runCompile + bootstrap agents + optionally submit to control plane
GET/docsSwagger UI (development only)

See docs/api-reference.md for full request/response details.

Architecture

The service combines three concerns for demo simplicity:

  • Catalog — browse packs and scenarios from YAML files on disk
  • Compiler — validate inputs (AJV JSON Schema) and compile ExecutionRequest payloads with {{ inputs.* }} template substitution
  • Hosting — resolve example agents (fraud, growth, risk) and inject transport identities

See docs/architecture.md for the full module structure and data flow.

Example Agents

Four demo agents are included:

AgentFrameworkRole
Fraud AgentLangGraphEvaluates device, chargeback, and identity-risk signals
Growth AgentLangChainAssesses customer value and revenue impact
Compliance AgentCrewAIApplies KYC/AML policy checks
Risk AgentCustomCoordinates the final recommendation

All agents use an active process-backed hosting strategy. Python and Node.js worker processes are spawned after the control plane creates a run, poll for events, and send MACP messages back through the control plane. Transport identities and entrypoints are resolved and injected into the ExecutionRequest before submission.

Creating Scenario Packs

See docs/scenario-authoring.md for the full authoring guide.

packs/{pack-slug}/
  pack.yaml
  scenarios/{scenario-slug}/{version}/
    scenario.yaml
    templates/
      default.yaml
      *.yaml

Configuration

VariableDefaultDescription
PORT3000HTTP port
PACKS_DIR./packsPath to pack YAML files
REGISTRY_CACHE_TTL_MS0Cache TTL (0 = reload every request)
CONTROL_PLANE_BASE_URLhttp://localhost:3001Control plane endpoint
CONTROL_PLANE_API_KEY(empty)Bearer token for control plane
AUTO_BOOTSTRAP_EXAMPLE_AGENTStrueAuto-bootstrap agents on /examples/run
NODE_ENVdevelopmentSet to enable Swagger at /docs
CORS_ORIGINhttp://localhost:3000Comma-separated origins (supports * wildcards)
AUTH_API_KEYS(empty)Comma-separated API keys for X-Api-Key auth (empty = disabled)

Deployment

This backend is designed to run alongside a Vercel-hosted frontend.

┌─────────────┐         ┌──────────────────────┐
│  Vercel      │  HTTPS  │  Railway / Render     │
│  (UI)        │────────▶│  (examples-service)   │
└─────────────┘         └──────────────────────┘

Deploy to Railway

Deploy on Railway

  1. Connect your GitHub repo
  2. Railway auto-detects the Dockerfile
  3. Set environment variables:
NODE_ENV=production
CORS_ORIGIN=https://your-app.vercel.app,https://your-app-*.vercel.app
AUTH_API_KEYS=<generate-a-secret-key>
REGISTRY_CACHE_TTL_MS=60000

Deploy to Render

  1. Create a new Web Service from your GitHub repo
  2. Set Build Command to docker (auto-detects Dockerfile)
  3. Set the same environment variables as above

Frontend (Vercel) setup

Set one env var in your Vercel project:

NEXT_PUBLIC_API_URL=https://your-backend.railway.app

CORS for Vercel preview URLs

Vercel generates unique URLs per PR (e.g. myapp-git-branch-name.vercel.app). Use wildcards:

CORS_ORIGIN=https://your-app.vercel.app,https://your-app-*.vercel.app

Development

npm run build          # Compile TypeScript
npm run start:dev      # Dev mode with auto-reload
npm test               # Unit tests
npm run test:e2e       # E2E tests
npm run test:cov       # Coverage report
npm run lint           # ESLint
npm run format         # Prettier

Docker

docker compose up                                                      # Production
docker compose -f docker-compose.yml -f docker-compose.dev.yml up      # Development

License

Apache-2.0