MCPcopy
hub / github.com/codeaashu/claude-code / urlMatchesPattern

Function urlMatchesPattern

src/utils/hooks/execHttpHook.ts:64–68  ·  view source on GitHub ↗

* Match a URL against a pattern with * as a wildcard (any characters). * Same semantics as the MCP server allowlist patterns.

(url: string, pattern: string)

Source from the content-addressed store, hash-verified

62 * Same semantics as the MCP server allowlist patterns.
63 */
64function urlMatchesPattern(url: string, pattern: string): boolean {
65 const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
66 const regexStr = escaped.replace(/\*/g, '.*')
67 return new RegExp(`^${regexStr}$`).test(url)
68}
69
70/**
71 * Strip CR, LF, and NUL bytes from a header value to prevent HTTP header

Callers 1

execHttpHookFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected