fix(mcp): prevent resource key collisions (#33596)
This commit is contained in:
parent
fbfd725d73
commit
6c12c32fb1
1 changed files with 3 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue