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

Function respond

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

Source from the content-addressed store, hash-verified

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

Callers 3

serveMetadataServerFunction · 0.70
fetchFunction · 0.50
serveReplayBrainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected