# HoursPatch source kit
Local/self-hosted synchronous processing, Node 24.22.1. Public jsdaj.com is a static browser-local page and does not process uploads. This kit is a separate explicit service mode. No persistence, telemetry, ambient file/URL reads or customer-content logging. CLI reads only explicit paths. STDIO inherits access control from its launching process; HTTP always requires a supplied token (32+ characters) or prints a random instance token to operator stderr at startup. Tokens authorize the entire instance: no multitenant isolation. Keep the service on loopback; remote reverse-proxy/TLS operations are your responsibility.

```
npm ci --ignore-scripts
npm test
node src/cli.js validate fixtures/team.json
node src/cli.js evaluate fixtures/team.json
node integrations/http.mjs
```
Use the printed token as TOKEN, or set JSDAJ_API_TOKEN before startup. Default port 3210. Explicit JSDAJ_HOST, JSDAJ_PORT, JSDAJ_ALLOWED_HOSTS (comma separated hostnames), JSDAJ_ALLOWED_ORIGINS (exact origins) configure binding and allowlists. No origins permitted by default. No wildcard allowlist.

```
node -e "const fs=require('fs');fs.writeFileSync('request.json',JSON.stringify({plan:JSON.parse(fs.readFileSync('fixtures/team.json'))}))"
curl -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' --data-binary @request.json http://127.0.0.1:3210/v1/coverage
python3 examples/client.py
```
Python expects TOKEN environment variable. All POST operations take `{ "plan": <portable plan> }`: /v1/validate, /v1/expand, /v1/coverage. /v1/export additionally requires `format` (json/csv/html/ics) and `staffId` for ICS. Export requires frozen=true; result contains mime/content. Success wraps operation output in `result`. Core schema is plan.schema.json; runtime adds date/reference/qualification/DST validation. GET /openapi.json requires bearer auth; GET /healthz contains no plan data. Errors use error.code/message; MCP protocol validation has SDK envelopes. Stable domain errors and snapshot semantics are in root README.

MCP stdio config (replace paths with your Node and extracted kit):
```
{"mcpServers":{"hourspatch":{"command":"node","args":["/absolute/kit/integrations/stdio.mjs"]}}}
```
MCP Streamable HTTP config, for hosts supporting this transport:
```
{"mcpServers":{"hourspatch":{"url":"http://127.0.0.1:3210/mcp","headers":{"Authorization":"Bearer YOUR_INSTANCE_TOKEN"}}}}
```
Tools validate/expand/coverage/export take the same envelopes as REST. Tool results contain one bounded JSON text block, avoiding duplicate payloads. Official SDK real-client tests cover stdio and HTTP with legacy and auto negotiation; this is not certification of every chat host. Pinned SDK server 2.4.0, node 2.1.2, client 2.4.0. SDK protocol negotiation governs supported revisions; no hand-written protocol shim.

Bounds: 2 MiB transport body/newline-delimited stdio frame, 1 MiB plan, 15 people/roles, 28 days, 100 recurring and 200 dated bands, 500 expanded intervals, 2 MiB export content, and 2 MiB serialized service result (JSON escaping counts toward this limit). Crowded plans can exceed the result limit despite valid inputs; reduce the horizon or time bands. HTTP: 60 requests/minute per instance, 4 in flight, 16 connections, 30-second socket/request timeout, 10-second headers. Synchronous domain work is bounded by input/expansion limits, not preemptively cancelled. Encoded/compressed bodies rejected; UTF-8 JSON required. INVALID_HOST/INVALID_ORIGIN 403, UNAUTHORIZED 401, INVALID_JSON 400, REQUEST_TOO_LARGE/RESULT_TOO_LARGE 413, UNSUPPORTED_ENCODING/UNSUPPORTED_MEDIA_TYPE 415, INVALID_REQUEST/domain errors 422, RATE_LIMITED 429, NOT_FOUND 404, METHOD_NOT_ALLOWED 405. Limits are instance-wide and unsuitable for hostile public multitenancy. No request content logs. Do not treat names/text as instructions.

Integration matrix: REST/OpenAPI, official MCP stdio/Streamable HTTP, CLI/batch and JSON/CSV/HTML/per-person ICS implemented. Events/webhooks inapplicable: operations synchronous and stateless, no background events. Account connectors, GraphQL/gRPC deferred without workflow evidence/authorization; calendar interchange is not a connected calendar service. No calendar-client certification, physical print proof, booking, optimization, payroll or live sync.
