Audit Ledger Mcp

io.github.shahidh68由 GitHub 账号 shahidh68 发布v0.3.1更新于 Oct 24, 2026

Record AI decisions to a tamper-evident audit ledger from any MCP-compatible agent.

发布方自己的服务:audit.domains - Domain Valuation

已验证STDIO仅桌面安全与监控数据与分析

概览

AI 生成的概览

本地 MCP 服务器,让助手把 AI 决策写入防篡改审计账本,并校验记录与日志完整性。

可以做什么
记录决策:写入模型版本、本地哈希后的提示词与输入、决策输出和人工介入标记,返回事件 ID 与时间戳。校验记录:将已存记录与不可变副本比对,返回完整性是否通过。检查完整性:对比租户计数器与实际记录,列出缺失的序号。列出决策:按时间窗口和数量上限查询该租户最近的决策。
适用场景
适合需要对 AI 代理所做决策留下持久、防篡改记录的团队,例如欧盟 AI 法案第 12 条日志、模型风险证据或 GDPR 数据最小化。也适合让 Claude Desktop、Cursor 或 LangGraph 等代理在每一步后自动写入审计条目。
运行要求
通过 npx 或全局 npm 安装在本地以 stdio 运行(需 Node 20+)。无配置时使用共享的公共沙箱租户。生产使用需设置 AUDIT_API_URL 以及租户密钥 AUDIT_WRITE_KEY 和 AUDIT_READ_KEY,建议再设 AUDIT_HMAC_KEY;可选 AUDIT_TIMEOUT_MS 和 AUDIT_RETRY_ATTEMPTS。需要能访问账本 API 的网络。
安装前请注意
沙箱租户为共享公开环境,记录保留 7 年且无法删除,不得写入生产数据或客户个人数据。决策输出会原样存储,因此不能包含原始个人数据。未设置 AUDIT_HMAC_KEY 时会退回普通 SHA-256,对低熵值的保护较弱。写密钥与读密钥相互独立,请勿写入日志或共享配置。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Audit Ledger Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

audit-ledger-mcp

Connect Claude, Cursor, LangGraph, or your own agent to the AI Audit Ledger. This MCP server gives an agent the tools to record, check, and list decisions in a tamper-evident log with one line of config.

It is built for teams that need a clear record of AI decisions: EU AI Act Article 12 logging, FCA SS1/23 model risk evidence, and GDPR data minimisation. Raw personal data is hashed locally before anything is sent, so the ledger only sees fingerprints.

[npm] [License: Apache 2.0] [MCP]

The AI Audit Ledger family. This MCP server writes decisions to the ledger, which proves what happened and whether the record was changed. The AI Decision Evidence Hub sits above the ledger, read-only. It turns each lightweight decision record into an audit case file by showing what evidence is present, what is still missing, who owns each gap, and the current readiness score. Family: audit-ledger · audit-ledger-mcp · evidence-hub.

Try the live dashboard →  ·  30 synthetic decisions written via this MCP server, queryable and verifiable.

[LangGraph agents using audit-ledger-mcp — triage, risk, and human-in-the-loop each calling record_decision]

A LangGraph workflow calls record_decision after each agent step. Three audit events written to the live ledger; every one independently verifiable.


What it does

Exposes four tools to any MCP-compatible agent:

ToolWhat it does
record_decisionLog an AI decision. Hashes inputs locally, then writes through to the ledger. Returns an event ID.
verify_decisionCross-check a stored record against the immutable S3 Object Lock copy. Returns integrity_verified: true/false.
verify_completenessDetect deleted or missing records. Compares the ledger's per-tenant counter against the rows actually present and returns any sequence numbers that are gone. The answer to "can you prove the log is complete?"
list_decisionsQuery recent decisions, optionally filtered by time window. Tenant-scoped by API key.

Each call ends up as a regulator-grade audit record in your deployed ledger — DynamoDB for query, S3 Object Lock COMPLIANCE mode for the immutable copy, 7-year retention by default.


Quick start — zero configuration

bash
npx -y audit-ledger-mcp

That's it. With no environment variables, the server boots into sandbox mode and writes records to a shared public tenant on a hosted ledger. You can try every tool — record_decision, verify_decision, verify_completeness, list_decisions — without provisioning anything.

When sandbox mode is active, you'll see a banner on stderr:

[audit-ledger-mcp] ─────────────── SANDBOX MODE ───────────────[audit-ledger-mcp] No AUDIT_API_URL configured.[audit-ledger-mcp] Using the public sandbox at sandbox-public.[audit-ledger-mcp]   View: https://d2pfirb2397ixy.cloudfront.net[audit-ledger-mcp] Do NOT write real personal data...

Sandbox properties

Hosted bygithub.com/shahidh68/audit-ledger (same AWS deployment)
Tenantsandbox-public (shared, public)
Rate limit100 requests/minute per IP
Retention7 years (records cannot be deleted)
AudienceTyre-kickers, integration tests, framework demos
NOT forProduction data, customer PII, real compliance records

Wire it into Claude Desktop with zero config

json
{  "mcpServers": {    "audit-ledger-sandbox": {      "command": "npx",      "args": ["-y", "audit-ledger-mcp"]    }  }}

Restart Claude Desktop. The four tools appear in the MCP menu immediately. Try asking Claude to "record this decision: should X be approved?" and watch a record land in the sandbox dashboard.


Production install

For real workloads, deploy your own audit ledger and point the MCP server at it:

bash
npm install -g audit-ledger-mcp

Configure with the API URL plus your tenant keys (any of them being set switches off sandbox mode). AUDIT_HMAC_KEY is technically optional for backwards compatibility but strongly recommended — see the note above the value below:

bash
export AUDIT_API_URL="https://<api-id>.execute-api.<region>.amazonaws.com/prod"export AUDIT_WRITE_KEY="<your-tenant-write-key>"export AUDIT_READ_KEY="<your-tenant-read-key>"
# Strongly recommended. Tenant-held secret used to HMAC PII and prompts# locally before sending. Generate once, store next to AUDIT_WRITE_KEY:#   node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"# If unset, the MCP falls back to plain SHA-256 and warns once (back-compat).export AUDIT_HMAC_KEY="<your-tenant-hmac-secret>"
# Optionalexport AUDIT_TIMEOUT_MS=5000        # default 5000export AUDIT_RETRY_ATTEMPTS=3       # default 3

The full template lives in .env.example.


Wire it into an agent

Claude Desktop

Edit your claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json):

json
{  "mcpServers": {    "audit-ledger": {      "command": "npx",      "args": ["-y", "audit-ledger-mcp"],      "env": {        "AUDIT_API_URL": "https://<api-id>.execute-api.<region>.amazonaws.com/prod",        "AUDIT_WRITE_KEY": "<your-tenant-write-key>",        "AUDIT_READ_KEY": "<your-tenant-read-key>",        "AUDIT_HMAC_KEY": "<your-tenant-hmac-secret>"      }    }  }}

AUDIT_HMAC_KEY is the tenant secret used to keyed-hash PII locally before any payload leaves the MCP server process. Generate it once with node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" and store the result in the env block above. The MCP never transmits this value, only reads it.

Restart Claude Desktop. You'll see "audit-ledger" in the MCP tools menu. Ask Claude something like "Record this decision: I declined the application because…" and watch it call record_decision automatically.

Cursor

In Cursor settings → MCP → add server:

json
{  "mcpServers": {    "audit-ledger": {      "command": "npx",      "args": ["-y", "audit-ledger-mcp"],      "env": {        "AUDIT_API_URL": "https://<api-id>.execute-api.<region>.amazonaws.com/prod",        "AUDIT_WRITE_KEY": "<your-tenant-write-key>",        "AUDIT_READ_KEY": "<your-tenant-read-key>",        "AUDIT_HMAC_KEY": "<your-tenant-hmac-secret>"      }    }  }}

LangGraph (Python)

Using langchain-mcp-adapters:

python
from langchain_mcp_adapters.client import MultiServerMCPClientfrom langgraph.prebuilt import create_react_agentfrom langchain_anthropic import ChatAnthropicimport os
client = MultiServerMCPClient({    "audit-ledger": {        "command": "npx",        "args": ["-y", "audit-ledger-mcp"],        "transport": "stdio",        "env": {            "AUDIT_API_URL":   os.environ["AUDIT_API_URL"],            "AUDIT_WRITE_KEY": os.environ["AUDIT_WRITE_KEY"],            "AUDIT_READ_KEY":  os.environ["AUDIT_READ_KEY"],            "AUDIT_HMAC_KEY":  os.environ["AUDIT_HMAC_KEY"],        },    }})
tools = await client.get_tools()agent = create_react_agent(    ChatAnthropic(model="claude-sonnet-4-7-20251022"),    tools,)
# The agent can now call record_decision, verify_decision, verify_completeness, list_decisionsresult = await agent.ainvoke({    "messages": [{"role": "user", "content": "Triage this loan application…"}]})

Custom client (raw MCP)

bash
AUDIT_API_URL=... AUDIT_WRITE_KEY=... AUDIT_READ_KEY=... AUDIT_HMAC_KEY=... npx -y audit-ledger-mcp

The server speaks MCP over stdio. Send initialize, tools/list, and tools/call requests per the MCP specification.


How a record_decision call flows

Agent                  audit-ledger-mcp                  AWS (your ledger)  |                          |                                 |  |--- record_decision ----->|                                 |  |   raw_user_input         | (hash locally — no PII over     |  |   raw_system_prompt      |  the wire from this point)      |  |   decision_output        |                                 |  |   human_in_loop          |                                 |  |                          |--- HTTPS POST /audit/events --->|  |                          |    {hashes + decision +         |  |                          |     x-api-key}                  |  |                          |                                 |  |                          |<--- 202 Accepted ---------------|  |                          |    { event_id, ... }            |  |<--- event_id ------------|                                 |  |     recorded_at          |                                 |  |     note                 |                                 |

Storage on the AWS side happens asynchronously through SQS → Processor Lambda → DynamoDB + S3 Object Lock. See the main repo's ARCHITECTURE.md for the full path.


Tool reference

record_decision

Record an AI decision to the ledger.

ParameterTypeRequiredNotes
model_versionstringYese.g. "claude-sonnet-4-7-20251022"
raw_system_promptstringYesHashed locally
raw_user_inputstringYesHashed locally
ai_decision_outputobjectYesStored verbatim — must not contain raw PII
human_in_loopbooleanYesCritical for EU AI Act Article 14
event_iduuid v4NoAuto-generated if omitted
timestampISO 8601NoDefaults to now

verify_decision

Tamper-check a stored record.

ParameterTypeRequiredNotes
event_iduuid v4YesThe ID of the record to verify

Returns the DynamoDB record, the S3 record, and integrity_verified: true/false.

verify_completeness

Detect missing records. Sister tool to verify_decision: that one proves a record that exists has not been altered; this one proves no records have been deleted.

ParameterTypeRequiredNotes
fromintegerNoInclusive lower bound on sequence_no. Defaults to 1.
tointegerNoInclusive upper bound on sequence_no. Defaults to the tenant's current counter.
tenant_idstringNoRequired only with the admin read key; ignored otherwise.

Returns the requested range, the expected vs found count, the list of missing sequence numbers, and a human-readable note.

json
{  "tenant_id": "acme-prod",  "range": { "from": 1, "to": 142 },  "expected_count": 142,  "found_count": 140,  "missing": [47, 91],  "note": "Found 2 missing sequence number(s) in range. Each gap represents a deleted, lost, or never-written record. Cross-check against burned_sequence log entries before treating as a deletion."}

list_decisions

List recent decisions for the calling tenant.

ParameterTypeRequiredNotes
fromISO 8601NoDefaults to 7 days ago
toISO 8601NoDefaults to now
limitinteger 1–500NoDefaults to 100

Security

  • PII hashing happens in this process, not in the ledger. HMAC-SHA256 over UTF-8, keyed off the AUDIT_HMAC_KEY you set in your environment. The key never leaves your process; only the 64-char hex digest is sent. Plain SHA-256 of low-entropy values (names, emails) is brute-forceable in seconds and under ICO/EDPB guidance still counts as personal data, which is why the keyed version is the default for new installs. For backwards compatibility, if AUDIT_HMAC_KEY is unset the MCP falls back to plain SHA-256 and logs a one-time deprecation warning on stderr; existing setups keep working unchanged.
  • API keys are never logged. They come from environment variables, are passed in the x-api-key header, and are never echoed back to the agent or written to disk.
  • Two key namespaces. Write keys cannot read; read keys cannot write. A leaked write key cannot exfiltrate data; a leaked read key cannot plant fake records.
  • Errors are propagated with HTTP status passthrough. Rate limit, invalid key, and validation errors surface to the agent so it can react appropriately rather than retry blindly.

What this is not

  • Not legal advice. This is infrastructure that produces audit evidence. Whether that evidence satisfies any specific regulatory obligation is a question for your legal team.
  • Not a substitute for a model risk audit. It records what the AI did, not whether it was right.
  • Not a bias or fairness testing tool. It is the audit layer underneath whatever testing you already do.

Companion: AI Decision Evidence Hub

This MCP server writes decisions to the ledger — the immutable record of what happened. The AI Decision Evidence Hub is the read-only workbench above the ledger. It answers the next question an auditor asks: the decision is recorded, but is the evidence complete enough to review?

For every recorded decision it produces:

  • an audit-readiness score (0–100) across nine evidence categories (model, data, policy, human review, monitoring, prompt, integrity, retention, decision);
  • exactly what evidence is present vs missing, and who owns each expected gap;
  • a per-decision audit pack that can be printed, saved as PDF, or downloaded as JSON;
  • a dashboard (cross-linked with the ledger's), plus a manifest-based resolver that auto-fills static evidence.

Open gaps are normal. The ledger keeps the decision record small and tamper-evident; Evidence Hub shows the follow-up evidence needed to make that decision audit-ready. It reads the ledger over its API and never modifies a record. Serverless on AWS (Lambda + DynamoDB). See its Customer Guide and Admin Runbook.

The family: audit-ledger (what happened) · audit-ledger-mcp (this server — how agents write decisions) · evidence-hub (audit-readiness).


Development

bash
git clone https://github.com/shahidh68/audit-ledger-mcp.gitcd audit-ledger-mcpnpm installnpm run buildnpm test

The server is TypeScript on Node 20+, ESM, stdio transport, using @modelcontextprotocol/sdk.


Related

  • shahidh68/audit-ledger — the AWS infrastructure this server talks to. CDK stack, Python and Node SDKs, compliance dashboard, full architecture documentation.
  • shahidh68/evidence-hub — the audit workbench above the ledger. It scores each decision's evidence, treats open gaps as expected follow-up work, and generates printable/downloadable audit packs. (Customer Guide · Admin Runbook)

License

Apache License 2.0 — see LICENSE.

The patent grant is intentional. Compliance infrastructure sits adjacent to enterprise legal review and the explicit grant matters there.


Author

Built by Shahid. Available for Principal AI Engineering and Head of AI Engineering roles, and fractional advisory engagements, in UK regulated fintech.

来源:README.md,提交 7cfa51e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.3.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Audit 集成