@cyanheads/calculator-mcp-server 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md ADDED
@@ -0,0 +1,323 @@
1
+ # Agent Protocol
2
+
3
+ **Server:** calculator-mcp-server
4
+ **Version:** 0.1.6
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
6
+
7
+ > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
8
+
9
+ A publicly-hosted calculator MCP server that lets any LLM verify mathematical computations. Powered by [math.js](https://mathjs.org/) v15. No auth required — all operations are read-only and stateless.
10
+
11
+ ### MCP Surface
12
+
13
+ | Primitive | Name | Purpose |
14
+ |:----------|:-----|:--------|
15
+ | Tool | `calculate` | Evaluate, simplify, or differentiate math expressions. Single tool — `operation` param defaults to `evaluate`. |
16
+ | Resource | `calculator://help` | Static reference of available functions, operators, constants, and syntax. |
17
+
18
+ ### Security Model
19
+
20
+ MathService wraps a **hardened math.js instance** — dangerous functions (`import`, `createUnit`, `evaluate`, `parse`, `compile`, `chain`, `config`, `resolve`, `reviver`, `parser`) are disabled in the expression scope. `simplify` and `derivative` are also disabled in expressions but called programmatically by the tool handler. Evaluation runs inside `vm.runInNewContext()` with a timeout. Input length is capped. Expression separators (semicolons and newlines) are rejected — single expression per call only. Variable scope accepts `z.record(z.number())` only with prototype-polluting keys blocked. Result types are validated (functions, parsers, and result sets rejected). Result size is capped via `CALC_MAX_RESULT_LENGTH`. The math.js `version` constant is redacted to prevent fingerprinting.
21
+
22
+ ---
23
+
24
+
25
+ ## What's Next?
26
+
27
+ When the user asks what to do next, what's left, or needs direction, suggest relevant options based on the current project state:
28
+
29
+ 1. **Re-run the `setup` skill** — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
30
+ 2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
31
+ 3. **Add tools/resources/prompts** — scaffold new definitions using the `add-tool`, `add-resource`, `add-prompt` skills
32
+ 4. **Add services** — scaffold domain service integrations using the `add-service` skill
33
+ 5. **Add tests** — scaffold tests for existing definitions using the `add-test` skill
34
+ 6. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
35
+ 7. **Run `devcheck`** — lint, format, typecheck, and security audit
36
+ 8. **Run the `polish-docs-meta` skill** — finalize README, CHANGELOG, metadata, and agent protocol for shipping
37
+ 9. **Run the `maintenance` skill** — sync skills and dependencies after framework updates
38
+
39
+ Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
40
+
41
+ ---
42
+
43
+ ## Core Rules
44
+
45
+ - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
46
+ - **Use `ctx.log`** for request-scoped logging. No `console` calls.
47
+ - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
48
+ - **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
49
+ - **Secrets in env vars only** — never hardcoded.
50
+
51
+ ---
52
+
53
+ ## Patterns
54
+
55
+ ### Tool
56
+
57
+ ```ts
58
+ import { tool, z } from '@cyanheads/mcp-ts-core';
59
+ import { getMathService } from '@/services/math/math-service.js';
60
+ import { getServerConfig } from '@/config/server-config.js';
61
+
62
+ export const calculateTool = tool('calculate', {
63
+ description: 'Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives.',
64
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
65
+ input: z.object({
66
+ expression: z.string()
67
+ .describe('Mathematical expression to evaluate (e.g., "2 + 3 * 4", "sin(pi/4)", "5 kg to lbs").'),
68
+ operation: z.enum(['evaluate', 'simplify', 'derivative']).default('evaluate')
69
+ .describe('Operation: "evaluate" (default), "simplify", or "derivative".'),
70
+ variable: z.string().optional()
71
+ .describe('Variable for differentiation. Required when operation is "derivative".'),
72
+ scope: z.record(z.number()).optional()
73
+ .describe('Variable assignments. Example: { "x": 5, "y": 3 }.'),
74
+ precision: z.number().int().min(1).max(16).optional()
75
+ .describe('Significant digits for numeric results. Ignored for symbolic operations.'),
76
+ }),
77
+ output: z.object({
78
+ result: z.string().describe('Computed result as a string.'),
79
+ resultType: z.string().describe('Type: number, BigNumber, Complex, DenseMatrix, Unit, string, boolean.'),
80
+ expression: z.string().describe('Original expression as received.'),
81
+ }),
82
+
83
+ handler(input, ctx) {
84
+ const config = getServerConfig();
85
+ const math = getMathService();
86
+ // Dispatch based on operation mode — see design doc for full error table
87
+ const result = math.evaluate(input.expression, input.scope);
88
+ ctx.log.info('Evaluated expression', { expression: input.expression });
89
+ return { result: String(result), resultType: typeof result, expression: input.expression };
90
+ },
91
+
92
+ format: (output) => [{
93
+ type: 'text',
94
+ text: `**Expression:** \`${output.expression}\`\n**Result:** ${output.result}\n**Type:** ${output.resultType}`,
95
+ }],
96
+ });
97
+ ```
98
+
99
+ ### Resource
100
+
101
+ ```ts
102
+ import { resource } from '@cyanheads/mcp-ts-core';
103
+ import { getMathService } from '@/services/math/math-service.js';
104
+
105
+ export const helpResource = resource('calculator://help', {
106
+ description: 'Available functions, operators, constants, and syntax reference.',
107
+ handler() {
108
+ const math = getMathService();
109
+ return math.getHelpContent();
110
+ },
111
+ });
112
+ ```
113
+
114
+ ### Server config
115
+
116
+ ```ts
117
+ // src/config/server-config.ts — lazy-parsed, separate from framework config
118
+ const ServerConfigSchema = z.object({
119
+ maxExpressionLength: z.coerce.number().int().min(10).max(10_000).default(1000)
120
+ .describe('Maximum allowed expression string length (10–10,000)'),
121
+ evaluationTimeoutMs: z.coerce.number().int().min(100).max(30_000).default(5000)
122
+ .describe('Maximum evaluation time in milliseconds (100–30,000)'),
123
+ maxResultLength: z.coerce.number().int().min(1_000).max(1_000_000).default(100_000)
124
+ .describe('Maximum result string length in characters (1,000–1,000,000)'),
125
+ });
126
+ let _config: z.infer<typeof ServerConfigSchema> | undefined;
127
+ export function getServerConfig() {
128
+ _config ??= ServerConfigSchema.parse({
129
+ maxExpressionLength: process.env.CALC_MAX_EXPRESSION_LENGTH,
130
+ evaluationTimeoutMs: process.env.CALC_EVALUATION_TIMEOUT_MS,
131
+ maxResultLength: process.env.CALC_MAX_RESULT_LENGTH,
132
+ });
133
+ return _config;
134
+ }
135
+ ```
136
+
137
+ | Env Var | Default | Description |
138
+ |:--------|:--------|:------------|
139
+ | `CALC_MAX_EXPRESSION_LENGTH` | `1000` | Max input string length |
140
+ | `CALC_EVALUATION_TIMEOUT_MS` | `5000` | Evaluation timeout in ms |
141
+ | `CALC_MAX_RESULT_LENGTH` | `100000` | Max result string length |
142
+
143
+ ---
144
+
145
+ ## Context
146
+
147
+ Handlers receive a unified `ctx` object. Key properties:
148
+
149
+ | Property | Description |
150
+ |:---------|:------------|
151
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
152
+ | `ctx.requestId` | Unique request ID. |
153
+ | `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
154
+
155
+ ---
156
+
157
+ ## Errors
158
+
159
+ Handlers throw — the framework catches, classifies, and formats. Three escalation levels:
160
+
161
+ ```ts
162
+ // 1. Plain Error — framework auto-classifies from message patterns
163
+ throw new Error('Item not found'); // → NotFound
164
+ throw new Error('Invalid query format'); // → ValidationError
165
+
166
+ // 2. Error factories — explicit code, concise
167
+ import { notFound, validationError, forbidden, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
168
+ throw notFound('Item not found', { itemId });
169
+ throw serviceUnavailable('API unavailable', { url }, { cause: err });
170
+
171
+ // 3. McpError — full control over code and data
172
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
173
+ throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
174
+ ```
175
+
176
+ Plain `Error` is fine for most cases. Use factories when the error code matters. See framework CLAUDE.md for the full auto-classification table and all available factories.
177
+
178
+ ---
179
+
180
+ ## Structure
181
+
182
+ ```text
183
+ src/
184
+ index.ts # createApp() entry point
185
+ config/
186
+ server-config.ts # Server-specific env vars (Zod schema)
187
+ services/
188
+ [domain]/
189
+ [domain]-service.ts # Domain service (init/accessor pattern)
190
+ types.ts # Domain types
191
+ mcp-server/
192
+ tools/definitions/
193
+ [tool-name].tool.ts # Tool definitions
194
+ resources/definitions/
195
+ [resource-name].resource.ts # Resource definitions
196
+ prompts/definitions/
197
+ [prompt-name].prompt.ts # Prompt definitions
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Naming
203
+
204
+ | What | Convention | Example |
205
+ |:-----|:-----------|:--------|
206
+ | Files | kebab-case with suffix | `search-docs.tool.ts` |
207
+ | Tool/resource/prompt names | snake_case | `search_docs` |
208
+ | Directories | kebab-case | `src/services/doc-search/` |
209
+ | Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
210
+
211
+ ---
212
+
213
+ ## Skills
214
+
215
+ Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
216
+
217
+ **Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). This makes skills available as context without needing to reference `skills/` paths manually. After framework updates, re-copy to pick up changes.
218
+
219
+ Available skills:
220
+
221
+ | Skill | Purpose |
222
+ |:------|:--------|
223
+ | `setup` | Post-init project orientation |
224
+ | `design-mcp-server` | Design tool surface, resources, and services for a new server |
225
+ | `add-tool` | Scaffold a new tool definition |
226
+ | `add-resource` | Scaffold a new resource definition |
227
+ | `add-prompt` | Scaffold a new prompt definition |
228
+ | `add-service` | Scaffold a new service integration |
229
+ | `add-test` | Scaffold test file for a tool, resource, or service |
230
+ | `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
231
+ | `devcheck` | Lint, format, typecheck, audit |
232
+ | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
233
+ | `maintenance` | Sync skills and dependencies after updates |
234
+ | `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
235
+ | `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
236
+ | `api-auth` | Auth modes, scopes, JWT/OAuth |
237
+ | `api-config` | AppConfig, parseConfig, env vars |
238
+ | `api-context` | Context interface, logger, state, progress |
239
+ | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
240
+ | `api-services` | LLM, Speech, Graph services |
241
+ | `api-testing` | createMockContext, test patterns |
242
+ | `api-utils` | Formatting, parsing, security, pagination, scheduling |
243
+ | `api-workers` | Cloudflare Workers runtime |
244
+ | `migrate-mcp-ts-template` | Migrate a template fork to use `@cyanheads/mcp-ts-core` as a package |
245
+
246
+ When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
247
+
248
+ ---
249
+
250
+ ## Commands
251
+
252
+ | Command | Purpose |
253
+ |:--------|:--------|
254
+ | `bun run build` | Compile TypeScript |
255
+ | `bun run rebuild` | Clean + build |
256
+ | `bun run clean` | Remove build artifacts |
257
+ | `bun run devcheck` | Lint + format + typecheck + security |
258
+ | `bun run tree` | Generate directory structure doc |
259
+ | `bun run format` | Auto-fix formatting |
260
+ | `bun run lint:mcp` | Validate MCP definitions |
261
+ | `bun run test` | Run tests |
262
+ | `bun run dev:stdio` | Dev mode (stdio) |
263
+ | `bun run dev:http` | Dev mode (HTTP) |
264
+ | `bun run start:stdio` | Production mode (stdio) |
265
+ | `bun run start:http` | Production mode (HTTP) |
266
+
267
+ ---
268
+
269
+ ## Publishing
270
+
271
+ ### Wrapup flow
272
+
273
+ When running the git wrapup checklist (`polish-docs-meta` or equivalent):
274
+
275
+ - **Minimum version bump is `0.0.1` (patch)** unless the user specifies a larger bump.
276
+ - After the final commit, **create an annotated tag** and **push** (tags included):
277
+
278
+ ```bash
279
+ git tag -a v<version> -m "v<version>"
280
+ git push && git push --tags
281
+ ```
282
+
283
+ ### npm + Docker
284
+
285
+ After tagging, publish to both npm and GHCR:
286
+
287
+ ```bash
288
+ bun publish --access public
289
+
290
+ docker buildx build --platform linux/amd64,linux/arm64 \
291
+ -t ghcr.io/cyanheads/calculator-mcp-server:<version> \
292
+ -t ghcr.io/cyanheads/calculator-mcp-server:latest \
293
+ --push .
294
+ ```
295
+
296
+ Remind the user to run the npm/Docker publish commands after completing a release flow.
297
+
298
+ ---
299
+
300
+ ## Imports
301
+
302
+ ```ts
303
+ // Framework — z is re-exported, no separate zod import needed
304
+ import { tool, z } from '@cyanheads/mcp-ts-core';
305
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
306
+
307
+ // Server's own code — via path alias
308
+ import { getMathService } from '@/services/math/math-service.js';
309
+ import { getServerConfig } from '@/config/server-config.js';
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Checklist
315
+
316
+ - [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, etc.)
317
+ - [ ] JSDoc `@fileoverview` + `@module` on every file
318
+ - [ ] `ctx.log` for logging, `ctx.state` for storage
319
+ - [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
320
+ - [ ] `format()` renders all data the LLM needs — `content[]` is the only field most clients forward to the model
321
+ - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
322
+ - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
323
+ - [ ] `bun run devcheck` passes
package/Dockerfile ADDED
@@ -0,0 +1,99 @@
1
+ # ==============================================================================
2
+ # Build Stage
3
+ #
4
+ # This stage installs all dependencies (including dev), builds the TypeScript
5
+ # source code into JavaScript, and prepares the production assets.
6
+ # ==============================================================================
7
+ FROM oven/bun:1 AS build
8
+
9
+ WORKDIR /usr/src/app
10
+
11
+ # Copy dependency manifests for optimized layer caching
12
+ COPY package.json bun.lock ./
13
+
14
+ # Install all dependencies (including dev dependencies for building)
15
+ RUN bun install --frozen-lockfile
16
+
17
+ # Copy the rest of the source code
18
+ COPY . .
19
+
20
+ # Build the application
21
+ RUN bun run build
22
+
23
+
24
+ # ==============================================================================
25
+ # Production Stage
26
+ #
27
+ # This stage creates a minimal, optimized, and secure image for running the
28
+ # application. It uses a slim base image and only includes production
29
+ # dependencies and build artifacts.
30
+ # ==============================================================================
31
+ FROM oven/bun:1-slim AS production
32
+
33
+ WORKDIR /usr/src/app
34
+
35
+ # Set the environment to production for performance and to ensure only
36
+ # production dependencies are installed.
37
+ ENV NODE_ENV=production
38
+
39
+ # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
40
+ LABEL org.opencontainers.image.title="calculator-mcp-server"
41
+ LABEL org.opencontainers.image.description="A calculator MCP server that lets any LLM verify mathematical computations. Evaluate, simplify, and differentiate expressions via a single tool. Powered by math.js v15."
42
+ LABEL org.opencontainers.image.source="https://github.com/cyanheads/calculator-mcp-server"
43
+ LABEL org.opencontainers.image.licenses="Apache-2.0"
44
+
45
+ # Copy dependency manifests
46
+ COPY package.json bun.lock ./
47
+
48
+ # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
49
+ # that are not needed in the final production image.
50
+ RUN bun install --production --frozen-lockfile --ignore-scripts
51
+
52
+ # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
53
+ # These are not bundled by default to keep the base image lean. Enable at build time
54
+ # with: docker build --build-arg OTEL_ENABLED=true
55
+ ARG OTEL_ENABLED=true
56
+ RUN if [ "$OTEL_ENABLED" = "true" ]; then \
57
+ bun add @hono/otel \
58
+ @opentelemetry/instrumentation-http \
59
+ @opentelemetry/exporter-metrics-otlp-http \
60
+ @opentelemetry/exporter-trace-otlp-http \
61
+ @opentelemetry/instrumentation-pino \
62
+ @opentelemetry/resources \
63
+ @opentelemetry/sdk-metrics \
64
+ @opentelemetry/sdk-node \
65
+ @opentelemetry/sdk-trace-node \
66
+ @opentelemetry/semantic-conventions; \
67
+ fi
68
+
69
+ # Copy the compiled application code from the build stage
70
+ COPY --from=build /usr/src/app/dist ./dist
71
+
72
+ # The 'oven/bun' image already provides a non-root user named 'bun'.
73
+ # We will use this existing user for enhanced security.
74
+
75
+ # Create and set permissions for the log directory, assigning ownership to the 'bun' user.
76
+ RUN mkdir -p /var/log/calculator-mcp-server && chown -R bun:bun /var/log/calculator-mcp-server
77
+
78
+ # Switch to the non-root user
79
+ USER bun
80
+
81
+ # Define an argument for the port, allowing it to be overridden at build time.
82
+ # The `PORT` variable is often injected by cloud environments at runtime.
83
+ ARG PORT
84
+
85
+ # Set runtime environment variables
86
+ # Note: PORT is an automatic variable in many cloud environments (e.g., Cloud Run)
87
+ ENV MCP_HTTP_PORT=${PORT:-3010}
88
+ ENV MCP_HTTP_HOST="0.0.0.0"
89
+ ENV MCP_TRANSPORT_TYPE="http"
90
+ ENV MCP_SESSION_MODE="stateless"
91
+ ENV MCP_LOG_LEVEL="info"
92
+ ENV LOGS_DIR="/var/log/calculator-mcp-server"
93
+ ENV MCP_FORCE_CONSOLE_LOGGING="true"
94
+
95
+ # Expose the port the server listens on
96
+ EXPOSE ${MCP_HTTP_PORT}
97
+
98
+ # The command to start the server
99
+ CMD ["bun", "run", "dist/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 cyanheads
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.