modelcontextprotocol / modelcontextprotocol/servers

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

Open
#3,517 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

环境信息

  • 操作系统: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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the filesystem server's glob handling and reproduce the **/*.ts example on Windows and Linux. Compare the returned path formats and inspect the platform-specific path handling. Done means the same glob returns consistent paths on both platforms, with platform-specific tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.