MCP Hook Conformance

io.studiomeyer由 studiomeyer.io 發布v0.1.3更新於 Oct 24, 2026

Audits MCP servers for Claude Code mcp_tool hook readiness: idempotency, latency, side-effects.

發布方自己的服務:StudioMeyer Crew

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

本機 CLI 測試工具,用來稽核 MCP 伺服器是否適合在 Claude Code 的 mcp_tool 鉤子中呼叫,檢查冪等性、延遲、副作用與確定性。

可以做什麼
對設定好的 MCP 伺服器執行稽核,輸出人類可讀、JSON 或 JUnit 報告,包含加權評分與問題代碼,並以結束代碼表示通過、失敗或設定錯誤。產生範例設定檔,並解釋個別問題代碼及其修正建議。檢查冪等性、確定性、延遲預算、透過狀態探針偵測唯讀工具的副作用,以及資料流與保留期的文件說明。請注意它是 CLI 工具而非 MCP 伺服器,本身並不使用 MCP 協定。
適用情境
適合在你維護或評估某個 MCP 伺服器、想確認其工具能否安全地從 Claude Code 的 Stop、PreCompact 或 UserPromptSubmit 等生命週期鉤子中呼叫時使用。也適合把可重複的一致性檢查加入 CI 流程。
執行需求
以 npm 套件形式在本機執行,需要 Node.js 20 或更新版本,可全域安裝或透過 npx 執行。需要一份 JSON 設定,指定目標伺服器的指令、參數與環境變數,以及選用的探針與門檻值。未宣告任何驗證或 API 金鑰。目標為 Claude Code 2.1.118 以上與 MCP 規範 2025-06-18;stdio 為主要傳輸,HTTP streamable 為實驗性。
安裝前請注意
稽核會依你設定的指令與環境變數啟動目標伺服器,即在本機執行該伺服器的程式碼。副作用偵測並非封閉驗證,未設定狀態探針時會回傳 INDETERMINATE;延遲包含 JSON-RPC 封裝開銷;資料保護套件僅為關鍵字啟發式判斷,不構成法律意見。它只回報問題,不會自動修正。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 MCP Hook Conformance,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Part of the StudioMeyer MCP Stack — Built in Mallorca 🌴 · ⭐ if you use it

mcp-hook-conformance

[npm version] [npm downloads] [License] [Last commit] [GitHub stars]

Test-harness CLI that audits any MCP server for Claude Code v2.1.118 `mcp_tool` lifecycle-hook readiness.

The third foundation pillar:

  • mcp-protocol-conformance says: does the server speak the protocol?
  • mcp-server-attestation says: who signed this server?
  • mcp-hook-conformance says: is it safe to call this tool from a Stop, PreCompact, or UserPromptSubmit hook?

A note from us

We have been building tools and systems for ourselves for the past two years. The fact that this repo is small and has few stars is not because it is new. It is because we only just decided to share what we have built. It is not a fresh experiment, it is a long story with a recent commit.

We love building things and sharing them. We do not love social media tactics, growth hacks, or chasing stars and followers. So this repo is small. The code is real, it gets used, issues get answered. Judge for yourself.

If it helps you, sharing, testing, and feedback help us. If it could be better, an issue is more useful. If you build something with it, tell us at [email protected]. That genuinely makes our day.

From a small studio in Palma de Mallorca.

Install

bash
npm install -g mcp-hook-conformance

Or run without install:

bash
npx mcp-hook-conformance check ./hook-conformance.config.json

Quick start

bash
# 1. Scaffold a confignpx mcp-hook-conformance init --server-name my-mcp-server
# 2. Edit hook-conformance.config.json (point command/args at your server)
# 3. Run the auditnpx mcp-hook-conformance check ./hook-conformance.config.json

Exit codes:

  • 0 audit passed (no FAILs)
  • 1 audit produced at least one FAIL
  • 2 config error (missing file, invalid schema, unknown suite name)

Subcommands

SubcommandArgsDescription
check<config-path> [--output=human|json|junit] [--suite=...] [--tool=<name>] [--tries=<n>]Run audit; emits report to stdout.
init[--server-name=<name>] [--force]Write example hook-conformance.config.json to cwd.
explain<finding-code>Print full explanation and remediation for a finding (e.g. IDEMP-001).
version-info—Print tool version and supported MCP-spec range. (Alias: version.)

This is a CLI, not an MCP server. Do NOT run mcp-hook-conformance via mcp-inspector — the package declares mcp.specVersion for the targets it audits, not because it speaks MCP itself. Inspector will EACCES on dist/index.js (which is the library export) by design.

Audit suites

SuiteWhat it checksWeight
idempotencySame input N times produces same output, no UUIDs/timestamps unless annotated.30
side-effectsRead-only tools must not mutate server state. Requires stateProbe config.25
latencyp50 < 30s, p95 < 60s (configurable). 5 samples after 1 warmup call.20
determinismResponse shape stable across calls; no float drift.15
dsgvoTool description mentions data flow / retention / deletion (whole-word heuristic).10

Suite scoring: PASS = 100, WARN = 60, INDETERMINATE = 50, FAIL = 0. Tool score = weighted average across configured suites. Aggregate score = mean of tool scores.

Config format

json
{  "$schema": "https://studiomeyer-io.github.io/mcp-hook-conformance/config.schema.json",  "server": {    "name": "my-mcp-server",    "transport": "stdio",    "command": "npx",    "args": ["-y", "my-mcp-server"],    "env": {}  },  "suites": ["idempotency", "latency", "determinism", "side-effects", "dsgvo"],  "tries": 3,  "thresholds": {    "latencyP50Ms": 30000,    "latencyP95Ms": 60000  },  "probes": [    {      "name": "search_things",      "args": { "query": "audit-fixed-input" },      "stateProbe": {        "tool": "list_things",        "args": {}      }    }  ],  "toolFilter": ["search_things", "get_thing"]}

probes lets you pin specific arguments per tool and (for read-only tools) a stateProbe so the side-effects suite can detect mutations. Without a stateProbe the side-effects suite returns INDETERMINATE for that tool.

Finding codes

CodeSuiteSeverityTitle
IDEMP-001idempotencyFAILTool output diverges across identical calls
IDEMP-002idempotencyWARNResponse contains timestamps without nondeterministic annotation
IDEMP-003idempotencyWARNResponse contains UUID/random IDs without nondeterministic annotation
LAT-001latencyFAILTool exceeded p95 latency budget
LAT-002latencyWARNTool p50 latency above 30 seconds
DET-001determinismFAILFloating-point output drift between calls
DET-002determinismWARNResponse shape varies between calls
SIDE-001side-effectsFAILRead-only tool produced state delta
SIDE-002side-effectsINDETERMINATENo state-probe configured for side-effect detection
DSGVO-001dsgvoFAILDestructive tool lacks deletion / retention documentation
DSGVO-002dsgvoWARNTool description missing data-flow keywords

Run mcp-hook-conformance explain <code> for full remediation text.

Compatibility

ComponentVersion
MCP spec2025-06-18
Claude Code>= 2.1.118 (mcp_tool lifecycle hooks)
Node>= 20.0.0
@modelcontextprotocol/sdk^1.29.0

Tested transports:

  • stdio (primary)
  • HTTP streamable (experimental, audit semantics same as stdio)

Reference smoke tests

The tests/smoke/ suite runs the audit against production tenants of mcp-nex and mcp-crm. Opt-in:

bash
RUN_SMOKE_TESTS=1 npm run test:smoke

Snapshot drift triggers a manual review, not a CI fail.

Limitations (read these)

  • Side-effect detection is not hermetic. Without a stateProbe we cannot black-box prove a read-only tool is pure. We return INDETERMINATE instead of false-positive FAIL.
  • Latency is end-to-end stdio roundtrip. Includes JSON-RPC framing, not pure compute.
  • DSGVO suite is keyword heuristic. It catches missing docs reliably; "looks compliant" is not legal advice.
  • No auto-fix. This tool reports findings; you fix them.

About StudioMeyer

StudioMeyer is an AI and design studio based in Palma de Mallorca, working with clients worldwide. We build custom websites and AI infrastructure for small and medium businesses. Production stack on Claude Agent SDK, MCP and n8n, with Sentry, Langfuse and LangGraph for observability and an in-house guard layer.

License

MIT © 2026 Matthias Meyer (StudioMeyer)

來源:README.md,提交 fcf25e9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

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

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Studiomeyer 整合