﻿---
title: "mcp_tool 补丁扫描钩子"
filename: ".codex/hooks.json"
canonical: /templates/mcp-tool-hook/
---

# mcp_tool 补丁扫描钩子

PostToolUse 直接调已连接 MCP。服务器必须先 mcp add。缺服务器不会拦住操作。

```
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "mcp_tool",
            "server": "scanner",
            "tool": "scan_patch",
            "input": { "patch": "${tool_input.command}" },
            "timeout": 30,
            "statusMessage": "Scanning edited files"
          }
        ]
      }
    ]
  }
}

```
