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

Function propsForPrincipal

apps/cloud/src/mcp/agent-handler.ts:95–112  ·  view source on GitHub ↗
(
  request: Request,
  principal: Extract<AuthOutcome, { readonly _tag: "Authenticated" }>["principal"],
  resource: McpResource,
)

Source from the content-addressed store, hash-verified

93};
94
95const propsForPrincipal = (
96 request: Request,
97 principal: Extract<AuthOutcome, { readonly _tag: "Authenticated" }>["principal"],
98 resource: McpResource,
99): Effect.Effect<McpSessionProps> =>
100 Effect.gen(function* () {
101 const propagation = yield* currentPropagationHeaders(request);
102 return {
103 session: {
104 organizationId: principal.organizationId,
105 userId: principal.accountId,
106 elicitationMode: readElicitationMode(request),
107 resource,
108 webOrigin: new URL(request.url).origin,
109 },
110 propagation,
111 };
112 });
113
114export const makeCloudMcpAgentHandler = () => {
115 const serveOptions = { binding: "MCP_SESSION", transport: "streamable-http" } as const;

Callers 1

makeCloudMcpAgentHandlerFunction · 0.70

Calls 2

readElicitationModeFunction · 0.85

Tested by

no test coverage detected