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

Function respond

packages/core/sdk/src/oauth-scope-union.test.ts:116–147  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

114 Effect.gen(function* () {
115 const baseUrlRef = { value: "" };
116 const respond = (path: string): HttpServerResponse.HttpServerResponse => {
117 const base = baseUrlRef.value;
118 if (path.startsWith("/.well-known/oauth-protected-resource")) {
119 if (config.prm === "error")
120 return HttpServerResponse.jsonUnsafe({ error: "boom" }, { status: 500 });
121 if (config.prm == null) return HttpServerResponse.empty({ status: 404 });
122 return HttpServerResponse.jsonUnsafe({
123 resource: `${base}/mcp`,
124 bearer_methods_supported: ["header"],
125 ...(config.prm.authorizationServers
126 ? { authorization_servers: config.prm.authorizationServers }
127 : {}),
128 ...(config.prm.scopesSupported !== undefined
129 ? { scopes_supported: config.prm.scopesSupported }
130 : {}),
131 });
132 }
133 if (
134 path === "/.well-known/oauth-authorization-server" &&
135 config.authServerScopes !== undefined
136 ) {
137 return HttpServerResponse.jsonUnsafe({
138 issuer: base,
139 authorization_endpoint: `${base}${config.authServerAuthorizationPath ?? "/authorize"}`,
140 token_endpoint: `${base}${config.authServerTokenPath ?? "/token"}`,
141 response_types_supported: ["code"],
142 code_challenge_methods_supported: ["S256"],
143 scopes_supported: config.authServerScopes,
144 });
145 }
146 return HttpServerResponse.empty({ status: 404 });
147 };
148 const server = yield* serveTestHttpApp((request) => Effect.succeed(respond(request.url)));
149 baseUrlRef.value = server.baseUrl;
150 return {

Callers 4

serveMetadataServerFunction · 0.70
fetchFunction · 0.50
stubFetchFunction · 0.50
serveReplayBrainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected