dsh-mock-server

September 12, 2026 ยท View on GitHub

Offline OpenAPI-to-mock generators for DeepSeek Harness. Given an OpenAPI 3.x (or Swagger 2.0) document as a JSON string, the plugin's three tools render a runnable Express/Koa stub, plan a route table, and validate the spec. They are pure generators: no network, no subprocess, and no long-running listener is ever started โ€” the produced source is a string you can save and run yourself.

Tools

ToolDescriptionKey inputs
mock_fromOpenApiRender a ready-to-run Express or Koa mock-server stub as a source string, sampling each operation's success response (resolving $ref, allOf, arrays).schemaJson, framework?, port?, cors?
mock_routesPlan a flat, normalized route table (method, path, operationId, status) from the document.jsonSpec
mock_validateSpecValidate a document for the structural rules the other tools rely on and report every violation in one pass.specJson

All three return invalid JSON / structural-error details instead of throwing, and mock_fromOpenApi / mock_routes fall back to reported errors when a document is malformed.

Install

npx -y @deepseek-ai/dsh plugin --profile web add @qingshanjiluo/dsh-mock-server

Configuration

OptionTypeDefaultMeaning
defaultFrameworkstringexpressFramework used when a call omits framework (express or koa).
defaultPortnumber3000Port baked into the generated listen() line when port is omitted.
defaultCorsbooleantrueWhether generated stubs include a permissive CORS layer by default.

Development

npm install --no-audit --no-fund
npx tsc --noEmit      # typecheck
npm run build         # emit lib/index.js and lib/index.d.ts
npx vitest run        # behavior tests
node scripts/load-smoke.mjs   # load the built artifact and register every tool

License

MIT