MCPcopy Create free account
hub / github.com/modelcontextprotocol/mcpb / sanitizeNameForFilename

Function sanitizeNameForFilename

src/cli/pack.ts:37–47  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

35}
36
37function sanitizeNameForFilename(name: string): string {
38 // Replace spaces with hyphens
39 // Remove or replace characters that are problematic in filenames
40 return name
41 .toLowerCase()
42 .replace(/\s+/g, "-") // Replace spaces with hyphens
43 .replace(/[^a-z0-9-_.]/g, "") // Keep only alphanumeric, hyphens, underscores, and dots
44 .replace(/-+/g, "-") // Replace multiple hyphens with single hyphen
45 .replace(/^-+|-+$/g, "") // Remove leading/trailing hyphens
46 .substring(0, 100); // Limit length to 100 characters
47}
48
49export async function packExtension({
50 extensionPath,

Callers 1

packExtensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…