@j0hanz/filesystem-mcp 1.18.0 → 1.19.0

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/dist/resources.js CHANGED
@@ -1,5 +1,4 @@
1
- import { ResourceTemplate, } from '@modelcontextprotocol/server';
2
- import { ErrorCode, McpError } from './lib/errors.js';
1
+ import { ProtocolError, ProtocolErrorCode, ResourceTemplate, } from '@modelcontextprotocol/server';
3
2
  import { globalMetrics } from './lib/observability.js';
4
3
  import { buildToolCatalog } from './resources/tool-catalog.js';
5
4
  import { buildToolInfo, getToolContracts } from './resources/tool-info.js';
@@ -104,7 +103,7 @@ export function registerResultResources(server, store, iconInfo) {
104
103
  }, iconInfo), (uri, variables) => {
105
104
  const { id } = variables;
106
105
  if (typeof id !== 'string' || id.length === 0) {
107
- throw new McpError(ErrorCode.NOT_FOUND, 'Cached result expired. Re-run the tool to regenerate.');
106
+ throw new ProtocolError(ProtocolErrorCode.ResourceNotFound, 'Cached result expired. Re-run the tool to regenerate.');
108
107
  }
109
108
  const entry = store.getText(uri.toString());
110
109
  return {
@@ -130,11 +129,11 @@ export function registerToolInfoResource(server, iconInfo) {
130
129
  }, iconInfo), (uri, variables) => {
131
130
  const { name } = variables;
132
131
  if (typeof name !== 'string' || name.length === 0) {
133
- throw new McpError(ErrorCode.INVALID_INPUT, 'Tool name is required');
132
+ throw new ProtocolError(ProtocolErrorCode.InvalidParams, 'Tool name is required');
134
133
  }
135
134
  const content = buildToolInfo(name);
136
135
  if (content === undefined) {
137
- throw new McpError(ErrorCode.INVALID_INPUT, `Tool not found: ${name}`);
136
+ throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Tool not found: ${name}`);
138
137
  }
139
138
  return {
140
139
  contents: [
@@ -1,5 +1,5 @@
1
1
  import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
2
- import { InMemoryTaskMessageQueue, isInitializeRequest, localhostAllowedHostnames, McpServer, StdioServerTransport, validateHostHeader, } from '@modelcontextprotocol/server';
2
+ import { InMemoryTaskMessageQueue, isInitializeRequest, localhostAllowedHostnames, McpServer, ProtocolErrorCode, StdioServerTransport, validateHostHeader, } from '@modelcontextprotocol/server';
3
3
  import { createHash, randomUUID, timingSafeEqual } from 'node:crypto';
4
4
  import { channel } from 'node:diagnostics_channel';
5
5
  import { readFile } from 'node:fs/promises';
@@ -286,9 +286,9 @@ const LOCALHOST_ORIGIN_RE = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d+)?
286
286
  const MAX_SESSION_ID_LENGTH = 256;
287
287
  const MAX_BEARER_TOKEN_LENGTH = 4096;
288
288
  const JSON_RPC_SERVER_ERROR = -32000;
289
- const JSON_RPC_INVALID_REQUEST = -32600;
290
- const JSON_RPC_PARSE_ERROR = -32700;
291
- const JSON_RPC_INTERNAL_ERROR = -32603;
289
+ const JSON_RPC_INVALID_REQUEST = ProtocolErrorCode.InvalidRequest;
290
+ const JSON_RPC_PARSE_ERROR = ProtocolErrorCode.ParseError;
291
+ const JSON_RPC_INTERNAL_ERROR = ProtocolErrorCode.InternalError;
292
292
  function isAllowedOrigin(origin) {
293
293
  if (origin === undefined)
294
294
  return true; // Non-browser clients omit Origin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/filesystem-mcp",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "mcpName": "io.github.j0hanz/filesystem-mcp",
5
5
  "description": "Secure filesystem MCP server for reading, writing, searching, diffing, and patching files.",
6
6
  "author": "j0hanz",