Skip to main content
Glama
Larslllllll

webhook-verify

by Larslllllll

webhook-verify

Timing-safe, replay-resistant webhook signature verification for Stripe, GitHub, Slack, Shopify and Twilio.

29 passed

Standard library only. No dependencies, no network, no telemetry.

Why

Webhook verification is the one piece of security code almost every backend writes itself, and it goes wrong in four predictable ways:

Mistake

Consequence

signature == expected

Byte-by-byte comparison leaks the position of the first wrong byte through timing. Forgeable given enough attempts.

No timestamp check

A captured valid request stays valid forever. Replay it tomorrow and it still passes.

Verifying the parsed body

You re-serialise, a key order or whitespace changes, and the HMAC no longer matches — so people "fix" it by skipping verification.

Returning False on failure

A caller writes if verify(...) and a truthy string or None slips through.

This library does the opposite of each: hmac.compare_digest everywhere, replay windows on every provider that signs a timestamp, verification against the raw body, and a specific exception on every failure so nothing can be accidentally treated as success.

Related MCP server: webhook-ai-mcp

Use

from webhookverify import verify_stripe, SignatureMismatch, TimestampOutOfRange

try:
    verify_stripe(secret, raw_body, request.headers["Stripe-Signature"])
except TimestampOutOfRange:
    return 400, "replayed or clock-skewed"
except SignatureMismatch:
    return 401, "not from Stripe"
# only now is it safe to parse raw_body

Supported: verify_stripe, verify_github, verify_slack, verify_shopify, verify_twilio, and verify_hmac for anything else.

Stripe secret rotation is handled: a header carrying several v1= signatures passes if any one matches.

MCP server

mcp/server.py exposes one tool, verify_webhook, over JSON-RPC 2.0 stdio (protocol 2024-11-05). It returns valid:true, or valid:false with a precise reason (signature_mismatch, timestamp_out_of_range, malformed_signature) and the instruction not to parse the payload.

{ "mcpServers": { "webhook-verify": { "command": "python3", "args": ["/path/to/webhook-verify/mcp/server.py"] } } }

Tested behaviour

  • Valid signatures pass for all five providers

  • Tampered bodies, wrong secrets and truncated signatures raise SignatureMismatch

  • Replayed and future-dated timestamps raise TimestampOutOfRange (the window is symmetric)

  • Malformed headers raise MalformedSignature — missing prefix, bad base64, non-hex, non-numeric timestamp

  • Stripe multi-v1 rotation passes when any signature matches

  • A source-level guard asserts the module never regresses to == on digests and always length-checks before compare_digest

python -m pytest tests -q

License

MIT

Available Tools

1 tool
verify_webhookA

Verify a webhook signature with a timing-safe comparison and, where the provider signs a timestamp, replay protection. Returns valid:true or the precise reason it failed (signature_mismatch, timestamp_out_of_range, malformed_signature). Never parse or act on a webhook body before this returns valid.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlNoRequired for twilio: the full request URL.
bodyNoThe RAW request body, byte-identical to what was received.
paramsNoRequired for twilio: the POST form parameters.
secretYesSigning secret or auth token.
providerYes
signatureYesThe provider's signature header value.
timestampNoRequired for slack (X-Slack-Request-Timestamp).
tolerance_secondsNoReplay window for providers that sign a timestamp.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral disclosure burden. It reveals timing-safe comparison, replay-window protection, exact return values, and a critical ordering constraint. It stops short of a 5 by not addressing exception behavior or provider-specific edge cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler: the first states the action and return contract, the second states a vital operational warning. The most important guidance is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, a provider enum, and no output schema, the description covers the core verification contract and return values. Provider-specific parameter requirements are left to the schema, which documents them well. It is slightly light on provider-specific behavioral combinations, hence not a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 88%, so the schema already documents most parameters. The description adds little new parameter-level detail beyond tying timestamp/tolerance to replay protection, which the schema already mentions. This meets the baseline but does not elevate it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: verifying a webhook signature with timing-safe comparison and replay protection. It also precisely defines the outcome (valid:true or exact failure reasons), leaving no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear operational context: use this before parsing or acting on a webhook body, and replay protection applies when the provider signs a timestamp. It does not explicitly state when not to use it, but with no sibling tools, the guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedverify_webhook

TDQS

A4.4/5.0
Disambiguation5/5

With only a single tool, there is no possibility of confusing it with another. The tool's purpose is fully specified and self-contained, leaving no ambiguity about when to invoke it.

Naming Consistency5/5

The tool name follows a clear verb_noun convention with snake_case, which is consistent and predictable. Even though there is only one tool, the pattern aligns with common standards and leaves no room for stylistic mismatch.

Tool Count5/5

The server is purpose-built for webhook signature verification, and one focused tool is exactly the right scope. There is no unnecessary bloat, and the single tool fully addresses the server's intended functionality without feeling thin.

Completeness5/5

The tool covers the entire lifecycle of webhook verification: timing-safe comparison, replay protection, and detailed failure reasons. No additional tools appear needed for the stated purpose, making the surface complete for its domain.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables sending rich notifications to Discord and/or Slack webhooks with automatic service detection, retry logic, and support for embeds, blocks, and attachments. Provides secure webhook management with comprehensive input validation and rate limiting.
    3
    TypeScript
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Webhook management and debugging. Validate signatures, log events, replay, and analyze webhook traffic.
    -
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to create callback endpoints, wait for async webhook results, and verify signatures, eliminating the need for polling.
    8
    46
    2
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Verifies MEOK AI Labs compliance attestations (DORA, NIS2, CRA, EU AI Act, etc.) using HMAC-SHA256. Enables piping a signed certificate on stdin to get VALID/INVALID output.
    1
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Larslllllll/webhook-verify'

If you have feedback or need assistance with the MCP directory API, please join our Discord server