New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@agentbadge/keeperhub

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentbadge/keeperhub

KeeperHub MCP client, workflow templates, and tools for AgentBadge onchain trust integration

npmnpm
Version
0.1.0
Version published
Weekly downloads
75
-18.48%
Maintainers
1
Weekly downloads
 
Created
Source

@agentbadge/keeperhub

KeeperHub MCP client, workflow templates, and MCP tools for AgentBadge onchain trust integration on Base Sepolia.

Overview

@agentbadge/keeperhub is the SDK that connects AgentBadge to KeeperHub — a workflow automation platform that executes onchain transactions via MCP (Model Context Protocol).

The package provides three layers:

  • Client — typed MCP client for KeeperHub's workflow API (connect, executeWorkflow, pollExecution, listWorkflows)
  • Workflow Templates — pre-built workflow specs for recordScan, mintPassport, and notify
  • MCP Tools — 4 tool definitions (keeperhub-record-scan, keeperhub-mint-trust-badge, keeperhub-workflow-status, keeperhub-audit) that register into any MCP server

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                        AgentBadge Server                             │
│                                                                     │
│  ┌──────────┐   ┌──────────────┐   ┌─────────────┐   ┌───────────┐  │
│  │  Hono    │   │ KeeperHub   │   │ AuditStore  │   │  SSE      │  │
│  │  Routes   │──▶│ Trigger     │──▶│ (in-memory) │──▶│  Stream   │  │
│  │          │   │ (MCP/webhook)│   │             │   │           │  │
│  └──────────┘   └──────┬───────┘   └─────────────┘   └───────────┘  │
│                        │                                            │
│                        ▼                                            │
│              ┌─────────────────┐                                    │
│              │ KeeperHubClient │  ◀── @agentbadge/keeperhub          │
│              │  (this package) │                                    │
│              └────────┬────────┘                                    │
└───────────────────────┼─────────────────────────────────────────────┘
                        │ MCP (Streamable HTTP)
                        ▼
              ┌─────────────────┐
              │  KeeperHub MCP  │
              │  app.keeperhub  │
              │  .com/mcp       │
              └────────┬────────┘
                       │ executes workflow
                       ▼
              ┌─────────────────┐
              │  Base Sepolia   │
              │  Chain ID 84532 │
              │                 │
              │  TrustRegistry  │──▶ recordScan(siteUrl, score, ...)
              │  TrustBadge     │──▶ mint(to, siteUrl, score, uri)
              │  AgentPassport  │──▶ mint(to, uri, tier)
              └─────────────────┘

Installation

npm install @agentbadge/keeperhub
# or
bun add @agentbadge/keeperhub

Quick Start

1. Connect to KeeperHub MCP

import { KeeperHubClient } from "@agentbadge/keeperhub";

const client = new KeeperHubClient({
  serverUrl: "https://app.keeperhub.com/mcp",
  apiKey: process.env.KEEPERHUB_API_KEY!,
});

await client.connect();
const workflows = await client.listWorkflows();

2. Provision Workflows

import { buildAllWorkflows } from "@agentbadge/keeperhub";

const specs = buildAllWorkflows({
  network: "84532",                    // Base Sepolia
  trustRegistryAddress: "0x...",
  trustBadgeAddress: "0x...",
  passportNftAddress: "0x...",
  auditCallbackUrl: "https://agentbadge.xyz/api/keeperhub/audit/webhook",
  auditCallbackSecret: process.env.KEEPERHUB_AUDIT_SECRET!,
  notifyUrl: "https://discord.com/api/webhooks/...",
  notifySecret: process.env.NOTIFY_SECRET,
});

for (const spec of specs) {
  const { workflowId } = await client.createWorkflow(spec);
  console.log(`Created: ${spec.name} → ${workflowId}`);
}

3. Execute a Workflow (record scan onchain)

const { executionId } = await client.executeWorkflow(workflowId, {
  siteUrl: "https://example.com",
  score: 92,
  rulesPassed: 139,
  rulesTotal: 151,
});

// Poll until terminal
const result = await client.pollExecution(executionId);
console.log("Status:", result.status);
console.log("Tx hashes:", client.txHashes(result));

4. Register MCP Tools

import { allKeeperhubTools } from "@agentbadge/keeperhub";

const ctx = {
  client: connectedClient,
  apiBaseUrl: "https://agentbadge.xyz",
  workflowIds: { recordScan: "wf_...", mintPassport: "wf_..." },
};

for (const tool of allKeeperhubTools) {
  const handler = tool.createHandler(ctx);
  server.registerTool(tool.name, tool.description, tool.inputSchema, handler);
}

API Reference

KeeperHubClient

MethodDescriptionReturns
connect()Establish MCP sessionPromise<void>
ping()Test connectivity via list_workflowsPromise<boolean>
listWorkflows()List all workflowsPromise<unknown[]>
createWorkflow(spec, opts?)Create a new workflowPromise<{ workflowId }>
executeWorkflow(workflowId, inputs?, opts?)Execute a workflowPromise<{ executionId }>
getExecution(executionId)Get execution statusPromise<ExecutionResult>
pollExecution(executionId, opts?)Poll until terminal statePromise<ExecutionResult>
txHashes(exec)Extract tx hashes from executionstring[]
listActionSchemas(category?)List available action schemasPromise<unknown>
getWalletIntegration()Get wallet integration infoPromise<unknown>
listWorkflow(workflowId, metadata)List on marketplacePromise<unknown>
getWorkflowListing(slug)Get marketplace listingPromise<unknown>

Workflow Templates

buildRecordScanWorkflow(opts) — agentbadge-record-scan

Records a site scan result onchain via TrustRegistry.recordScan(siteUrl, score, rulesPassed, rulesTotal).

Trigger (Webhook) ──▶ write-contract (TrustRegistry.recordScan) ──▶ webhook (audit callback)

buildMintPassportWorkflow(opts) — agentbadge-mint-passport

Mints an AgentPassport NFT + TrustBadge (soulbound) onchain, then sends audit callback.

Trigger (Webhook) ──▶ write-contract (AgentPassportNFT.mint) ──▶ write-contract (TrustBadge.mint) ──▶ webhook (audit callback)

buildNotifyWorkflow(opts) — agentbadge-notify

Sends a notification (Discord/Slack/external) on scan events.

Trigger (Webhook) ──▶ webhook (send notification)

MCP Tools

ToolRead-onlyDescription
keeperhub-record-scanNoDry-run preview or trigger onchain record-scan workflow
keeperhub-mint-trust-badgeNoDry-run preview or trigger onchain mint (passport + badge) workflow
keeperhub-workflow-statusYesRead execution status by ID — returns state, tx hashes, errors
keeperhub-auditYesFetch onchain audit records from AgentBadge API

Validation

import { validateWorkflowSpec } from "@agentbadge/keeperhub";

const errors = validateWorkflowSpec(spec);
if (errors.length) throw new Error(`Invalid workflow: ${errors.map(e => e.message).join(", ")}`);

Checks: unique node IDs, exactly one trigger, edge references, required config fields, ABI format.

Flow Diagrams

Dry-Run Scan Flow

┌────────┐     POST /scan      ┌─────────┐    scanDomain()    ┌──────────┐
│ Browser│─────────────────────▶│  Hono   │──────────────────▶│  Scanner │
│        │  {url, confirm:false}│  Route  │                   │ (fetch + │
│        │                      │         │◀──────────────────│  rules)  │
│        │◀─────────────────────│         │   score, grade    └──────────┘
│        │  {mode:"dry-run",    │         │
│        │   scan, wouldExecute}│         │
└────────┘                      └─────────┘

Confirm → Onchain Record Flow

┌────────┐  POST /scan        ┌─────────┐  executeWorkflow()  ┌────────────┐
│ Browser│──{url,confirm:true}▶│  Hono   │───────────────────▶│ KeeperHub  │
│        │                     │  Route  │                    │ MCP Client │
│        │                     │         │  pollExecution()   │            │
│        │                     │         │◀──────────────────│            │
│        │                     │         │  ExecutionResult  └─────┬──────┘
│        │                     │         │                        │ MCP
│        │                     │         │                        ▼
│        │                     │         │                 ┌──────────────┐
│        │                     │  audit  │                 │ KeeperHub    │
│        │                     │  Store  │◀──webhook──────│ Server        │
│        │                     │  .add() │                 │ (executes    │
│        │                     │         │                 │  onchain tx) │
│        │◀─────────────────────│         │                 └──────┬───────┘
│        │ {mode:"executed",   │         │                        │
│        │  txHashes, execId}  │         │                        ▼
│        │                     └─────────┘                 ┌──────────────┐
│        │                                                 │ Base Sepolia │
│        │                                                 │ TrustRegistry│
│        │                          SSE audit event         │              │
│        │◀─────────────────────────────────────────────────│              │
│        │                                                 └──────────────┘
└────────┘

SSE Live Audit Trail

┌────────────┐    GET /audit/stream    ┌───────────────┐
│  Browser   │────────────────────────▶│  Hono Route   │
│  EventSource│                        │               │
│            │◀────event:snapshot──────│  send initial │
│            │◀────event:audit─────────│  then live     │
│            │     (on new event)      │  events        │
└────────────┘                         └───────┬───────┘
                                               │
                                       ┌───────▼───────┐
                                       │  AuditStore   │
                                       │  (EventEmitter)│
                                       │               │
                                       │  .add() ──▶ emit('event') ──▶ SSE push
                                       └───────────────┘

Webhook Receiver Flow

┌──────────────┐  POST /audit/webhook     ┌───────────────┐
│ KeeperHub    │──{Authorization:Bearer}─▶│  Hono Route   │
│ Server       │  {source, siteUrl,       │               │
│ (audit-cb    │   score, executionId}    │  validate     │
│  node)       │                          │  secret       │
└──────────────┘                          │       │       │
                                          │       ▼       │
                                          │  AuditStore   │
                                          │  .add()       │
                                          │  → emit SSE   │
                                          └───────────────┘

Environment Variables

VariableRequiredDefaultDescription
KEEPERHUB_ENABLEDNofalseFeature flag
KEEPERHUB_API_KEYYes—Org API key from KeeperHub dashboard
KEEPERHUB_SERVER_URLNohttps://app.keeperhub.com/mcpMCP endpoint
KEEPERHUB_WEBHOOK_KEYYes—Must start with wfb_
KEEPERHUB_AUDIT_SECRETYes—Bearer secret for webhook auth
KEEPERHUB_WORKFLOW_RECORD_SCANYes—Provisioned workflow ID
KEEPERHUB_WORKFLOW_MINT_PASSPORTYes—Provisioned workflow ID
KEEPERHUB_WORKFLOW_NOTIFYNo—Provisioned workflow ID
KEEPERHUB_TRIGGER_MODENomcpmcp or webhook
KEEPERHUB_X402_ENABLEDNofalseEnable x402 premium scans

Smart Contracts (Base Sepolia)

ContractPurposeKey Function
TrustRegistryRecords scan results onchainrecordScan(siteUrl, score, rulesPassed, rulesTotal)
TrustBadgeSoulbound badge for verified sitesmint(to, siteUrl, score, uri)
AgentPassportNFTAgent identity NFTmint(to, uri, tier)

License

MIT

Keywords

keeperhub

FAQs

Package last updated on 10 Sep 2026

Related posts