Skip to content

Fix inconsistent slash handling on MCP directory listing#944

Merged
jviotti merged 3 commits into
mainfrom
slash-mcp
May 25, 2026
Merged

Fix inconsistent slash handling on MCP directory listing#944
jviotti merged 3 commits into
mainfrom
slash-mcp

Conversation

@jviotti
Copy link
Copy Markdown
Member

@jviotti jviotti commented May 25, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 25, 2026

🤖 Augment PR Summary

Summary: This PR fixes inconsistent handling of leading/trailing slashes for the MCP list_directory tool so callers can use paths like /test, /test/, or test/ reliably.

Changes:

  • Normalize MCP arguments.path via std::filesystem::path(...).relative_path() before joining onto the explorer root, avoiding absolute-path replacement semantics.
  • Keep the existing safety checks (weakly_canonical + is_under_path) to reject paths that escape the catalog root.
  • Expand enterprise MCP E2E coverage to verify consistent results for /test, test/, /test/, and the root directory /.
  • Add headless API listing E2E cases for canonicalisation behavior with .. segments and for accepting a trailing slash on listing URLs.

Technical Notes: The MCP implementation now strips any root component from the user-supplied path before filesystem joining, aligning behavior across different caller path formats while preserving traversal protection.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Index (community)

Details
Benchmark suite Current: bb7f547 Previous: a78c41d Ratio
Add one schema (0 existing) 300 ms 287 ms 1.05
Add one schema (100 existing) 25 ms 25 ms 1
Add one schema (1000 existing) 80 ms 79 ms 1.01
Add one schema (10000 existing) 661 ms 850 ms 0.78
Update one schema (1 existing) 19 ms 19 ms 1
Update one schema (101 existing) 26 ms 26 ms 1
Update one schema (1001 existing) 81 ms 81 ms 1
Update one schema (10001 existing) 665 ms 781 ms 0.85
Cached rebuild (1 existing) 5 ms 5 ms 1
Cached rebuild (101 existing) 7 ms 7 ms 1
Cached rebuild (1001 existing) 28 ms 28 ms 1
Cached rebuild (10001 existing) 248 ms 301 ms 0.82
Index 100 schemas 117 ms 114 ms 1.03
Index 1000 schemas 925 ms 912 ms 1.01
Index 10000 schemas 14292 ms 13275 ms 1.08

This comment was automatically generated by workflow using github-action-benchmark.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Index (enterprise)

Details
Benchmark suite Current: bb7f547 Previous: a78c41d Ratio
Add one schema (0 existing) 289 ms 302 ms 0.96
Add one schema (100 existing) 28 ms 28 ms 1
Add one schema (1000 existing) 81 ms 79 ms 1.03
Add one schema (10000 existing) 662 ms 667 ms 0.99
Update one schema (1 existing) 20 ms 21 ms 0.95
Update one schema (101 existing) 28 ms 27 ms 1.04
Update one schema (1001 existing) 83 ms 80 ms 1.04
Update one schema (10001 existing) 679 ms 652 ms 1.04
Cached rebuild (1 existing) 6 ms 6 ms 1
Cached rebuild (101 existing) 9 ms 8 ms 1.13
Cached rebuild (1001 existing) 29 ms 28 ms 1.04
Cached rebuild (10001 existing) 245 ms 242 ms 1.01
Index 100 schemas 121 ms 125 ms 0.97
Index 1000 schemas 1213 ms 1114 ms 1.09
Index 10000 schemas 13899 ms 14257 ms 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread enterprise/e2e/html/hurl/mcp-2025-11-25-list_directory.all.hurl
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit 96ce22d into main May 25, 2026
5 checks passed
@jviotti jviotti deleted the slash-mcp branch May 25, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant