fix: duplicate any listed resource URI, not only a registered one

Copilot on #2281: the option's contract said an unregistered URI is ignored,
but `withDuplicateResources` runs on the assembled list, which also carries
whatever a resource template's `list` callback contributed — so a
template-listed URI was duplicated in contradiction of its own doc.

Broadened rather than restricted, because scoping it to `registeredResources`
would leave half the surface unreproducible: both kinds of entry land in the
same Resources sidebar list and collide on the same React key. The contract now
says so on `ServerConfig.duplicateResourceUris` and on the config-file mirror,
and an integration case covers a template-listed URI — it fails if the override
is narrowed to `state.registeredResources`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yVgAJz4wpkS4mkGk7DQnp
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-06 20:15:20 -04:00
commit 339c5f4e27

View file

@ -93,8 +93,9 @@ export interface ConfigFile {
*/
duplicateToolNames?: string[];
/**
* URIs of registered resources to emit **twice** in `resources/list` (same
* `uri`, the second's title marked "(duplicate)"). See
* URIs to emit **twice** in `resources/list` (same `uri`, the second's title
* marked "(duplicate)") — matched against the assembled list, so a
* template-listed URI counts as well as a statically-registered one. See
* {@link ServerConfig.duplicateResourceUris} (#2206).
*/
duplicateResourceUris?: string[];