Resource template query parameters not appended to request URI
Describe the bug
When reading a resource template, the request URI is constructed incorrectly, causing query parameters not to appear as expected.
To Reproduce
- Prepare a MCP server that implements a resource template with query parameters. In this example, the template URI is defined as
app://users{?name}. - Launch the Inspector and start the mcp server.
- Select the resource template.
- Enter a value for the
namequery parameter (e.g.,foo). - Click the Read Resource button to send the request to the MCP server.
- Observe that the request fails because the constructed URI is invalid. For example, you will see
app://usersfooinstead of including?name=foo.
Expected behavior
The query parameters should be appended correctly. In this example, the request URI should be app://users?name=foo.
Additional context
I believe the issue originates from the lines below in ResourcesTab.tsx (commit ec24f7b):
https://github.com/modelcontextprotocol/inspector/blob/ec24f7bbbf1535084c5f03157c80eceb4e79278d/client/src/components/ResourcesTab.tsx#L78-L86
It may be helpful to leverage the UriTemplate class from the TypeScript SDK, which already handles URI templates correctly:
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/shared/uriTemplate.test.ts