Skip to content

Fix MCP documentation fetch#2

Merged
mattt merged 1 commit intoNSHipster:mainfrom
bjtitus:mcp-documentation-path-fix
Sep 2, 2025
Merged

Fix MCP documentation fetch#2
mattt merged 1 commit intoNSHipster:mainfrom
bjtitus:mcp-documentation-path-fix

Conversation

@bjtitus
Copy link
Copy Markdown
Contributor

@bjtitus bjtitus commented Sep 2, 2025

Not sure if you're ready for contributions yet but thought I'd submit this one to fix a minor issue.

The Problem

When I tested the MCP server, it kept returning 404s when using the fetch tool with a path like /documentation/swift/task/:

⏺ sosumi - fetch (MCP)(path: "/documentation/swift/task/")
  ⎿  Error fetching documentation for "/documentation/swift/task/": Failed to fetch JSON: 404 Not Found

Code Changes

Used the normalizedPath for fetchJSONData in the documentation resource handler and the fetch tool. The current code ends up doubling up the documentation path components producing documentation/documentation/swiftui/view when calling fetchJSONData.

Probably several other ways to do this but this seemed simplest for now.

After

⏺ sosumi - fetch (MCP)(path: "swift/array")
  ⎿  ---
     title: Array
     description: An ordered, random-access collection.

⏺ sosumi - fetch (MCP)(path: "documentation/swift/array")
  ⎿  ---
     title: Array
     description: An ordered, random-access collection.

I also briefly checked the Resource loader using MCP Inspector and both doc://documentation/swift/array and doc://swift/array work.

@mattt
Copy link
Copy Markdown
Member

mattt commented Sep 2, 2025

Hey, thanks so much for this, @bjtitus. I did a bunch of refactoring ahead of this open source release, and neglected to smoke test all of the MCP functionality. I just tested this in MCP Inspector and Companion, and everything's working great now.

@mattt mattt merged commit 50ec08f into NSHipster:main Sep 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants