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

Function makeSelfHostApiHandler

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

Source from the content-addressed store, hash-verified

155// uses for Workers). The self-host server (serve.ts) binds `AppLayer` to a
156// listening socket instead. We wrap `dispose` to also close the DB / MCP store.
157export const makeSelfHostApiHandler = async (
158 options: MakeSelfHostAppOptions = {},
159): Promise<SelfHostApiHandler> => {
160 const { toWebHandler, betterAuth, closeDb } = await makeSelfHostApp(options);
161 const web = toWebHandler();
162 return {
163 handler: async (request) => {
164 const location = await oauthCallbackSignInRedirectLocation(request, betterAuth.auth);
165 if (location) return new Response(null, { status: 302, headers: { location } });
166 return web.handler(request);
167 },
168 dispose: async () => {
169 await web.dispose();
170 await closeDb();
171 },
172 };
173};

Callers 7

multi-user.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