mcp-ts-template 1.6.0 → 1.6.2

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![TypeScript](https://img.shields.io/badge/TypeScript-^5.8.3-blue.svg)](https://www.typescriptlang.org/)
4
4
  [![Model Context Protocol SDK](https://img.shields.io/badge/MCP%20SDK-^1.13.0-green.svg)](https://github.com/modelcontextprotocol/typescript-sdk)
5
5
  [![MCP Spec Version](https://img.shields.io/badge/MCP%20Spec-2025--03--26-lightgrey.svg)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/changelog.mdx)
6
- [![Version](https://img.shields.io/badge/Version-1.6.0-blue.svg)](./CHANGELOG.md)
6
+ [![Version](https://img.shields.io/badge/Version-1.6.2-blue.svg)](./CHANGELOG.md)
7
7
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
8
8
  [![Status](https://img.shields.io/badge/Status-Stable-green.svg)](https://github.com/cyanheads/mcp-ts-template/issues)
9
9
  [![GitHub](https://img.shields.io/github/stars/cyanheads/mcp-ts-template?style=social)](https://github.com/cyanheads/mcp-ts-template)
@@ -31,7 +31,7 @@ export declare const config: {
31
31
  /** Logging level. From `MCP_LOG_LEVEL` env var. Default: "debug". */
32
32
  logLevel: string;
33
33
  /** Absolute path to the logs directory. From `LOGS_DIR` env var. */
34
- logsPath: string;
34
+ logsPath: string | null;
35
35
  /** Runtime environment. From `NODE_ENV` env var. Default: "development". */
36
36
  environment: string;
37
37
  /** MCP transport type ('stdio' or 'http'). From `MCP_TRANSPORT_TYPE` env var. Default: "stdio". */
@@ -224,12 +224,21 @@ const ensureDirectory = (dirPath, rootDir, dirName) => {
224
224
  };
225
225
  // --- End Directory Ensurance Function ---
226
226
  // --- Logs Directory Handling ---
227
- const validatedLogsPath = ensureDirectory(env.LOGS_DIR, projectRoot, "logs");
227
+ let validatedLogsPath = ensureDirectory(env.LOGS_DIR, projectRoot, "logs");
228
228
  if (!validatedLogsPath) {
229
229
  if (process.stdout.isTTY) {
230
- console.error("FATAL: Logs directory configuration is invalid or could not be created. Please check permissions and path. Exiting.");
230
+ console.warn(`Warning: Custom logs directory ('${env.LOGS_DIR}') is invalid or outside the project boundary. Falling back to default.`);
231
+ }
232
+ // Try again with the absolute default path
233
+ const defaultLogsDir = path.join(projectRoot, "logs");
234
+ validatedLogsPath = ensureDirectory(defaultLogsDir, projectRoot, "logs");
235
+ if (!validatedLogsPath) {
236
+ if (process.stdout.isTTY) {
237
+ // This is just a warning now, not fatal.
238
+ console.warn("Warning: Default logs directory could not be created. File logging will be disabled.");
239
+ }
240
+ // Do not exit. validatedLogsPath remains null, and the logger will handle it.
231
241
  }
232
- process.exit(1); // Exit if logs directory is not usable
233
242
  }
234
243
  // --- End Logs Directory Handling ---
235
244
  /**
@@ -35,9 +35,8 @@ const mcpToWinstonLevel = {
35
35
  alert: "error",
36
36
  emerg: "error",
37
37
  };
38
- // The logsPath from config is already resolved and validated by src/config/index.ts
39
- const resolvedLogsDir = config.logsPath;
40
- const isLogsDirSafe = !!resolvedLogsDir; // If logsPath is set, it's considered safe by config logic.
38
+ // The logsPath from config is resolved and validated by src/config/index.ts.
39
+ // It can be null if the directory is invalid or inaccessible, in which case file logging will be disabled.
41
40
  /**
42
41
  * Creates the Winston console log format.
43
42
  * @returns The Winston log format for console output.
@@ -107,10 +106,7 @@ export class Logger {
107
106
  this.initialized = true;
108
107
  this.currentMcpLevel = level;
109
108
  this.currentWinstonLevel = mcpToWinstonLevel[level];
110
- // The logs directory (config.logsPath / resolvedLogsDir) is expected to be created and validated
111
- // by the configuration module (src/config/index.ts) before logger initialization.
112
- // If isLogsDirSafe is true, we assume resolvedLogsDir exists and is usable.
113
- // No redundant directory creation logic here.
109
+ const resolvedLogsDir = config.logsPath;
114
110
  const fileFormat = winston.format.combine(winston.format.timestamp(), winston.format.errors({ stack: true }), winston.format.json());
115
111
  const transports = [];
116
112
  const fileTransportOptions = {
@@ -119,7 +115,7 @@ export class Logger {
119
115
  maxFiles: this.LOG_MAX_FILES,
120
116
  tailable: true,
121
117
  };
122
- if (isLogsDirSafe) {
118
+ if (resolvedLogsDir) {
123
119
  transports.push(new winston.transports.File({
124
120
  filename: path.join(resolvedLogsDir, "error.log"),
125
121
  level: "error",
@@ -152,7 +148,7 @@ export class Logger {
152
148
  exitOnError: false,
153
149
  });
154
150
  // Initialize a separate logger for structured interactions
155
- if (isLogsDirSafe) {
151
+ if (resolvedLogsDir) {
156
152
  this.interactionLogger = winston.createLogger({
157
153
  format: winston.format.combine(winston.format.timestamp(), winston.format.json({ space: 2 })),
158
154
  transports: [
@@ -179,7 +175,7 @@ export class Logger {
179
175
  loggerSetup: true,
180
176
  requestId: "logger-post-init",
181
177
  timestamp: new Date().toISOString(),
182
- logsPathUsed: resolvedLogsDir,
178
+ logsPathUsed: resolvedLogsDir ?? "none",
183
179
  });
184
180
  }
185
181
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-ts-template",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Jumpstart Model Context Protocol (MCP) development with this production-ready TypeScript template. Build robust MCP servers and clients with built-in utilities, authentication, and service integrations. Agent framework utilizing MCP Client included.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -36,19 +36,19 @@
36
36
  "db:duckdb-example": "MCP_LOG_LEVEL=debug tsc && node dist/storage/duckdbExample.js"
37
37
  },
38
38
  "dependencies": {
39
- "@duckdb/node-api": "^1.3.1-alpha.22",
40
- "@hono/node-server": "^1.14.4",
41
- "@modelcontextprotocol/sdk": "^1.13.1",
42
- "@supabase/supabase-js": "^2.50.1",
43
- "@types/node": "^24.0.3",
39
+ "@duckdb/node-api": "^1.3.1-alpha.23",
40
+ "@hono/node-server": "^1.15.0",
41
+ "@modelcontextprotocol/sdk": "^1.15.0",
42
+ "@supabase/supabase-js": "^2.50.3",
43
+ "@types/node": "^24.0.10",
44
44
  "@types/sanitize-html": "^2.16.0",
45
45
  "@types/validator": "13.15.2",
46
46
  "chrono-node": "^2.8.0",
47
- "dotenv": "^16.5.0",
48
- "hono": "^4.8.2",
47
+ "dotenv": "^16.6.1",
48
+ "hono": "^4.8.4",
49
49
  "ignore": "^7.0.5",
50
50
  "jose": "^6.0.11",
51
- "openai": "^5.7.0",
51
+ "openai": "^5.8.2",
52
52
  "partial-json": "^0.1.7",
53
53
  "sanitize-html": "^2.17.0",
54
54
  "tiktoken": "^1.0.21",
@@ -57,8 +57,9 @@
57
57
  "validator": "13.15.15",
58
58
  "winston": "^3.17.0",
59
59
  "winston-transport": "^4.9.0",
60
- "node-cron": "^4.1.1",
61
- "zod": "^3.25.67"
60
+ "node-cron": "^4.2.0",
61
+ "zod": "^3.25.74",
62
+ "js-yaml": "^4.1.0"
62
63
  },
63
64
  "keywords": [
64
65
  "typescript",
@@ -104,8 +105,7 @@
104
105
  "@types/node-cron": "^3.0.11",
105
106
  "axios": "^1.10.0",
106
107
  "depcheck": "^1.4.7",
107
- "js-yaml": "^4.1.0",
108
- "prettier": "^3.6.0",
109
- "typedoc": "^0.28.5"
108
+ "prettier": "^3.6.2",
109
+ "typedoc": "^0.28.7"
110
110
  }
111
111
  }