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

Function addOrgSource

apps/host-selfhost/src/sources-mcp.test.ts:66–94  ·  view source on GitHub ↗
(organizationId: string)

Source from the content-addressed store, hash-verified

64const BASE = "http://localhost:4788";
65
66const addOrgSource = async (organizationId: string): Promise<void> => {
67 // Register the integration and attach an org-owned connection, on its own
68 // connection to the shared DB file. WAL makes the committed rows visible to
69 // the server. Org-owned connections (and their per-connection tools) are
70 // shared across every member of the tenant.
71 const seedDb = await createSelfHostDb({
72 path: dbPath,
73 namespace: "executor_selfhost",
74 version: "1.0.0",
75 });
76 await Effect.runPromise(
77 Effect.gen(function* () {
78 const admin = yield* createScopedExecutor("seed", organizationId, "Default");
79 yield* admin.openapi.addSpec({
80 spec: { kind: "blob", value: TINY_SPEC },
81 slug: "tiny",
82 baseUrl: "",
83 });
84 yield* admin.connections.create({
85 owner: "org",
86 name: ConnectionName.make("shared"),
87 integration: IntegrationSlug.make("tiny"),
88 template: AuthTemplateSlug.make("none"),
89 value: "",
90 });
91 }).pipe(Effect.provide(Layer.succeed(SelfHostDb)(seedDb)), Effect.scoped),
92 );
93 await seedDb.close();
94};
95
96test("a user's MCP execute sandbox can reach an org-owned connection's tools", async () => {
97 const inviteCode = await mintInviteCode(handler);

Callers 1

Calls 3

createSelfHostDbFunction · 0.90
createScopedExecutorFunction · 0.70
closeMethod · 0.65

Tested by

no test coverage detected