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

Function startOpenApiServer

apps/desktop/scripts/smoke-sidecar.ts:161–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159// running HTTP server, all the way through the compiled binary →
160// MCP → QuickJS → openapi-invoker → HttpClient chain.
161const startOpenApiServer = () => {
162 const Pet = {
163 type: "object",
164 properties: {
165 id: { type: "integer" },
166 name: { type: "string" },
167 tag: { type: "string" },
168 },
169 required: ["id", "name"],
170 };
171
172 const spec = {
173 openapi: "3.0.0",
174 info: { title: "Petstore Smoke API", version: "0.0.1" },
175 paths: {
176 "/pets": {
177 get: {
178 operationId: "listPets",
179 responses: {
180 "200": {
181 description: "ok",
182 content: {
183 "application/json": { schema: { type: "array", items: Pet } },
184 },
185 },
186 },
187 },
188 },
189 "/pets/{petId}": {
190 get: {
191 operationId: "getPet",
192 parameters: [
193 {
194 name: "petId",
195 in: "path",
196 required: true,
197 schema: { type: "integer" },
198 },
199 ],
200 responses: {
201 "200": {
202 description: "ok",
203 content: { "application/json": { schema: Pet } },
204 },
205 "404": { description: "not found" },
206 },
207 },
208 },
209 },
210 };
211
212 // Seed the in-memory store so the GET-driven smoke can verify list +
213 // path-param round-trips. Body-bearing POST/PUT is gated by the
214 // executor's approval flow and is covered by separate non-compiled tests.
215 const pets: Array<{ id: number; name: string; tag?: string }> = [
216 { id: 1, name: "Fido", tag: "dog" },
217 { id: 2, name: "Whiskers", tag: "cat" },
218 ];

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected