Avoid MCP form ID collisions for distinct server names
This commit is contained in:
parent
f1737f7100
commit
bc8c08d930
1 changed files with 3 additions and 6 deletions
|
|
@ -168,12 +168,9 @@ function toMCPServerType(value: unknown): MCPServerType {
|
|||
}
|
||||
|
||||
function makeMCPServerID(name: string): string {
|
||||
const normalized = name
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
if (normalized.length > 0) {
|
||||
return `mcp-${normalized}`
|
||||
const encoded = encodeURIComponent(name)
|
||||
if (encoded.length > 0) {
|
||||
return `mcp-${encoded}`
|
||||
}
|
||||
return `mcp-${Math.random().toString(36).slice(2, 10)}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue