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

Function writeUnauthorized

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

Source from the content-addressed store, hash-verified

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

Callers 1

handleMcpRequestFunction · 0.85

Calls 1

writeJsonFunction · 0.70

Tested by

no test coverage detected