MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / writeUnauthorized

Function writeUnauthorized

packages/plugins/mcp/src/testing/server.ts:107–117  ·  view source on GitHub ↗
(response: http.ServerResponse, origin: string)

Source from the content-addressed store, hash-verified

105 let sessionMethodRejection: { readonly method: string; readonly status: number } | undefined;
106
107 const writeUnauthorized = (response: http.ServerResponse, origin: string) =>
108 writeJson(
109 response,
110 401,
111 { error: "invalid_token" },
112 {
113 "www-authenticate":
114 options.auth?.wwwAuthenticate ??
115 `Bearer resource_metadata="${origin}${protectedResourcePath}${path}", error="invalid_token"`,
116 },
117 );
118
119 const namesJsonRpcMethod = (parsedBody: unknown, method: string): boolean => {
120 const messages = Array.isArray(parsedBody) ? parsedBody : [parsedBody];

Callers 1

handleMcpRequestFunction · 0.85

Calls 1

writeJsonFunction · 0.70

Tested by

no test coverage detected