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

Function makeSelfHostApiHandler

apps/host-selfhost/src/app.ts:188–204  ·  view source on GitHub ↗
(
  options: MakeSelfHostAppOptions = {},
)

Source from the content-addressed store, hash-verified

186// uses for Workers). The self-host server (serve.ts) binds `AppLayer` to a
187// listening socket instead. We wrap `dispose` to also close the DB / MCP store.
188export const makeSelfHostApiHandler = async (
189 options: MakeSelfHostAppOptions = {},
190): Promise<SelfHostApiHandler> => {
191 const { toWebHandler, betterAuth, closeDb } = await makeSelfHostApp(options);
192 const web = toWebHandler();
193 return {
194 handler: async (request) => {
195 const location = await oauthCallbackSignInRedirectLocation(request, betterAuth.auth);
196 if (location) return new Response(null, { status: 302, headers: { location } });
197 return web.handler(request);
198 },
199 dispose: async () => {
200 await web.dispose();
201 await closeDb();
202 },
203 };
204};

Callers 10

multi-user.test.tsFile · 0.85
sso.test.tsFile · 0.85
mcp-oauth.test.tsFile · 0.85
mcp.test.tsFile · 0.85

Calls 3

makeSelfHostAppFunction · 0.85
disposeMethod · 0.80

Tested by

no test coverage detected