fix(mcp): prevent resource key collisions (#33596)
This commit is contained in:
parent
fbfd725d73
commit
6c12c32fb1
@ -100,9 +100,11 @@ export function fetch<T extends { name: string }>(
|
||||
),
|
||||
Effect.map((items) => {
|
||||
const sanitizedClient = sanitize(clientName)
|
||||
// Escape both the separator and escape marker so `server:uri` keys remain unambiguous.
|
||||
const resourceClient = clientName.replaceAll("%", "%25").replaceAll(":", "%3A")
|
||||
return Object.fromEntries(
|
||||
items.map((item) => [
|
||||
key ? clientName + ":" + key(item) : sanitizedClient + ":" + sanitize(item.name),
|
||||
key ? resourceClient + ":" + key(item) : sanitizedClient + ":" + sanitize(item.name),
|
||||
{ ...item, client: clientName },
|
||||
]),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user