Install
$ agentstack add mcp-winsznx-pact ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
PACT: Provable Agent to Agent Compute Trust
> Settlement protocol for verifiable AI as a Service on 0G mainnet. > Buyers pay sellers per inference. TEE attestation guarantees model and execution. > Reputation accrues to the seller's ERC-7857 INFT. Sell the agent, sell the reputation.
[](https://www.npmjs.com/package/@trypact/sdk) [](https://www.npmjs.com/package/@trypact/mcp-server) [](https://chainscan.0g.ai/address/0xB2b762Df53294923d3eaD00d8118AD37388dD4aA) [](./LICENSE)
Watch the 5-minute demo on YouTube ↗
Status
LIVE on 0G mainnet (chainId 16661). 7 contracts deployed. Bond staked. First end to end settled job: 0xbb36752d…7df48 on 2026-05-15. Job #2, buyer escrowed 0.001 $0G, seller submitted a TEE attested ECDSA signature, contract verified on chain, atomic settlement (95% seller, 5% protocol fee).
| Contract | Address | Explorer | |---|---|---| | PactRegistry | 0x152A5a433A6592df57d7F77B7B01eEE00C481C2d | chainscan ↗ | | PactEscrow | 0xB2b762Df53294923d3eaD00d8118AD37388dD4aA | chainscan ↗ | | AttestationVerifier | 0x765C857B6764c90B0093Ea16f6103902665D0aa2 | chainscan ↗ | | ReputationVault | 0x1574E42D7fF268384408430D5b76C88f37b8a72B | chainscan ↗ | | SlashingArbiter | 0x324E5b2183134EB239C7E934438831a15abe7C00 | chainscan ↗ | | AgentNFT (proxy) | 0xe76dBE7FCf8c7F784b05DF88996bd63CA2c4d7D6 | chainscan ↗ | | AgentNFT (impl) | 0x4EC0DCac00A274Fb69F54cAb62370b2c71989CE4 | chainscan ↗ |
Demo: . Vercel + Singapore edge region (sin1) for lowest latency to 0G mainnet RPC. Local: . Explorer: . Same site, alternate entry point. Indexer API: . REST cache of every settled job, service, seller. Try /v1/services, /v1/jobs, /healthz. Docs: . Full GitBook with concepts, guides, and reference. Source at [gitbook/](gitbook/). Demo video: . 5 minutes, beat-by-beat walkthrough on 0G mainnet. Script at [docs/DEMOSCRIPT.md](docs/DEMOSCRIPT.md). Deploy guide: [docs/DEPLOY.md](docs/DEPLOY.md). Reproducible Vercel + custom domain + WC Cloud setup. SDK: @trypact/sdk on npm. pnpm add @trypact/sdk viem. MCP server: drop a URL (https://mcp.trypact.xyz/mcp) or the npm package (@trypact/mcp-server) into ~/.claude/mcp.json. Your AI agent gains tools to browse the registry, verify TEE attestations, and pay other AI agents on chain. [Install guide](packages/mcp-server/README.md).
What you can do, by intent
| I want to | Go here | |---|---| | Try a real settled job in my browser | , pick a service, click "Run an inference" | | Verify a settled attestation cryptographically | . Local ECDSA recovery, no server trust. | | See live state machine plus on chain txs for a job | | | Browse the explorer (services plus jobs feed) | | | Integrate as a buyer in 25 lines of TS | [SDK quickstart ↓](#integrate-in-25-lines-sdk). pnpm add @trypact/sdk viem | | Plug PACT into Claude or Cursor as MCP tools | [MCP quickstart ↓](#plug-into-claude-or-cursor-mcp). Paste one URL into your agent config. | | Register an agent as a seller and start earning | [Become a seller ↓](#become-a-seller) | | Query the on chain registry without an SDK | [Indexer API ↓](#query-the-indexer-api). REST, no auth, CORS open. | | Call the contracts directly (cast / ethers / web3) | [Contracts cheat sheet ↓](#contracts-cheat-sheet) | | Understand the moat (TEE plus ECDSA recovery) | [How verification works ↓](#how-verification-works) | | Reproduce the end to end loop locally | [Run it yourself ↓](#run-it-yourself) | | Read the full docs | docs.trypact.xyz. Concepts, guides, reference. |
What it is, in one sentence
PACT is the settlement layer for AI as a Service on 0G. Buyers pay sellers for inference work, with cryptographic guarantee that the work was done by the exact agent INFT they paid for, by the registered TEE broker provider, on the model the seller committed to. Payment auto releases on attestation. Reputation accrues to the INFT.
Integrate in 25 lines (SDK)
import { PactClient } from "@trypact/sdk";
import { createPublicClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const chain = {
id: 16661, name: "0G Mainnet",
nativeCurrency: { name: "OG", symbol: "OG", decimals: 18 },
rpcUrls: { default: { http: ["https://evmrpc.0g.ai"] } },
} as const;
const account = privateKeyToAccount(process.env.BUYER_KEY as `0x${string}`);
const pact = new PactClient({
publicClient: createPublicClient({ chain, transport: http() }),
walletClient: createWalletClient({ account, chain, transport: http() }),
});
// Escrow funds, watch through settlement, verify the TEE attestation locally.
const result = await pact.run({
serviceId: 1n,
prompt: "Audit this Solidity contract for reentrancy vulnerabilities",
});
console.log(result.verified.ok); // true on authentic attestation
console.log(result.verified.recoveredSigner); // matches service.signingAddress
console.log(result.txHashes.createJob); // chainscan it
Full SDK docs: [packages/sdk/README.md](packages/sdk/README.md). npmjs.com/package/@trypact/sdk.
Plug into Claude or Cursor (MCP)
PACT ships a Model Context Protocol server. Any MCP compatible AI agent (Claude Desktop, Cursor, Cline, Continue, Windsurf, etc.) gains tools to browse the on chain registry, verify TEE attestations, and pay other AI agents per inference, autonomously, with no human approval per call.
Two ways to attach.
Hosted (URL, zero install). Read only.
For browsing the registry and verifying attestations from any agent. No npm install, no local process, no key. Drop into your MCP config:
{
"mcpServers": {
"trypact": {
"url": "https://mcp.trypact.xyz/mcp"
}
}
}
Exposes the 4 read tools: list_services, get_service, get_job, verify_attestation. Hits 0G mainnet directly. Stateless. Every request is independent, no session, concurrency safe by construction.
Local (npm plus private key). Full, includes run.
For paying agents. Install the npm package so your key never leaves your machine:
{
"mcpServers": {
"trypact": {
"command": "npx",
"args": ["-y", "@trypact/mcp-server"],
"env": {
"PACT_PRIVATE_KEY": "0x"
}
}
}
}
Restart the agent. The five tools appear under the trypact namespace:
| Tool | Effect | |---|---| | pact.list_services | Browse the on chain registry | | pact.get_service | Fetch one service's pricing plus signing address | | pact.get_job | Inspect any historical job | | pact.verify_attestation | Local ECDSA recovery on a settled job (pure crypto, no RPC) | | pact.run | Pay a service for one inference, watch through settlement, verify the TEE signature, return the output |
Now the conversation goes:
> You: "Find me a Solidity audit agent on PACT and audit this contract." > Claude: (calls pact.list_services) "Service #1 is zai-org/GLM-5-FP8, 0.001 $0G per call. Want me to use it?" > You: "Yes." > Claude: (calls pact.run) "Paid 0.001 $0G, job #5 settled in 42s. Recovered signer 0x4C1b…7ee8 matches the registered TEE key. Attestation verified. Here's the audit: …"
This is agent to agent settlement with cryptographic proof. The agentic economy primitive.
Full MCP docs: [packages/mcp-server/README.md](packages/mcp-server/README.md). npmjs.com/package/@trypact/mcp-server.
Become a seller
Sellers register an agent service, stake a bond against fraud, and earn 95% of every settled call (the other 5% is a protocol fee).
1. Mint an Agent INFT (ERC-7857). Your seller identity plus reputation accumulator. Transferable: sell the agent, sell the reputation.
AgentNFT.mint(to=sellerAddress, metadataURI="ipfs://…") // → inftTokenId
2. Register the service on PactRegistry:
PactRegistry.registerService(
bytes32 capabilityHash, // hash of the capability spec
string modelId, // e.g. "zai-org/GLM-5-FP8"
address providerAddress, // 0G Compute provider you delegate to
address signingAddress, // TEE bound key that signs attestations
string providerIdentity, // e.g. "openrouter"
string providerType, // "centralized" | "decentralized" | "self"
bool targetSeparated, // true = provider ≠ seller (delegated TEE)
uint128 pricePerCall, // wei of $0G
uint64 maxInputBytes, // input cap (e.g. 8192)
bytes inftMetadataURI // bound to your AgentNFT tokenId
);
3. Stake the bond on SlashingArbiter (minimum 5 $0G). Bond stays bonded for the life of the service. It slashes on cryptographic fraud and is reclaimable via requestWithdrawal then withdrawBond after the dispute window.
SlashingArbiter.stakeBond{value: 5 ether}(serviceId);
4. Run the seller agent (or write your own. The protocol doesn't care). Reference implementation watches JobCreated, calls 0G Compute Direct broker, submits the TEE attestation:
# Reference seller agent (apps/seller-reference/)
cp apps/seller-reference/.env.example apps/seller-reference/.env
# set PACT_PRIVATE_KEY, PACT_SERVICE_ID, ZG_PROVIDER_ADDRESS
pnpm --filter @pact/seller-reference setup # one time bond stake
pnpm --filter @pact/seller-reference run # long running watcher
The reference agent uses @0gfoundation/0g-compute-ts-sdk for the TEE inference call and viem.recoverMessageAddress as a local sanity check before submitting the attestation on chain. Full source: [apps/seller-reference/src/](apps/seller-reference/src/).
Query the indexer API
Public, no auth, CORS open. Hosted at . Built on top of @trypact/sdk so the contract layer remains the single source of truth. The indexer is just a fast read cache.
| Endpoint | Returns | |---|---| | GET /healthz | Uptime, last indexed block, in memory counters | | GET /v1/services | Full service catalog (every registered seller) | | GET /v1/services/:id | One service by id | | GET /v1/jobs?limit=N | Recent jobs across all services, newest first | | GET /v1/jobs/:id | One job's full state plus attestation bytes | | GET /v1/sellers/:address | Every service plus job for one seller address | | GET /v1/stats | Aggregate counters (settled, expired, slashed, total $0G settled) |
The indexer is a Railway hosted Express process. Source at [apps/indexer/](apps/indexer/). Polls JobCreated plus 5 state change events. Falls back to on chain reads if a block range is missed.
Run it yourself
Reproduces the e2e flow against live 0G mainnet. Needs about 6 $0G in a burner wallet (5 for bond plus about 1 for gas and a few test jobs).
# Clone + install
git clone https://github.com/winsznx/pact.git
cd pact
pnpm install
# Configure env
cp apps/seller-reference/.env.example apps/seller-reference/.env
# Edit: set PACT_PRIVATE_KEY to a burner with ≥6 $0G on 0G mainnet.
# Same key is used for both seller (in this hackathon scope) and the
# e2e buyer test. Net cost per loop is about 0.003 $0G of gas.
# Test the contracts (Foundry suite, 56/56 passing)
pnpm --filter @pact/contracts test
# Run the frontend locally (or skip; production is live at trypact.xyz)
pnpm --filter @pact/web dev
# → http://localhost:3001/marketplace/1. Click "Run an inference".
# Or run the protocol end to end from CLI:
pnpm --filter @pact/seller-reference setup # stakes 5 $0G bond (idempotent)
pnpm --filter @pact/seller-reference run run & # start the seller watcher
pnpm --filter @pact/seller-reference test-e2e # buyer test, returns when Settled
# or:
./apps/seller-reference/scripts/e2e.sh # the orchestrated pipeline
Expect the full loop (createJob → inference → submitAttestation → Settled) to land in about 60 seconds on 0G mainnet.
Architecture
┌────────────────────────────────────────────────┐
│ 0G MAINNET (chainId 16661) │
│ │
│ ┌─────────────────┐ ┌──────────────────┐ │
Buyer ──pay──▶ │ │ PactEscrow │◄───┤ AttestationVerif │ │
│ │ (escrow + jobs)│ │ (EIP-191 + ECDSA)│ │
│ └────────┬────────┘ └──────────────────┘ │
│ │ atomic settle (95 / 5) │
│ ▼ │
│ ┌─────────────────┐ ┌──────────────────┐ │
│ │ PactRegistry │ │ SlashingArbiter │ │
│ │ (Service + INFT)│ │ (bond + dispute) │ │
│ └────────┬────────┘ └────────┬─────────┘ │
│ │ │ │
│ ▼ │ │
│ ┌─────────────────┐ │ │
│ │ ReputationVault │◄───────────┘ │
│ │ (sqrt-weighted, │ slash on fraud → │
│ │ INFT-bound) │ bond redistributed │
│ └─────────────────┘ │
│ ▲ │
│ │ tokenURI / ownerOf │
│ ┌─────────────────┐ │
│ │ AgentNFT │ │
│ │ (ERC-7857) │ │
│ └─────────────────┘ │
└────────────────────────────────────────────────┘
▲
JobCreated │ submitAttestation
│
┌─────────────────────────────┴───────────────────────────┐
│ Seller reference agent (Node.js) │
│ │
│ poll PactEscrow.nextJobId every 3s │
│ │ │
│ ▼ │
│ ┌──────────────────────────────┐ ┌───────────────┐ │
│ │ @0gfoundation/0g-compute-sdk │───►│ 0G Compute │ │
│ │ - acknowledgeP
…
## Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [winsznx](https://github.com/winsznx)
- **Source:** [winsznx/pact](https://github.com/winsznx/pact)
- **License:** Apache-2.0
- **Homepage:** https://trypact.xyz
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.