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:
1 parent
f19bf10ef3
commit
745746afa9
8 files changed
+227
-60
No files matched your search
@@ -170,11 +170,12 @@ export class MCPInstallerService {
|
||||
});
|
||||
|
||||
// Construir ambiente
|
||||
// Para NPM, executar npx do diretório onde foi instalado (não usa --prefix que não funciona)
|
||||
const environment: MCPEnvironment = {
|
||||
type: "npm",
|
||||
path: npmDir,
|
||||
executable: "npx",
|
||||
args: ["--prefix", npmDir, packageName],
|
||||
args: [packageName],
|
||||
};
|
||||
|
||||
return environment;
|
||||
|
||||
@@ -32,11 +32,18 @@ export class MCPValidatorService {
|
||||
...(config.env || {}),
|
||||
};
|
||||
|
||||
// Para NPM, adicionar node_modules/.bin ao PATH para encontrar binários locais
|
||||
if (environment.type === "npm" && environment.path) {
|
||||
const nodeBinPath = `${environment.path}/node_modules/.bin`;
|
||||
env.PATH = `${nodeBinPath}:${env.PATH || process.env.PATH}`;
|
||||
}
|
||||
|
||||
console.log(`🧪 Testing MCP server: ${command} ${args.join(" ")}`);
|
||||
|
||||
try {
|
||||
// Spawnar processo do servidor MCP
|
||||
const serverProcess = spawn(command, args, {
|
||||
cwd: environment.path, // Executar do diretório de instalação
|
||||
env,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
});
|
||||
@@ -232,8 +239,15 @@ export class MCPValidatorService {
|
||||
...(config.env || {}),
|
||||
};
|
||||
|
||||
// Para NPM, adicionar node_modules/.bin ao PATH para encontrar binários locais
|
||||
if (environment.type === "npm" && environment.path) {
|
||||
const nodeBinPath = `${environment.path}/node_modules/.bin`;
|
||||
env.PATH = `${nodeBinPath}:${env.PATH || process.env.PATH}`;
|
||||
}
|
||||
|
||||
try {
|
||||
const serverProcess = spawn(command, args, {
|
||||
cwd: environment.path, // Executar do diretório de instalação
|
||||
env,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user