MCPcopy Create free account
hub / github.com/Effect-TS/effect / layer

Function layer

packages/ui/devtools/src/node/DevToolsServer.ts:147–172  ·  view source on GitHub ↗
(
  options?: Options
)

Source from the content-addressed store, hash-verified

145 * @since 4.2.0
146 */
147export const layer = (
148 options?: Options
149): Layer.Layer<never, HttpServerError.ServeError> =>
150 Layer.unwrap(Effect.sync(() => {
151 const size = Math.max(1, options?.size ?? 1_000)
152 const { routes, server } = Server.make({
153 size,
154 dispatch: options?.dispatch ?? false,
155 keep: Math.max(0, options?.keep ?? 5),
156 fields: options?.fields
157 })
158 return HttpRouter.serve(
159 Layer.mergeAll(routes, viewer(size, options?.fields), Mcp.layer(server)),
160 {
161 disableLogger: true,
162 disableListenLog: true
163 }
164 ).pipe(
165 Layer.provide(
166 NodeHttpServer.layer(createServer, {
167 port: options?.port ?? defaultPort,
168 host: "127.0.0.1"
169 })
170 )
171 )
172 }))
173
174/**
175 * The URL a page and an MCP client use for a server started with these

Callers

nothing calls this directly

Calls 6

viewerFunction · 0.85
makeMethod · 0.65
pipeMethod · 0.65
syncMethod · 0.45
layerMethod · 0.45
provideMethod · 0.45

Tested by

no test coverage detected