MCPcopy Create free account
hub / github.com/cortexkit/magic-context / start

Method start

packages/e2e-tests/src/mock-provider/server.ts:93–102  ·  view source on GitHub ↗
(options: MockServerOptions = {})

Source from the content-addressed store, hash-verified

91 private matchers: RequestMatcher[] = [];
92
93 async start(options: MockServerOptions = {}): Promise<{ port: number; baseURL: string }> {
94 const port = options.port ?? 0; // 0 = pick any available port
95 this.server = Bun.serve({
96 port,
97 fetch: async (req) => this.handle(req),
98 });
99 const actualPort = this.server.port ?? 0;
100 if (!actualPort) throw new Error("mock server failed to bind a port");
101 return { port: actualPort, baseURL: `http://127.0.0.1:${actualPort}` };
102 }
103
104 async stop(): Promise<void> {
105 if (this.server) {

Callers 2

createMethod · 0.95
createMethod · 0.95

Calls 3

handleMethod · 0.95
sendFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected