(pathname: string)
| 15 | const TOOLKIT_PROTECTED_RESOURCE_METADATA_PATH = `${MCP_PROTECTED_RESOURCE_METADATA_PATH}/toolkits/:toolkitSlug`; |
| 16 | |
| 17 | const toolkitSlugFromPath = (pathname: string): string | undefined => { |
| 18 | const mcpPrefix = "/mcp/toolkits/"; |
| 19 | if (pathname.startsWith(mcpPrefix)) { |
| 20 | const slug = pathname.slice(mcpPrefix.length).split("/", 1)[0]; |
| 21 | return slug ? decodeURIComponent(slug) : undefined; |
| 22 | } |
| 23 | const metadataPrefix = `${MCP_PROTECTED_RESOURCE_METADATA_PATH}/toolkits/`; |
| 24 | if (pathname.startsWith(metadataPrefix)) { |
| 25 | const slug = pathname.slice(metadataPrefix.length).split("/", 1)[0]; |
| 26 | return slug ? decodeURIComponent(slug) : undefined; |
| 27 | } |
| 28 | return undefined; |
| 29 | }; |
| 30 | |
| 31 | const toolkitPath = (slug: string): string => `/mcp/toolkits/${encodeURIComponent(slug)}`; |
| 32 |
no outgoing calls
no test coverage detected