Skip to content

Model HTTP hook handler type #227

@bguidolim

Description

@bguidolim

Phase 2: HTTP Hook Handler Type

Context

Claude Code now supports type: "http" hook handlers that send the event's JSON input as an HTTP POST to a URL. The endpoint returns decisions using the same JSON output format as command hooks.

New Fields

Field Type Description
type "http" Handler type
url String URL to POST to
headers [String: String]? HTTP headers with env var interpolation ($VAR_NAME / ${VAR_NAME})
allowedEnvVars [String]? Env var names permitted for header interpolation

Example

{
  "type": "http",
  "url": "http://localhost:8080/hooks/pre-tool-use",
  "timeout": 30,
  "headers": {
    "Authorization": "Bearer $MY_TOKEN"
  },
  "allowedEnvVars": ["MY_TOKEN"]
}

Files to Modify

  • Sources/mcs/Core/Settings.swift — extend HookEntry to support url, headers, allowedEnvVars
  • Sources/mcs/ExternalPack/ExternalPackManifest.swift — allow packs to define HTTP hooks
  • Validation: if type == "http", url is required
  • Tests for serialization/round-tripping

Acceptance Criteria

  • HookEntry can represent HTTP hooks with all fields
  • Pack authors can define HTTP hooks in techpack.yaml
  • Validation ensures url is present for HTTP type
  • Backward compatible

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions