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 集成