mcp-ts-template 2.3.2 → 2.3.4

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.
Files changed (3) hide show
  1. package/README.md +19 -1
  2. package/dist/index.js +159 -161
  3. package/package.json +18 -18
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div align="center">
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-2.3.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2025--06--18-8A2BE2.svg?style=flat-square)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-06-18/changelog.mdx) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.18.2-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Status](https://img.shields.io/badge/Status-Stable-brightgreen.svg?style=flat-square)](https://github.com/cyanheads/mcp-ts-template/issues) [![TypeScript](https://img.shields.io/badge/TypeScript-^5.9.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.2.23-blueviolet.svg?style=flat-square)](https://bun.sh/) [![Code Coverage](https://img.shields.io/badge/Coverage-87.74%25-brightgreen.svg?style=flat-square)](./coverage/lcov-report/)
8
+ [![Version](https://img.shields.io/badge/Version-2.3.4-blue.svg?style=flat-square)](./CHANGELOG.md) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2025--06--18-8A2BE2.svg?style=flat-square)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-06-18/changelog.mdx) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.19.1-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Status](https://img.shields.io/badge/Status-Stable-brightgreen.svg?style=flat-square)](https://github.com/cyanheads/mcp-ts-template/issues) [![TypeScript](https://img.shields.io/badge/TypeScript-^5.9.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.2.23-blueviolet.svg?style=flat-square)](https://bun.sh/) [![Code Coverage](https://img.shields.io/badge/Coverage-87.74%25-brightgreen.svg?style=flat-square)](./coverage/lcov-report/)
9
9
 
10
10
  </div>
11
11
 
@@ -26,6 +26,24 @@
26
26
 
27
27
  ## 🚀 Getting Started
28
28
 
29
+ ### MCP Client Settings/Configuration
30
+
31
+ Add the following to your MCP Client configuration file (e.g., `cline_mcp_settings.json`).
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "mcp-ts-template": {
37
+ "command": "bunx",
38
+ "args": ["mcp-ts-template@latest"],
39
+ "env": {
40
+ "MCP_LOG_LEVEL": "info"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
29
47
  ### Prerequisites
30
48
 
31
49
  - [Bun v1.2.0](https://bun.sh/) or higher.
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
38
38
  var require_package = __commonJS((exports, module) => {
39
39
  module.exports = {
40
40
  name: "dotenv",
41
- version: "17.2.2",
41
+ version: "17.2.3",
42
42
  description: "Loads environment variables from .env file",
43
43
  main: "lib/main.js",
44
44
  types: "lib/main.d.ts",
@@ -60,8 +60,8 @@ var require_package = __commonJS((exports, module) => {
60
60
  "dts-check": "tsc --project tests/types/tsconfig.json",
61
61
  lint: "standard",
62
62
  pretest: "npm run lint && npm run dts-check",
63
- test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
64
- "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
63
+ test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
64
+ "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
65
65
  prerelease: "npm test",
66
66
  release: "standard-version"
67
67
  },
@@ -112,9 +112,12 @@ var require_main = __commonJS((exports, module) => {
112
112
  "\uD83D\uDD10 encrypt with Dotenvx: https://dotenvx.com",
113
113
  "\uD83D\uDD10 prevent committing .env to code: https://dotenvx.com/precommit",
114
114
  "\uD83D\uDD10 prevent building .env in docker: https://dotenvx.com/prebuild",
115
- "\uD83D\uDCE1 observe env with Radar: https://dotenvx.com/radar",
116
- "\uD83D\uDCE1 auto-backup env with Radar: https://dotenvx.com/radar",
117
- "\uD83D\uDCE1 version env with Radar: https://dotenvx.com/radar",
115
+ "\uD83D\uDCE1 add observability to secrets: https://dotenvx.com/ops",
116
+ "\uD83D\uDC65 sync secrets across teammates & machines: https://dotenvx.com/ops",
117
+ "\uD83D\uDDC2️ backup and recover secrets: https://dotenvx.com/ops",
118
+ "✅ audit secrets and track compliance: https://dotenvx.com/ops",
119
+ "\uD83D\uDD04 add secrets lifecycle management: https://dotenvx.com/ops",
120
+ "\uD83D\uDD11 add access controls to secrets: https://dotenvx.com/ops",
118
121
  "\uD83D\uDEE0️ run anywhere with `dotenvx run -- yourcommand`",
119
122
  "⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
120
123
  "⚙️ enable debug logging with { debug: true }",
@@ -78941,17 +78944,7 @@ var require_tools = __commonJS((exports, module) => {
78941
78944
  } = require_symbols2();
78942
78945
  var { isMainThread } = __require("worker_threads");
78943
78946
  var transport = require_transport2();
78944
- var asJsonChan;
78945
- if (typeof diagChan.tracingChannel === "function") {
78946
- asJsonChan = diagChan.tracingChannel("pino_asJson");
78947
- } else {
78948
- asJsonChan = {
78949
- hasSubscribers: false,
78950
- traceSync(fn, store, thisArg, ...args) {
78951
- return fn.call(thisArg, ...args);
78952
- }
78953
- };
78954
- }
78947
+ var asJsonChan = diagChan.tracingChannel("pino_asJson");
78955
78948
  function noop() {}
78956
78949
  function genLog(level, hook) {
78957
78950
  if (!hook)
@@ -79114,7 +79107,7 @@ var require_tools = __commonJS((exports, module) => {
79114
79107
  bindings = formatter(bindings);
79115
79108
  for (const key in bindings) {
79116
79109
  value = bindings[key];
79117
- const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== undefined;
79110
+ const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== undefined;
79118
79111
  if (valid === true) {
79119
79112
  value = serializers[key] ? serializers[key](value) : value;
79120
79113
  value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
@@ -79442,7 +79435,7 @@ var require_levels = __commonJS((exports, module) => {
79442
79435
 
79443
79436
  // node_modules/pino/lib/meta.js
79444
79437
  var require_meta = __commonJS((exports, module) => {
79445
- module.exports = { version: "9.12.0" };
79438
+ module.exports = { version: "10.0.0" };
79446
79439
  });
79447
79440
 
79448
79441
  // node_modules/pino/lib/proto.js
@@ -79488,7 +79481,8 @@ var require_proto = __commonJS((exports, module) => {
79488
79481
  asChindings,
79489
79482
  asJson,
79490
79483
  buildFormatters,
79491
- stringify
79484
+ stringify,
79485
+ noop
79492
79486
  } = require_tools();
79493
79487
  var {
79494
79488
  version
@@ -79537,10 +79531,19 @@ var require_proto = __commonJS((exports, module) => {
79537
79531
  if (!bindings2) {
79538
79532
  throw Error("missing bindings for child Pino");
79539
79533
  }
79540
- options = options || {};
79541
79534
  const serializers = this[serializersSym];
79542
79535
  const formatters = this[formattersSym];
79543
79536
  const instance = Object.create(this);
79537
+ if (options == null) {
79538
+ if (instance[formattersSym].bindings !== resetChildingsFormatter) {
79539
+ instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
79540
+ }
79541
+ instance[chindingsSym] = asChindings(instance, bindings2);
79542
+ if (this.onChild !== noop) {
79543
+ this.onChild(instance);
79544
+ }
79545
+ return instance;
79546
+ }
79544
79547
  if (options.hasOwnProperty("serializers") === true) {
79545
79548
  instance[serializersSym] = Object.create(null);
79546
79549
  for (const k in serializers) {
@@ -79642,7 +79645,6 @@ var require_proto = __commonJS((exports, module) => {
79642
79645
  }
79643
79646
  stream.write(streamWriteHook ? streamWriteHook(s) : s);
79644
79647
  }
79645
- function noop() {}
79646
79648
  function flush(cb) {
79647
79649
  if (cb != null && typeof cb !== "function") {
79648
79650
  throw Error("callback must be a function");
@@ -117488,55 +117490,10 @@ var z = /* @__PURE__ */ Object.freeze({
117488
117490
  quotelessJson,
117489
117491
  ZodError
117490
117492
  });
117491
-
117492
- // src/types-global/errors.ts
117493
- var JsonRpcErrorCode;
117494
- ((JsonRpcErrorCode2) => {
117495
- JsonRpcErrorCode2[JsonRpcErrorCode2["ParseError"] = -32700] = "ParseError";
117496
- JsonRpcErrorCode2[JsonRpcErrorCode2["InvalidRequest"] = -32600] = "InvalidRequest";
117497
- JsonRpcErrorCode2[JsonRpcErrorCode2["MethodNotFound"] = -32601] = "MethodNotFound";
117498
- JsonRpcErrorCode2[JsonRpcErrorCode2["InvalidParams"] = -32602] = "InvalidParams";
117499
- JsonRpcErrorCode2[JsonRpcErrorCode2["InternalError"] = -32603] = "InternalError";
117500
- JsonRpcErrorCode2[JsonRpcErrorCode2["ServiceUnavailable"] = -32000] = "ServiceUnavailable";
117501
- JsonRpcErrorCode2[JsonRpcErrorCode2["NotFound"] = -32001] = "NotFound";
117502
- JsonRpcErrorCode2[JsonRpcErrorCode2["Conflict"] = -32002] = "Conflict";
117503
- JsonRpcErrorCode2[JsonRpcErrorCode2["RateLimited"] = -32003] = "RateLimited";
117504
- JsonRpcErrorCode2[JsonRpcErrorCode2["Timeout"] = -32004] = "Timeout";
117505
- JsonRpcErrorCode2[JsonRpcErrorCode2["Forbidden"] = -32005] = "Forbidden";
117506
- JsonRpcErrorCode2[JsonRpcErrorCode2["Unauthorized"] = -32006] = "Unauthorized";
117507
- JsonRpcErrorCode2[JsonRpcErrorCode2["ValidationError"] = -32007] = "ValidationError";
117508
- JsonRpcErrorCode2[JsonRpcErrorCode2["ConfigurationError"] = -32008] = "ConfigurationError";
117509
- JsonRpcErrorCode2[JsonRpcErrorCode2["InitializationFailed"] = -32009] = "InitializationFailed";
117510
- JsonRpcErrorCode2[JsonRpcErrorCode2["DatabaseError"] = -32010] = "DatabaseError";
117511
- JsonRpcErrorCode2[JsonRpcErrorCode2["SerializationError"] = -32070] = "SerializationError";
117512
- JsonRpcErrorCode2[JsonRpcErrorCode2["UnknownError"] = -32099] = "UnknownError";
117513
- })(JsonRpcErrorCode ||= {});
117514
-
117515
- class McpError extends Error {
117516
- code;
117517
- data;
117518
- constructor(code, message, data, options) {
117519
- super(message, options);
117520
- this.code = code;
117521
- if (data) {
117522
- this.data = data;
117523
- }
117524
- this.name = "McpError";
117525
- Object.setPrototypeOf(this, McpError.prototype);
117526
- if (Error.captureStackTrace) {
117527
- Error.captureStackTrace(this, McpError);
117528
- }
117529
- }
117530
- }
117531
- var ErrorSchema = z.object({
117532
- code: z.nativeEnum(JsonRpcErrorCode).describe("Standardized error code from JsonRpcErrorCode enum"),
117533
- message: z.string().min(1, "Error message cannot be empty.").describe("Detailed human-readable error message"),
117534
- data: z.record(z.string(), z.unknown()).optional().describe("Optional structured data providing more context about the error")
117535
- }).describe("Schema for validating structured error objects, ensuring consistency in error reporting.");
117536
117493
  // package.json
117537
117494
  var package_default = {
117538
117495
  name: "mcp-ts-template",
117539
- version: "2.3.0",
117496
+ version: "2.3.3",
117540
117497
  mcpName: "io.github.cyanheads/mcp-ts-template",
117541
117498
  description: "The definitive, production-grade template for building powerful and scalable Model Context Protocol (MCP) servers with TypeScript, featuring built-in observability (OpenTelemetry), declarative tooling, robust error handling, and a modular, DI-driven architecture.",
117542
117499
  main: "dist/index.js",
@@ -117567,30 +117524,27 @@ var package_default = {
117567
117524
  scripts: {
117568
117525
  build: "bun build ./src/index.ts --outdir ./dist --target node",
117569
117526
  "build:worker": "bun build ./src/worker.ts --outdir ./dist --target bun --no-external",
117570
- "deploy:dev": "bunx wrangler dev",
117571
- "deploy:prod": "bunx wrangler deploy",
117527
+ "deploy:dev": "MCP_TRANSPORT_TYPE=http bunx wrangler dev",
117528
+ "deploy:prod": "MCP_TRANSPORT_TYPE=http bunx wrangler deploy",
117572
117529
  start: "bun ./dist/index.js",
117573
- "start:stdio": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=stdio bun ./dist/index.js",
117574
- "start:http": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=http bun ./dist/index.js",
117575
- "start:agent": "MCP_LOG_LEVEL=debug bun ./dist/agent/cli/boot.js",
117530
+ "start:stdio": "MCP_TRANSPORT_TYPE=stdio bun ./dist/index.js",
117531
+ "start:http": "MCP_TRANSPORT_TYPE=http bun ./dist/index.js",
117576
117532
  dev: "bun --watch src/index.ts",
117577
117533
  "dev:stdio": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=stdio bun --watch src/index.ts",
117578
117534
  "dev:http": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=http bun --watch src/index.ts",
117579
- "dev:agent": "MCP_LOG_LEVEL=debug bun --watch src/agent/cli/boot.ts",
117580
117535
  devdocs: "bun run scripts/devdocs.ts",
117581
117536
  devcheck: "bun run scripts/devcheck.ts",
117582
117537
  rebuild: "bun run scripts/clean.ts && bun run build",
117583
- "docs:generate": "typedoc",
117538
+ "docs:generate": "bunx typedoc",
117584
117539
  depcheck: "bunx depcheck",
117585
- lint: "eslint .",
117586
- "lint:fix": "eslint . --fix",
117587
- typecheck: "tsc --noEmit",
117540
+ lint: "bunx eslint .",
117541
+ "lint:fix": "bunx eslint . --fix",
117542
+ typecheck: "bunx tsc --noEmit",
117588
117543
  tree: "bun run scripts/tree.ts",
117589
117544
  "fetch-spec": "bun run scripts/fetch-openapi-spec.ts",
117590
- format: 'bun run prettier --write "**/*.{ts,js,json,md,html,css}"',
117591
- prepare: "[ -d .husky ] && husky || true",
117545
+ format: 'bunx prettier --write "**/*.{ts,js,json,md,html,css}"',
117546
+ prepare: "bunx husky",
117592
117547
  inspector: "bunx mcp-inspector --config mcp.json --server mcp-ts-template",
117593
- "db:duckdb-example": "MCP_LOG_LEVEL=debug tsc && node dist/storage/duckdbExample.js",
117594
117548
  test: "bun test --config vitest.config.ts",
117595
117549
  "test:coverage": "bun test --coverage",
117596
117550
  audit: "bun audit",
@@ -117600,41 +117554,38 @@ var package_default = {
117600
117554
  resolutions: {
117601
117555
  "@hono/node-server": "1.19.5",
117602
117556
  "chrono-node": "2.9.0",
117603
- dotenv: "17.2.2",
117557
+ dotenv: "17.2.3",
117604
117558
  hono: "4.9.9",
117605
117559
  zod: "3.23.8",
117606
- typescript: "5.9.2"
117560
+ typescript: "5.9.3"
117607
117561
  },
117608
117562
  dependencies: {
117609
117563
  "@hono/mcp": "^0.1.4",
117610
117564
  "@hono/node-server": "^1.19.5",
117611
- "@modelcontextprotocol/sdk": "^1.18.2",
117565
+ "@modelcontextprotocol/sdk": "^1.19.1",
117612
117566
  "@supabase/supabase-js": "^2.58.0",
117613
117567
  axios: "^1.12.2",
117614
117568
  "chrono-node": "^2.9.0",
117615
- dotenv: "^17.2.2",
117616
- "fast-xml-parser": "^5.2.5",
117569
+ dotenv: "^17.2.3",
117570
+ "fast-xml-parser": "^5.3.0",
117617
117571
  hono: "^4.9.9",
117618
117572
  ignore: "^7.0.5",
117619
117573
  jose: "^6.1.0",
117620
117574
  "js-yaml": "^4.1.0",
117621
117575
  "node-cron": "^4.2.1",
117622
- openai: "^6.0.0",
117576
+ openai: "^6.1.0",
117623
117577
  papaparse: "^5.5.3",
117624
117578
  "partial-json": "^0.1.7",
117625
117579
  "pdf-lib": "^1.17.1",
117626
- pino: "^9.12.0",
117580
+ pino: "^10.0.0",
117581
+ "pino-pretty": "^13.1.1",
117627
117582
  "reflect-metadata": "^0.2.2",
117628
- repomix: "^1.6.0",
117583
+ repomix: "^1.6.1",
117629
117584
  "sanitize-html": "^2.17.0",
117630
117585
  tslib: "^2.8.1",
117631
117586
  tsyringe: "^4.10.0",
117632
117587
  validator: "13.15.15",
117633
- zod: "^3.23.8"
117634
- },
117635
- devDependencies: {
117636
- "@cloudflare/workers-types": "^4.20250927.0",
117637
- "@eslint/js": "^9.36.0",
117588
+ zod: "^3.23.8",
117638
117589
  "@opentelemetry/api": "^1.9.0",
117639
117590
  "@opentelemetry/auto-instrumentations-node": "^0.64.6",
117640
117591
  "@opentelemetry/exporter-metrics-otlp-http": "^0.205.0",
@@ -117644,10 +117595,14 @@ var package_default = {
117644
117595
  "@opentelemetry/sdk-metrics": "^2.1.0",
117645
117596
  "@opentelemetry/sdk-node": "^0.205.0",
117646
117597
  "@opentelemetry/sdk-trace-node": "^2.1.0",
117647
- "@opentelemetry/semantic-conventions": "^1.37.0",
117598
+ "@opentelemetry/semantic-conventions": "^1.37.0"
117599
+ },
117600
+ devDependencies: {
117601
+ "@cloudflare/workers-types": "^4.20251004.0",
117602
+ "@eslint/js": "^9.37.0",
117648
117603
  "@types/bun": "^1.2.23",
117649
117604
  "@types/js-yaml": "^4.0.9",
117650
- "@types/node": "^24.6.0",
117605
+ "@types/node": "^24.6.2",
117651
117606
  "@types/node-cron": "^3.0.11",
117652
117607
  "@types/papaparse": "^5.3.16",
117653
117608
  "@types/sanitize-html": "^2.16.0",
@@ -117658,17 +117613,16 @@ var package_default = {
117658
117613
  "bun-types": "^1.2.23",
117659
117614
  clipboardy: "^5.0.0",
117660
117615
  depcheck: "^1.4.7",
117661
- eslint: "^9.36.0",
117616
+ eslint: "^9.37.0",
117662
117617
  execa: "^9.6.0",
117663
117618
  globals: "^16.4.0",
117664
117619
  husky: "^9.1.7",
117665
117620
  msw: "^2.11.3",
117666
- "pino-pretty": "^13.1.1",
117667
117621
  prettier: "^3.6.2",
117668
117622
  typedoc: "^0.28.13",
117669
- typescript: "^5.9.3",
117623
+ typescript: "^5.9.2",
117670
117624
  "typescript-eslint": "8.45.0",
117671
- vite: "^7.1.7",
117625
+ vite: "^7.1.9",
117672
117626
  "vite-tsconfig-paths": "^5.1.4",
117673
117627
  vitest: "^3.2.4"
117674
117628
  },
@@ -117721,6 +117675,51 @@ var package_default = {
117721
117675
  }
117722
117676
  };
117723
117677
 
117678
+ // src/types-global/errors.ts
117679
+ var JsonRpcErrorCode;
117680
+ ((JsonRpcErrorCode2) => {
117681
+ JsonRpcErrorCode2[JsonRpcErrorCode2["ParseError"] = -32700] = "ParseError";
117682
+ JsonRpcErrorCode2[JsonRpcErrorCode2["InvalidRequest"] = -32600] = "InvalidRequest";
117683
+ JsonRpcErrorCode2[JsonRpcErrorCode2["MethodNotFound"] = -32601] = "MethodNotFound";
117684
+ JsonRpcErrorCode2[JsonRpcErrorCode2["InvalidParams"] = -32602] = "InvalidParams";
117685
+ JsonRpcErrorCode2[JsonRpcErrorCode2["InternalError"] = -32603] = "InternalError";
117686
+ JsonRpcErrorCode2[JsonRpcErrorCode2["ServiceUnavailable"] = -32000] = "ServiceUnavailable";
117687
+ JsonRpcErrorCode2[JsonRpcErrorCode2["NotFound"] = -32001] = "NotFound";
117688
+ JsonRpcErrorCode2[JsonRpcErrorCode2["Conflict"] = -32002] = "Conflict";
117689
+ JsonRpcErrorCode2[JsonRpcErrorCode2["RateLimited"] = -32003] = "RateLimited";
117690
+ JsonRpcErrorCode2[JsonRpcErrorCode2["Timeout"] = -32004] = "Timeout";
117691
+ JsonRpcErrorCode2[JsonRpcErrorCode2["Forbidden"] = -32005] = "Forbidden";
117692
+ JsonRpcErrorCode2[JsonRpcErrorCode2["Unauthorized"] = -32006] = "Unauthorized";
117693
+ JsonRpcErrorCode2[JsonRpcErrorCode2["ValidationError"] = -32007] = "ValidationError";
117694
+ JsonRpcErrorCode2[JsonRpcErrorCode2["ConfigurationError"] = -32008] = "ConfigurationError";
117695
+ JsonRpcErrorCode2[JsonRpcErrorCode2["InitializationFailed"] = -32009] = "InitializationFailed";
117696
+ JsonRpcErrorCode2[JsonRpcErrorCode2["DatabaseError"] = -32010] = "DatabaseError";
117697
+ JsonRpcErrorCode2[JsonRpcErrorCode2["SerializationError"] = -32070] = "SerializationError";
117698
+ JsonRpcErrorCode2[JsonRpcErrorCode2["UnknownError"] = -32099] = "UnknownError";
117699
+ })(JsonRpcErrorCode ||= {});
117700
+
117701
+ class McpError extends Error {
117702
+ code;
117703
+ data;
117704
+ constructor(code, message, data, options) {
117705
+ super(message, options);
117706
+ this.code = code;
117707
+ if (data) {
117708
+ this.data = data;
117709
+ }
117710
+ this.name = "McpError";
117711
+ Object.setPrototypeOf(this, McpError.prototype);
117712
+ if (Error.captureStackTrace) {
117713
+ Error.captureStackTrace(this, McpError);
117714
+ }
117715
+ }
117716
+ }
117717
+ var ErrorSchema = z.object({
117718
+ code: z.nativeEnum(JsonRpcErrorCode).describe("Standardized error code from JsonRpcErrorCode enum"),
117719
+ message: z.string().min(1, "Error message cannot be empty.").describe("Detailed human-readable error message"),
117720
+ data: z.record(z.string(), z.unknown()).optional().describe("Optional structured data providing more context about the error")
117721
+ }).describe("Schema for validating structured error objects, ensuring consistency in error reporting.");
117722
+
117724
117723
  // src/config/index.ts
117725
117724
  var packageManifest = package_default;
117726
117725
  var hasFileSystemAccess = typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.node === "string";
@@ -119784,7 +119783,7 @@ var safeJSON = (text) => {
119784
119783
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
119785
119784
 
119786
119785
  // node_modules/openai/version.mjs
119787
- var VERSION = "6.0.0";
119786
+ var VERSION = "6.1.0";
119788
119787
 
119789
119788
  // node_modules/openai/internal/detect-platform.mjs
119790
119789
  var isRunningInBrowser = () => {
@@ -123818,6 +123817,37 @@ class Moderations extends APIResource {
123818
123817
  return this._client.post("/moderations", { body, ...options });
123819
123818
  }
123820
123819
  }
123820
+ // node_modules/openai/resources/realtime/calls.mjs
123821
+ class Calls extends APIResource {
123822
+ accept(callID, body, options) {
123823
+ return this._client.post(path`/realtime/calls/${callID}/accept`, {
123824
+ body,
123825
+ ...options,
123826
+ headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
123827
+ });
123828
+ }
123829
+ hangup(callID, options) {
123830
+ return this._client.post(path`/realtime/calls/${callID}/hangup`, {
123831
+ ...options,
123832
+ headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
123833
+ });
123834
+ }
123835
+ refer(callID, body, options) {
123836
+ return this._client.post(path`/realtime/calls/${callID}/refer`, {
123837
+ body,
123838
+ ...options,
123839
+ headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
123840
+ });
123841
+ }
123842
+ reject(callID, body = {}, options) {
123843
+ return this._client.post(path`/realtime/calls/${callID}/reject`, {
123844
+ body,
123845
+ ...options,
123846
+ headers: buildHeaders([{ Accept: "*/*" }, options?.headers])
123847
+ });
123848
+ }
123849
+ }
123850
+
123821
123851
  // node_modules/openai/resources/realtime/client-secrets.mjs
123822
123852
  class ClientSecrets extends APIResource {
123823
123853
  create(body, options) {
@@ -123830,9 +123860,11 @@ class Realtime2 extends APIResource {
123830
123860
  constructor() {
123831
123861
  super(...arguments);
123832
123862
  this.clientSecrets = new ClientSecrets(this._client);
123863
+ this.calls = new Calls(this._client);
123833
123864
  }
123834
123865
  }
123835
123866
  Realtime2.ClientSecrets = ClientSecrets;
123867
+ Realtime2.Calls = Calls;
123836
123868
  // node_modules/openai/lib/ResponsesParser.mjs
123837
123869
  function maybeParseResponse(response, params) {
123838
123870
  if (!params || !hasAutoParseableInput2(params)) {
@@ -126705,12 +126737,7 @@ var allResourceDefinitions = [echoResourceDefinition];
126705
126737
 
126706
126738
  // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
126707
126739
  var LATEST_PROTOCOL_VERSION = "2025-06-18";
126708
- var SUPPORTED_PROTOCOL_VERSIONS = [
126709
- LATEST_PROTOCOL_VERSION,
126710
- "2025-03-26",
126711
- "2024-11-05",
126712
- "2024-10-07"
126713
- ];
126740
+ var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-03-26", "2024-11-05", "2024-10-07"];
126714
126741
  var JSONRPC_VERSION = "2.0";
126715
126742
  var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
126716
126743
  var CursorSchema = z.string();
@@ -126770,12 +126797,7 @@ var JSONRPCErrorSchema = z.object({
126770
126797
  })
126771
126798
  }).strict();
126772
126799
  var isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
126773
- var JSONRPCMessageSchema = z.union([
126774
- JSONRPCRequestSchema,
126775
- JSONRPCNotificationSchema,
126776
- JSONRPCResponseSchema,
126777
- JSONRPCErrorSchema
126778
- ]);
126800
+ var JSONRPCMessageSchema = z.union([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]);
126779
126801
  var EmptyResultSchema = ResultSchema.strict();
126780
126802
  var CancelledNotificationSchema = NotificationSchema.extend({
126781
126803
  method: z.literal("notifications/cancelled"),
@@ -126787,7 +126809,10 @@ var CancelledNotificationSchema = NotificationSchema.extend({
126787
126809
  var IconSchema = z.object({
126788
126810
  src: z.string(),
126789
126811
  mimeType: z.optional(z.string()),
126790
- sizes: z.optional(z.string())
126812
+ sizes: z.optional(z.array(z.string()))
126813
+ }).passthrough();
126814
+ var IconsSchema = z.object({
126815
+ icons: z.array(IconSchema).optional()
126791
126816
  }).passthrough();
126792
126817
  var BaseMetadataSchema = z.object({
126793
126818
  name: z.string(),
@@ -126795,9 +126820,8 @@ var BaseMetadataSchema = z.object({
126795
126820
  }).passthrough();
126796
126821
  var ImplementationSchema = BaseMetadataSchema.extend({
126797
126822
  version: z.string(),
126798
- websiteUrl: z.optional(z.string()),
126799
- icons: z.optional(z.array(IconSchema))
126800
- });
126823
+ websiteUrl: z.optional(z.string())
126824
+ }).merge(IconsSchema);
126801
126825
  var ClientCapabilitiesSchema = z.object({
126802
126826
  experimental: z.optional(z.object({}).passthrough()),
126803
126827
  sampling: z.optional(z.object({}).passthrough()),
@@ -126884,15 +126908,14 @@ var ResourceSchema = BaseMetadataSchema.extend({
126884
126908
  uri: z.string(),
126885
126909
  description: z.optional(z.string()),
126886
126910
  mimeType: z.optional(z.string()),
126887
- icons: z.optional(z.array(IconSchema)),
126888
126911
  _meta: z.optional(z.object({}).passthrough())
126889
- });
126912
+ }).merge(IconsSchema);
126890
126913
  var ResourceTemplateSchema = BaseMetadataSchema.extend({
126891
126914
  uriTemplate: z.string(),
126892
126915
  description: z.optional(z.string()),
126893
126916
  mimeType: z.optional(z.string()),
126894
126917
  _meta: z.optional(z.object({}).passthrough())
126895
- });
126918
+ }).merge(IconsSchema);
126896
126919
  var ListResourcesRequestSchema = PaginatedRequestSchema.extend({
126897
126920
  method: z.literal("resources/list")
126898
126921
  });
@@ -126943,9 +126966,8 @@ var PromptArgumentSchema = z.object({
126943
126966
  var PromptSchema = BaseMetadataSchema.extend({
126944
126967
  description: z.optional(z.string()),
126945
126968
  arguments: z.optional(z.array(PromptArgumentSchema)),
126946
- icons: z.optional(z.array(IconSchema)),
126947
126969
  _meta: z.optional(z.object({}).passthrough())
126948
- });
126970
+ }).merge(IconsSchema);
126949
126971
  var ListPromptsRequestSchema = PaginatedRequestSchema.extend({
126950
126972
  method: z.literal("prompts/list")
126951
126973
  });
@@ -127022,9 +127044,8 @@ var ToolSchema = BaseMetadataSchema.extend({
127022
127044
  required: z.optional(z.array(z.string()))
127023
127045
  }).passthrough()),
127024
127046
  annotations: z.optional(ToolAnnotationsSchema),
127025
- icons: z.optional(z.array(IconSchema)),
127026
127047
  _meta: z.optional(z.object({}).passthrough())
127027
- });
127048
+ }).merge(IconsSchema);
127028
127049
  var ListToolsRequestSchema = PaginatedRequestSchema.extend({
127029
127050
  method: z.literal("tools/list")
127030
127051
  });
@@ -127049,16 +127070,7 @@ var CallToolRequestSchema = RequestSchema.extend({
127049
127070
  var ToolListChangedNotificationSchema = NotificationSchema.extend({
127050
127071
  method: z.literal("notifications/tools/list_changed")
127051
127072
  });
127052
- var LoggingLevelSchema = z.enum([
127053
- "debug",
127054
- "info",
127055
- "notice",
127056
- "warning",
127057
- "error",
127058
- "critical",
127059
- "alert",
127060
- "emergency"
127061
- ]);
127073
+ var LoggingLevelSchema = z.enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
127062
127074
  var SetLevelRequestSchema = RequestSchema.extend({
127063
127075
  method: z.literal("logging/setLevel"),
127064
127076
  params: BaseRequestParamsSchema.extend({
@@ -127103,11 +127115,7 @@ var CreateMessageResultSchema = ResultSchema.extend({
127103
127115
  model: z.string(),
127104
127116
  stopReason: z.optional(z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string())),
127105
127117
  role: z.enum(["user", "assistant"]),
127106
- content: z.discriminatedUnion("type", [
127107
- TextContentSchema,
127108
- ImageContentSchema,
127109
- AudioContentSchema
127110
- ])
127118
+ content: z.discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema])
127111
127119
  });
127112
127120
  var BooleanSchemaSchema = z.object({
127113
127121
  type: z.literal("boolean"),
@@ -127137,12 +127145,7 @@ var EnumSchemaSchema = z.object({
127137
127145
  enum: z.array(z.string()),
127138
127146
  enumNames: z.optional(z.array(z.string()))
127139
127147
  }).passthrough();
127140
- var PrimitiveSchemaDefinitionSchema = z.union([
127141
- BooleanSchemaSchema,
127142
- StringSchemaSchema,
127143
- NumberSchemaSchema,
127144
- EnumSchemaSchema
127145
- ]);
127148
+ var PrimitiveSchemaDefinitionSchema = z.union([BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema]);
127146
127149
  var ElicitRequestSchema = RequestSchema.extend({
127147
127150
  method: z.literal("elicitation/create"),
127148
127151
  params: BaseRequestParamsSchema.extend({
@@ -127221,18 +127224,8 @@ var ClientNotificationSchema = z.union([
127221
127224
  InitializedNotificationSchema,
127222
127225
  RootsListChangedNotificationSchema
127223
127226
  ]);
127224
- var ClientResultSchema = z.union([
127225
- EmptyResultSchema,
127226
- CreateMessageResultSchema,
127227
- ElicitResultSchema,
127228
- ListRootsResultSchema
127229
- ]);
127230
- var ServerRequestSchema = z.union([
127231
- PingRequestSchema,
127232
- CreateMessageRequestSchema,
127233
- ElicitRequestSchema,
127234
- ListRootsRequestSchema
127235
- ]);
127227
+ var ClientResultSchema = z.union([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
127228
+ var ServerRequestSchema = z.union([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
127236
127229
  var ServerNotificationSchema = z.union([
127237
127230
  CancelledNotificationSchema,
127238
127231
  ProgressNotificationSchema,
@@ -127304,7 +127297,10 @@ class Protocol {
127304
127297
  const totalElapsed = Date.now() - info.startTime;
127305
127298
  if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
127306
127299
  this._timeoutInfo.delete(messageId);
127307
- throw new McpError2(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", { maxTotalTimeout: info.maxTotalTimeout, totalElapsed });
127300
+ throw new McpError2(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
127301
+ maxTotalTimeout: info.maxTotalTimeout,
127302
+ totalElapsed
127303
+ });
127308
127304
  }
127309
127305
  clearTimeout(info.timeoutId);
127310
127306
  info.timeoutId = setTimeout(info.onTimeout, info.timeout);
@@ -129356,7 +129352,9 @@ class McpServer {
129356
129352
  _meta: tool._meta
129357
129353
  };
129358
129354
  if (tool.outputSchema) {
129359
- toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, { strictUnions: true });
129355
+ toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, {
129356
+ strictUnions: true
129357
+ });
129360
129358
  }
129361
129359
  return toolDefinition;
129362
129360
  })
@@ -129998,7 +129996,7 @@ class ResourceRegistry {
129998
129996
  }
129999
129997
  ResourceRegistry = __legacyDecorateClassTS([
130000
129998
  import_tsyringe9.injectable(),
130001
- __legacyDecorateParamTS(0, import_tsyringe9.injectAll(ResourceDefinitions)),
129999
+ __legacyDecorateParamTS(0, import_tsyringe9.injectAll(ResourceDefinitions, { isOptional: true })),
130002
130000
  __legacyMetadataTS("design:paramtypes", [
130003
130001
  Array
130004
130002
  ])
@@ -130700,7 +130698,7 @@ class ToolRegistry {
130700
130698
  }
130701
130699
  ToolRegistry = __legacyDecorateClassTS([
130702
130700
  import_tsyringe12.injectable(),
130703
- __legacyDecorateParamTS(0, import_tsyringe12.injectAll(ToolDefinitions)),
130701
+ __legacyDecorateParamTS(0, import_tsyringe12.injectAll(ToolDefinitions, { isOptional: true })),
130704
130702
  __legacyMetadataTS("design:paramtypes", [
130705
130703
  Array
130706
130704
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-ts-template",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "mcpName": "io.github.cyanheads/mcp-ts-template",
5
5
  "description": "The definitive, production-grade template for building powerful and scalable Model Context Protocol (MCP) servers with TypeScript, featuring built-in observability (OpenTelemetry), declarative tooling, robust error handling, and a modular, DI-driven architecture.",
6
6
  "main": "dist/index.js",
@@ -61,41 +61,38 @@
61
61
  "resolutions": {
62
62
  "@hono/node-server": "1.19.5",
63
63
  "chrono-node": "2.9.0",
64
- "dotenv": "17.2.2",
64
+ "dotenv": "17.2.3",
65
65
  "hono": "4.9.9",
66
66
  "zod": "3.23.8",
67
- "typescript": "5.9.2"
67
+ "typescript": "5.9.3"
68
68
  },
69
69
  "dependencies": {
70
70
  "@hono/mcp": "^0.1.4",
71
71
  "@hono/node-server": "^1.19.5",
72
- "@modelcontextprotocol/sdk": "^1.18.2",
72
+ "@modelcontextprotocol/sdk": "^1.19.1",
73
73
  "@supabase/supabase-js": "^2.58.0",
74
74
  "axios": "^1.12.2",
75
75
  "chrono-node": "^2.9.0",
76
- "dotenv": "^17.2.2",
77
- "fast-xml-parser": "^5.2.5",
76
+ "dotenv": "^17.2.3",
77
+ "fast-xml-parser": "^5.3.0",
78
78
  "hono": "^4.9.9",
79
79
  "ignore": "^7.0.5",
80
80
  "jose": "^6.1.0",
81
81
  "js-yaml": "^4.1.0",
82
82
  "node-cron": "^4.2.1",
83
- "openai": "^6.0.1",
83
+ "openai": "^6.1.0",
84
84
  "papaparse": "^5.5.3",
85
85
  "partial-json": "^0.1.7",
86
86
  "pdf-lib": "^1.17.1",
87
- "pino": "^9.12.0",
87
+ "pino": "^10.0.0",
88
+ "pino-pretty": "^13.1.1",
88
89
  "reflect-metadata": "^0.2.2",
89
- "repomix": "^1.6.0",
90
+ "repomix": "^1.6.1",
90
91
  "sanitize-html": "^2.17.0",
91
92
  "tslib": "^2.8.1",
92
93
  "tsyringe": "^4.10.0",
93
94
  "validator": "13.15.15",
94
- "zod": "^3.23.8"
95
- },
96
- "devDependencies": {
97
- "@cloudflare/workers-types": "^4.20251001.0",
98
- "@eslint/js": "^9.36.0",
95
+ "zod": "^3.23.8",
99
96
  "@opentelemetry/api": "^1.9.0",
100
97
  "@opentelemetry/auto-instrumentations-node": "^0.64.6",
101
98
  "@opentelemetry/exporter-metrics-otlp-http": "^0.205.0",
@@ -105,7 +102,11 @@
105
102
  "@opentelemetry/sdk-metrics": "^2.1.0",
106
103
  "@opentelemetry/sdk-node": "^0.205.0",
107
104
  "@opentelemetry/sdk-trace-node": "^2.1.0",
108
- "@opentelemetry/semantic-conventions": "^1.37.0",
105
+ "@opentelemetry/semantic-conventions": "^1.37.0"
106
+ },
107
+ "devDependencies": {
108
+ "@cloudflare/workers-types": "^4.20251004.0",
109
+ "@eslint/js": "^9.37.0",
109
110
  "@types/bun": "^1.2.23",
110
111
  "@types/js-yaml": "^4.0.9",
111
112
  "@types/node": "^24.6.2",
@@ -119,17 +120,16 @@
119
120
  "bun-types": "^1.2.23",
120
121
  "clipboardy": "^5.0.0",
121
122
  "depcheck": "^1.4.7",
122
- "eslint": "^9.36.0",
123
+ "eslint": "^9.37.0",
123
124
  "execa": "^9.6.0",
124
125
  "globals": "^16.4.0",
125
126
  "husky": "^9.1.7",
126
127
  "msw": "^2.11.3",
127
- "pino-pretty": "^13.1.1",
128
128
  "prettier": "^3.6.2",
129
129
  "typedoc": "^0.28.13",
130
130
  "typescript": "^5.9.2",
131
131
  "typescript-eslint": "8.45.0",
132
- "vite": "^7.1.8",
132
+ "vite": "^7.1.9",
133
133
  "vite-tsconfig-paths": "^5.1.4",
134
134
  "vitest": "^3.2.4"
135
135
  },