@j0hanz/filesystem-mcp 1.7.1 → 1.7.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.
@@ -1,4 +1,5 @@
1
1
  export declare function parseTrueEnvFlag(value: string | undefined): boolean;
2
+ export declare function parseEnvInt(envVar: string, defaultValue: number, min: number, max: number): number;
2
3
  export declare const DEFAULT_LOG_LEVEL: "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
3
4
  export declare const REQUIRED_MCP_PROTOCOL_VERSION = "2025-11-25";
4
5
  export declare const PARALLEL_CONCURRENCY: number;
@@ -12,7 +12,7 @@ function logInvalidEnvValue(envVar, value, expected, defaultValue) {
12
12
  console.error(`[WARNING] Invalid ${envVar} value: ${value} (must be ${expected}). Using default: ${String(defaultValue)}`);
13
13
  }
14
14
  // Helper for parsing environment variables (only used for configurable values)
15
- function parseEnvInt(envVar, defaultValue, min, max) {
15
+ export function parseEnvInt(envVar, defaultValue, min, max) {
16
16
  const value = process.env[envVar];
17
17
  if (!value)
18
18
  return defaultValue;
@@ -7,7 +7,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
7
7
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
8
8
  import { isInitializeRequest, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
9
9
  import { registerCompletions } from '../completions.js';
10
- import { DEFAULT_LOG_LEVEL, REQUIRED_MCP_PROTOCOL_VERSION, } from '../lib/constants.js';
10
+ import { DEFAULT_LOG_LEVEL, parseEnvInt, REQUIRED_MCP_PROTOCOL_VERSION, } from '../lib/constants.js';
11
11
  import { formatUnknownErrorMessage } from '../lib/errors.js';
12
12
  import { createInMemoryResourceStore } from '../lib/resource-store.js';
13
13
  import { pkgInfo } from '../pkg-info.js';
@@ -104,16 +104,14 @@ export async function startServer(server) {
104
104
  rootsManager.registerHandlers(server);
105
105
  await rootsManager.recomputeAllowedDirectories();
106
106
  await server.connect(transport);
107
- const transportAny = transport;
108
- const sdkOnClose = transportAny.onclose;
109
- transportAny.onclose = () => {
107
+ const sdkOnClose = transport.onclose;
108
+ transport.onclose = () => {
110
109
  rootsManager.destroy();
111
110
  sdkOnClose?.();
112
111
  };
113
112
  rootsManager.logMissingDirectoriesIfNeeded(server);
114
113
  }
115
- const MAX_REQUEST_BODY_BYTES = parseInt(process.env['FS_CONTEXT_MAX_REQUEST_BYTES'] ?? '', 10) ||
116
- 4 * 1024 * 1024; // 4 MB default
114
+ const MAX_REQUEST_BODY_BYTES = parseEnvInt('FS_CONTEXT_MAX_REQUEST_BYTES', 4 * 1024 * 1024, 1024, 256 * 1024 * 1024);
117
115
  class RequestBodyError extends Error {
118
116
  statusCode;
119
117
  constructor(message, statusCode) {
@@ -20,14 +20,16 @@ function getExperimentalTaskRegistration(server) {
20
20
  return tasks;
21
21
  }
22
22
  function hasTaskToolCapability(server) {
23
- const maybeServer = server;
24
- const serverRuntime = maybeServer.server;
25
- const capabilityGetter = serverRuntime?.getCapabilities;
26
- if (typeof capabilityGetter !== 'function') {
23
+ const serverRecord = server;
24
+ const { server: serverRuntime } = serverRecord;
25
+ if (!isRecord(serverRuntime))
26
+ return true;
27
+ const { getCapabilities } = serverRuntime;
28
+ if (typeof getCapabilities !== 'function') {
27
29
  // Fallback for tests or custom wrappers that provide only registerTool/experimental.
28
30
  return true;
29
31
  }
30
- const capabilities = capabilityGetter.call(serverRuntime);
32
+ const capabilities = getCapabilities.call(serverRuntime);
31
33
  if (!isRecord(capabilities))
32
34
  return false;
33
35
  const { tasks } = capabilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/filesystem-mcp",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "mcpName": "io.github.j0hanz/filesystem-mcp",
5
5
  "description": "MCP Server that enables LLMs to interact with the local filesystem.",
6
6
  "type": "module",