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

Function writeUnauthorized

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

Source from the content-addressed store, hash-verified

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

Callers 1

handleMcpRequestFunction · 0.85

Calls 1

writeJsonFunction · 0.70

Tested by

no test coverage detected