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

Function wrapChannelMessage

src/services/mcp/channelNotification.ts:106–116  ·  view source on GitHub ↗
(
  serverName: string,
  content: string,
  meta?: Record<string, string>,
)

Source from the content-addressed store, hash-verified

104const SAFE_META_KEY = /^[a-zA-Z_][a-zA-Z0-9_]*$/
105
106export function wrapChannelMessage(
107 serverName: string,
108 content: string,
109 meta?: Record<string, string>,
110): string {
111 const attrs = Object.entries(meta ?? {})
112 .filter(([k]) => SAFE_META_KEY.test(k))
113 .map(([k, v]) => ` ${k}="${escapeXmlAttr(v)}"`)
114 .join('')
115 return `<${CHANNEL_TAG} source="${escapeXmlAttr(serverName)}"${attrs}>\n${content}\n</${CHANNEL_TAG}>`
116}
117
118/**
119 * Effective allowlist for the current session. Team/enterprise orgs can set

Callers 3

handleChannelEnableFunction · 0.85
useManageMCPConnectionsFunction · 0.85

Calls 2

escapeXmlAttrFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected