feat(mcp): add GitHub repo support and tools display in MCP cards

- Support installing MCP servers from GitHub repos by converting 'github:user/repo' to 'git+https://github.com/user/repo.git' to avoid SSH issues and improve npm compatibility
- Display available tools in MCPCard with badges, showing up to 6 tools and total count for better visibility of server capabilities
- Remove unused onViewDetails prop and make uninstall button full-width for improved UI consistency
This commit is contained in:
Evandro Fonseca Junior committed 2025-10-28 22:17:19 -03:00
1 parent f19bf10ef3
commit 745746afa9
8 files changed
+227 -60

No files matched your search

+13 -2
View File
@@ -137,10 +137,21 @@ export async function spawnWithProgress(
/**
* Sanitiza nome de pacote para evitar command injection
* Suporta formatos: @scope/pkg, github:user/repo, git+https://..., etc.
*/
export function sanitizePackageName(packageName: string): string {
// Remove caracteres perigosos, mantém apenas alphanumeric, @, /, -, _
return packageName.replace(/[^a-zA-Z0-9@/\-_.]/g, "");
// URLs git+https:// devem ser preservadas completamente (são seguras)
if (
packageName.startsWith("git+https://") ||
packageName.startsWith("git+http://")
) {
// Apenas validar que parece uma URL válida
return packageName;
}
// Remove caracteres perigosos, mantém alphanumeric, @, :, +, /, -, _, .
// Suporta: @scope/pkg, github:user/repo
return packageName.replace(/[^a-zA-Z0-9@:+/\-_.]/g, "");
}
/**