Skip to main content
Glama

Agent Receipts

ログは「何かが起きた」ことを伝えます。レシートはそれを「証明」します。

Live Demo agent-receipts MCP server npm version License: MIT macOS Windows Linux

{
  "mcpServers": {
    "agent-receipts": {
      "command": "npx",
      "args": ["@agent-receipts/mcp-server"]
    }
  }
}

実世界での例

私は自動車整備工場向けのマルチテナントSaaS「ModQuote」を構築しました。開発中、コードベースの監査と修正のためにClaude Codeを多用しました。

問題は、何かがうまくいかなかったときに、Claudeがどのような入力を受け取り、何を修正し、出力が期待通りだったかどうかを証明する手段がなかったことです。

Agent Receiptsを使用すると、すべてのClaude Codeセッションで署名付きレシートが生成されるようになります:

  • 入力ハッシュ:Claudeがどのコードを見たかを正確に証明

  • 出力ハッシュ:Claudeが何を生成したかを正確に証明

  • 制約:レイテンシの急増や予算超過を検知

  • チェーン:多段階の監査セッションの全シーケンスを表示

修正が期待通りに機能しなかった場合、レシートを取得して署名を検証し、正確な入出力ハッシュを確認できます。推測や「Claudeが誤解したに違いない」といった曖昧な状況はなくなります。

それがログとレシートの違いです。ログは「何かが起きた」ことを伝え、レシートはそれを「証明」します。

クイックスタート:MCPサーバー

AIツールの設定にAgent Receipts MCPサーバーを追加すると、すべてのアクションに対して自動的に暗号学的レシートが発行されます。

プラットフォームサポート: macOS, Windows, Linux — Node.js 18以上が必要

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json に追加してください:

{
  "mcpServers": {
    "agent-receipts": {
      "command": "npx",
      "args": ["@agent-receipts/mcp-server"]
    }
  }
}

Claude Code

プロジェクトルートの .mcp.json に追加してください:

{
  "mcpServers": {
    "agent-receipts": {
      "command": "npx",
      "args": ["@agent-receipts/mcp-server"]
    }
  }
}

Cursor

プロジェクトルートの .cursor/mcp.json に追加してください:

{
  "mcpServers": {
    "agent-receipts": {
      "command": "npx",
      "args": ["@agent-receipts/mcp-server"]
    }
  }
}

クイックスタート:SDK

npm install @agent-receipts/sdk
import { AgentReceipts } from '@agent-receipts/sdk'

const ar = new AgentReceipts()

const receipt = await ar.track({
  action: 'generate_report',
  input: { query: 'Q4 revenue' },
  output: { total: 142000 },
})

console.log(receipt.receipt_id)  // rcpt_8f3k2j4n...
console.log(receipt.signature)   // ed25519 signature

クイックスタート:CLI

npx @agent-receipts/cli init          # Generate signing keys
npx @agent-receipts/cli keys          # Show public key
npx @agent-receipts/cli list          # List all receipts
npx @agent-receipts/cli verify <id>   # Verify a receipt signature

仕組み

  1. エージェントがアクションを実行 — API呼び出し、コード生成、データ検索など

  2. 入出力をSHA-256でハッシュ化 — 生データはマシンから一切外部へ送信されません

  3. レシートを作成 — アクション、ハッシュ、タイムスタンプ、エージェントID、メタデータを含みます

  4. Ed25519で署名 — ローカルで生成された秘密鍵を使用

  5. 誰でも検証可能 — 公開鍵を共有すれば、受信者が独立して検証可能

MCPツールリファレンス

MCPサーバーは、AIエージェントが直接呼び出せる14個のツールを公開しています:

ツール

説明

主要パラメータ

track_action

自動ハッシュ化でエージェントのアクションを追跡

action, input, output, constraints

create_receipt

事前計算されたハッシュでレシートを作成

action, input_hash, output_hash, constraints

complete_receipt

結果を含めて保留中のレシートを完了

receipt_id, output, status

verify_receipt

レシートの暗号学的署名を検証

receipt_id

get_receipt

IDでレシートを取得

receipt_id

list_receipts

オプションでフィルタリングしてレシートを一覧表示

agent_id, status, chain_id

get_chain

タイムスタンプ順にチェーン内の全レシートを取得

chain_id

get_public_key

検証用のEd25519公開鍵をエクスポート

judge_receipt

レシートのAIジャッジ評価を開始

receipt_id, rubric

complete_judgment

結果を含めて保留中のジャッジメントを完了

receipt_id, verdict, score, criteria

get_judgments

レシートに対する全ジャッジメントを取得

receipt_id

cleanup

期限切れのレシートを削除 (TTL)

dry_run

generate_invoice

指定期間のレシートから請求書を生成

from, to, format, agent_id

get_started

使用例を含むスタートガイドを表示

SDK APIリファレンス

new AgentReceipts(config?)

const ar = new AgentReceipts({
  dataDir: '~/.agent-receipts',  // optional, defaults to ~/.agent-receipts
})

ar.track(params) — 完了したアクションを追跡

const receipt = await ar.track({
  action: 'analyze_data',
  input: { dataset: 'sales_2024' },
  output: { summary: 'Revenue up 12%' },
  agent_id: 'analyst-v2',
  chain_id: 'chain_abc',              // optional, auto-generated if omitted
  parent_receipt_id: 'rcpt_prev',     // optional, links to parent receipt
})

ar.start(params) — 保留中のレシートを開始

const receipt = await ar.start({
  action: 'long_running_task',
  input: { job_id: '12345' },
})

ar.complete(receiptId, params) — 保留中のレシートを完了

const completed = await ar.complete(receipt.receipt_id, {
  output: { result: 'done' },
  status: 'completed',
})

ar.verify(receiptId) — レシートの署名を検証

const { verified, receipt } = await ar.verify('rcpt_8f3k2j4n')
// verified: true | false

ar.get(receiptId) — IDでレシートを取得

const receipt = await ar.get('rcpt_8f3k2j4n')

ar.list(filter?) — レシートを一覧表示

const result = await ar.list({ agent_id: 'my-agent', status: 'completed' })
// result.data: ActionReceipt[]
// result.pagination: { page, limit, total, total_pages, has_next, has_prev }

ar.getPublicKey() — 署名用公開鍵を取得

const publicKey = await ar.getPublicKey()
// 64-char hex string (Ed25519 public key)

ar.track() with Constraints

const receipt = await ar.track({
  action: 'generate_summary',
  input: { document_id: 'doc-q4-2024' },
  output: { summary: 'Revenue grew 12% YoY...' },
  latency_ms: 1200,
  cost_usd: 0.005,
  constraints: [
    { type: 'max_latency_ms', value: 5000 },
    { type: 'max_cost_usd', value: 0.01 },
    { type: 'min_confidence', value: 0.8 },
  ],
})
// receipt.constraint_result.passed → true/false

ar.getJudgments(receiptId) — ジャッジメントを取得

const judgments = await ar.getJudgments('rcpt_8f3k2j4n')

ar.cleanup() — 期限切れのレシートを削除

const { deleted, remaining } = await ar.cleanup()

ar.generateInvoice(params) — レシートから請求書を生成

const invoice = await ar.generateInvoice({
  from: '2026-01-01',
  to: '2026-01-31',
  agent_id: 'my-agent',       // optional filter
  group_by: 'agent',          // optional: agent | action | day
})

CLIリファレンス

コマンド

説明

init

データディレクトリの作成と署名鍵の生成

keys

公開鍵を表示

keys --export

公開鍵をJSONでエクスポート

keys --import <hex>

秘密鍵をインポート (64桁の16進数)

`inspect <id

file>`

レシートを整形して表示

`verify <id

file>`

レシートの署名を検証

`verify <id

file> --key

`

外部公開鍵で検証

list

レシートを一覧表示 (デフォルト: 50)

list --agent <id> --status <s>

エージェントまたはステータスでフィルタリング

list --json

JSONで出力

chain <chain_id>

チェーン内の全レシートを表示

chain <chain_id> --tree

チェーンをツリー形式で表示

stats

レシートの統計情報を表示

judgments <id>

レシートのジャッジメントを一覧表示

cleanup

期限切れのレシートを削除

cleanup --dry-run

削除対象をプレビュー

export <id>

単一のレシートをJSONでエクスポート

export --all

全レシートをコンパクトなJSONでエクスポート

export --all --pretty

全レシートを整形されたJSONでエクスポート

invoice --from <date> --to <date>

指定期間のレシートから請求書を生成

invoice --format <fmt>

json, csv, md, htmlで出力

seed --demo

テスト用のデモデータを生成

seed --demo --count <n>

指定数のデモレシートを生成

seed --demo --clean

生成前に全レシートを削除

watch

新しいレシートをリアルタイムで監視

watch --agent <id>

エージェント、アクション、ステータスでフィルタリングして監視

レシート形式

{
  "receipt_id": "rcpt_8f3k2j4n",
  "chain_id": "chain_x9f2k",
  "parent_receipt_id": null,
  "receipt_type": "action",
  "agent_id": "my-agent",
  "org_id": "my-org",
  "action": "generate_report",
  "status": "completed",
  "input_hash": "sha256:abc123...",
  "output_hash": "sha256:def456...",
  "output_summary": "Generated Q4 report",
  "model": "claude-sonnet-4-20250514",
  "timestamp": "2026-02-07T14:32:01.442Z",
  "completed_at": "2026-02-07T14:32:02.100Z",
  "latency_ms": 658,
  "cost_usd": 0.003,
  "signature": "ed25519:<hex>"
}

入出力はクライアント側でSHA-256ハッシュ化されます。生データは環境から一切外部へ送信されません。レシートにはハッシュのみが保存されます。

検証

レシートの検証が必要な相手に公開鍵を共有してください:

# Export your public key
npx @agent-receipts/cli keys --export

# Verify a receipt with an external public key
npx @agent-receipts/cli verify receipt.json --key <public-key-hex>

検証プロセスでは、レシートの決定論的フィールドに対してEd25519署名を再計算し、保存されている署名と一致することを確認します。ネットワークリクエストは発生せず、完全にオフラインで動作します。

設定

環境変数

説明

デフォルト

AGENT_RECEIPTS_DATA_DIR

データディレクトリのパス

~/.agent-receipts

AGENT_RECEIPTS_AGENT_ID

デフォルトのエージェントID

local-agent

AGENT_RECEIPTS_ORG_ID

組織ID

local-org

AGENT_RECEIPTS_ENVIRONMENT

環境ラベル (development, production, staging, test)

production

RECEIPT_SIGNING_PRIVATE_KEY

Ed25519秘密鍵 (16進数)

自動生成

ストレージ

すべてのデータはデータディレクトリ内にローカル保存されます:

~/.agent-receipts/
├── keys/
│   ├── private.key          # Ed25519 private key (mode 0600)
│   └── public.key           # Ed25519 public key
├── receipts/
│   └── *.json               # Legacy JSON files (auto-migrated)
├── receipts.db              # SQLite database (primary storage)
└── config.json              # Agent and org configuration

v0.2.7以降、レシートはSQLiteに保存され、高速なフィルタリングとページネーションが可能です。既存のJSONレシートファイルは初回起動時に自動的に移行されます。

アーキテクチャ

┌─────────────────────────────────────────────┐
│                  CLI                         │
│           @agent-receipts/cli                 │
├─────────────────────────────────────────────┤
│           SDK            │   MCP Server      │
│   @agent-receipts/sdk     │ @agent-receipts/   │
│                          │   mcp-server      │
├──────────────────────────┴──────────────────┤
│              Crypto + Schema                 │
│   @agent-receipts/crypto  @agent-receipts/     │
│                            schema            │
└─────────────────────────────────────────────┘
  • schema — Zodスキーマ、TypeScript型、Action Receipt Protocol用のJSON Schema

  • crypto — Ed25519鍵生成、署名、検証、正規シリアライズ

  • mcp-server — レシートエンジン、ストレージ、鍵管理を備えたMCPプロトコルサーバー

  • sdk — エンジンをラップした高レベルNode.js SDK

  • cli — レシートの検査、検証、管理を行うコマンドラインツール

  • dashboard — レシートを可視化・管理するためのMission Control Web UI

ダッシュボード (Mission Control)

システム内のすべてのレシート、チェーン、エージェント、制約、ジャッジメントを可視化します。

npx @agent-receipts/dashboard

http://localhost:3274 でMission Controlを開き、すべてのレシートを可視化、検証、管理できます。

機能:リアルタイムのレシートフィード、チェーン可視化、制約の健全性監視、ジャッジメントスコア、署名検証、請求書生成、ダークモード、グローバル検索。

13ページ構成:概要、レシート、レシート詳細、チェーン、チェーン詳細、エージェント、エージェント詳細、制約、ジャッジメント、請求書、検証、設定、仕組み。

説明

examples/basic

検証付きの基本的なアクション追跡

examples/chained

親/子レシートのリンクによる多段階パイプライン

examples/pipeline

チェーンされたレシートによるドキュメント分析パイプライン

examples/constraints

合否ルールによる制約検証

examples/judge

ルーブリックを用いたAIジャッジ評価

examples/ttl

レシートのTTLとクリーンアップ

パッケージ

パッケージ

説明

@agent-receipts/schema

Action Receipt Protocol用のZodスキーマとTypeScript型

@agent-receipts/crypto

Ed25519署名、検証、鍵管理

@agent-receipts/mcp-server

レシートエンジンとストレージを備えたMCPプロトコルサーバー

@agent-receipts/sdk

レシートの追跡と検証を行う高レベルNode.js SDK

@agent-receipts/cli

レシート管理用コマンドラインツール

@agent-receipts/dashboard

Mission Control Web UI — npx @agent-receipts/dashboard

ロードマップ

  • [x] ローカルファーストのレシートストレージ (SQLite、インデックス付きクエリ)

  • [x] Ed25519署名と検証

  • [x] 14個のツールを備えたMCPサーバー

  • [x] Node.js SDK

  • [x] 全コマンドセットを備えたCLI

  • [x] 制約検証 (6つの組み込みタイプ)

  • [x] ルーブリックベースの評価を行うAIジャッジ

  • [x] 出力スキーマ検証 (JSON Schema)

  • [x] レシートのTTLとクリーンアップ

  • [x] 請求書生成 (JSON, CSV, Markdown, HTML)

  • [x] Mission Controlダッシュボード (13ページ、ダークモード、検索)

  • [x] ダッシュボードnpmパッケージ — npx @agent-receipts/dashboard

  • [x] ライブデモ agent-receipts-web.vercel.app

  • [ ] ブロックチェーン/タイムスタンプサービスへのレシートアンカーリング

  • [ ] マルチエージェントレシート共有プロトコル

  • [ ] レシートの圧縮とアーカイブ

  • [ ] クラウドデータベースを備えたホスティングプラン

開発

pnpm install
pnpm build
pnpm test
pnpm dev

ライセンス

MIT — LICENSE を参照

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/webaesbyamin/agent-receipts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server