Skip to content

Resource template UI does not support RFC 6570 expansion #1919

Description

@delaneyj

Description

MCP Inspector v2 expands resource templates using plain string replacement instead of RFC 6570 expansion.

This causes two related problems:

  1. Query expressions such as {?topic} do not produce an input control.
  2. Reserved characters in simple variables are inserted without percent encoding.

Reproduction

Advertise this resource template:

{
  "name": "events",
  "uriTemplate": "foobar://events/{topic}"
}

In Inspector:

  1. Open the resource template.
  2. Enter foo/bar for topic.
  3. Click Read Resource.
  4. Inspect the generated resources/read request.

Actual result

Inspector sends:

{
  "uri": "foobar://events/foo/bar"
}

The inserted slash creates another path segment. A standards-compliant resource-template matcher rejects the URI:

{
  "code": -32602,
  "message": "Resource not found",
  "data": {
    "uri": "foobar://events/foo/bar"
  }
}

When the server advertises:

foobar://events{?topic}

Inspector does not display a topic input.

Expected result

Inspector should expand templates according to RFC 6570.

For {topic}, the value foo/bar should produce:

foobar://events/foo%2Fbar

For {?topic}, Inspector should display a topic input and generate an encoded query expression.

Suspected cause

The web client appears to extract and replace only plain variables:

const variables = /\{(\w+)\}/g
template.replace(/\{(\w+)\}/g, (_, name) => values[name])

This does not support RFC 6570 operators or encode values.

Suggested correction

Use an RFC 6570 implementation for:

  • Variable discovery.
  • Form generation.
  • URI expansion.
  • Reserved-character encoding.
  • Query-expression expansion.

Add coverage for:

foobar://events/{topic}
foobar://events{?topic}

Test values containing /, ?, #, %, spaces, and Unicode text.

Environment

  • MCP Inspector: v2.0.0
  • Protocol revision: 2026-07-28
  • Transport: Streamable HTTP
  • Client: Inspector web UI

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv2Issues and PRs for v2

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions