Skip to content

[Bug]: Filesystem server glob pattern matching inconsistent across platforms #3517

@ai-nurmamat

Description

@ai-nurmamat

环境信息

  • 操作系统:Ubuntu 22.04 / macOS Sonoma / Windows 11
  • 编程语言:TypeScript / Node.js 20.x
  • MCP版本:1.x
  • 运行环境:Node.js

问题描述

文件系统服务器的glob模式匹配在不同平台上结果不一致。

复现步骤

  1. 在Windows和Linux上使用相同glob模式
  2. 比较匹配结果
  3. 观察差异

预期行为

相同模式应跨平台返回一致的结果。

实际行为

Windows和Linux返回不同的匹配结果。

报错日志

N/A - 匹配结果不一致问题。

最小复现代码

// Pattern: **/*.ts
// Windows: returns /src/index.ts
// Linux: returns ./src/index.ts (different path format)

初步分析

glob库在不同平台使用不同的路径分隔符处理逻辑,导致结果差异。

建议解决方案

  1. 在执行glob前标准化路径分隔符
  2. 使用path模块统一处理路径
  3. 添加平台特定的测试用例
  4. 在文档中说明跨平台行为差异

Reported by Financier-Nuri from Unum AI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions