cast-code 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/app.module.js +45 -0
- package/dist/app.module.js.map +1 -0
- package/dist/common/common.module.js +49 -0
- package/dist/common/common.module.js.map +1 -0
- package/dist/common/constants/index.js +105 -0
- package/dist/common/constants/index.js.map +1 -0
- package/dist/common/index.js +24 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/services/config.service.js +119 -0
- package/dist/common/services/config.service.js.map +1 -0
- package/dist/common/services/llm.service.js +56 -0
- package/dist/common/services/llm.service.js.map +1 -0
- package/dist/common/services/markdown-parser.service.js +101 -0
- package/dist/common/services/markdown-parser.service.js.map +1 -0
- package/dist/common/services/markdown-renderer.service.js +220 -0
- package/dist/common/services/markdown-renderer.service.js.map +1 -0
- package/dist/common/services/multi-llm.service.js +115 -0
- package/dist/common/services/multi-llm.service.js.map +1 -0
- package/dist/common/types/index.js +20 -0
- package/dist/common/types/index.js.map +1 -0
- package/dist/common/types/markdown.types.js +6 -0
- package/dist/common/types/markdown.types.js.map +1 -0
- package/dist/main.js +84 -0
- package/dist/main.js.map +1 -0
- package/dist/modules/agents/agents.module.js +43 -0
- package/dist/modules/agents/agents.module.js.map +1 -0
- package/dist/modules/agents/definitions/architect.md +35 -0
- package/dist/modules/agents/definitions/backend.md +43 -0
- package/dist/modules/agents/definitions/coder.md +34 -0
- package/dist/modules/agents/definitions/devops.md +42 -0
- package/dist/modules/agents/definitions/frontend.md +46 -0
- package/dist/modules/agents/definitions/reviewer.md +35 -0
- package/dist/modules/agents/definitions/tester.md +41 -0
- package/dist/modules/agents/index.js +23 -0
- package/dist/modules/agents/index.js.map +1 -0
- package/dist/modules/agents/services/agent-loader.service.js +150 -0
- package/dist/modules/agents/services/agent-loader.service.js.map +1 -0
- package/dist/modules/agents/services/agent-registry.service.js +108 -0
- package/dist/modules/agents/services/agent-registry.service.js.map +1 -0
- package/dist/modules/agents/types/agent.types.js +6 -0
- package/dist/modules/agents/types/agent.types.js.map +1 -0
- package/dist/modules/agents/types/index.js +20 -0
- package/dist/modules/agents/types/index.js.map +1 -0
- package/dist/modules/config/config.module.js +38 -0
- package/dist/modules/config/config.module.js.map +1 -0
- package/dist/modules/config/index.js +24 -0
- package/dist/modules/config/index.js.map +1 -0
- package/dist/modules/config/services/config-commands.service.js +405 -0
- package/dist/modules/config/services/config-commands.service.js.map +1 -0
- package/dist/modules/config/services/config-manager.service.js +175 -0
- package/dist/modules/config/services/config-manager.service.js.map +1 -0
- package/dist/modules/config/services/init-config.service.js +238 -0
- package/dist/modules/config/services/init-config.service.js.map +1 -0
- package/dist/modules/config/types/config.types.js +163 -0
- package/dist/modules/config/types/config.types.js.map +1 -0
- package/dist/modules/config/types/index.js +20 -0
- package/dist/modules/config/types/index.js.map +1 -0
- package/dist/modules/core/core.module.js +60 -0
- package/dist/modules/core/core.module.js.map +1 -0
- package/dist/modules/core/index.js +22 -0
- package/dist/modules/core/index.js.map +1 -0
- package/dist/modules/core/services/deep-agent.service.js +575 -0
- package/dist/modules/core/services/deep-agent.service.js.map +1 -0
- package/dist/modules/core/services/plan-mode.service.js +225 -0
- package/dist/modules/core/services/plan-mode.service.js.map +1 -0
- package/dist/modules/git/git.module.js +48 -0
- package/dist/modules/git/git.module.js.map +1 -0
- package/dist/modules/git/index.js +23 -0
- package/dist/modules/git/index.js.map +1 -0
- package/dist/modules/git/services/code-review.service.js +330 -0
- package/dist/modules/git/services/code-review.service.js.map +1 -0
- package/dist/modules/git/services/commit-generator.service.js +403 -0
- package/dist/modules/git/services/commit-generator.service.js.map +1 -0
- package/dist/modules/git/services/index.js +21 -0
- package/dist/modules/git/services/index.js.map +1 -0
- package/dist/modules/git/services/monorepo-detector.service.js +338 -0
- package/dist/modules/git/services/monorepo-detector.service.js.map +1 -0
- package/dist/modules/git/services/pr-generator.service.js +429 -0
- package/dist/modules/git/services/pr-generator.service.js.map +1 -0
- package/dist/modules/git/services/release-notes.service.js +426 -0
- package/dist/modules/git/services/release-notes.service.js.map +1 -0
- package/dist/modules/git/types/git.types.js +6 -0
- package/dist/modules/git/types/git.types.js.map +1 -0
- package/dist/modules/git/types/index.js +20 -0
- package/dist/modules/git/types/index.js.map +1 -0
- package/dist/modules/mcp/catalog/mcp-templates.js +606 -0
- package/dist/modules/mcp/catalog/mcp-templates.js.map +1 -0
- package/dist/modules/mcp/index.js +23 -0
- package/dist/modules/mcp/index.js.map +1 -0
- package/dist/modules/mcp/mcp.module.js +35 -0
- package/dist/modules/mcp/mcp.module.js.map +1 -0
- package/dist/modules/mcp/services/mcp-client.service.js +289 -0
- package/dist/modules/mcp/services/mcp-client.service.js.map +1 -0
- package/dist/modules/mcp/services/mcp-registry.service.js +197 -0
- package/dist/modules/mcp/services/mcp-registry.service.js.map +1 -0
- package/dist/modules/mcp/types/index.js +20 -0
- package/dist/modules/mcp/types/index.js.map +1 -0
- package/dist/modules/mcp/types/mcp.types.js +6 -0
- package/dist/modules/mcp/types/mcp.types.js.map +1 -0
- package/dist/modules/memory/index.js +23 -0
- package/dist/modules/memory/index.js.map +1 -0
- package/dist/modules/memory/memory.module.js +35 -0
- package/dist/modules/memory/memory.module.js.map +1 -0
- package/dist/modules/memory/services/memory-tools.service.js +78 -0
- package/dist/modules/memory/services/memory-tools.service.js.map +1 -0
- package/dist/modules/memory/services/memory.service.js +169 -0
- package/dist/modules/memory/services/memory.service.js.map +1 -0
- package/dist/modules/memory/types/index.js +20 -0
- package/dist/modules/memory/types/index.js.map +1 -0
- package/dist/modules/memory/types/memory.types.js +6 -0
- package/dist/modules/memory/types/memory.types.js.map +1 -0
- package/dist/modules/mentions/index.js +22 -0
- package/dist/modules/mentions/index.js.map +1 -0
- package/dist/modules/mentions/mentions.module.js +32 -0
- package/dist/modules/mentions/mentions.module.js.map +1 -0
- package/dist/modules/mentions/services/mentions.service.js +336 -0
- package/dist/modules/mentions/services/mentions.service.js.map +1 -0
- package/dist/modules/mentions/types/index.js +20 -0
- package/dist/modules/mentions/types/index.js.map +1 -0
- package/dist/modules/mentions/types/mention.types.js +19 -0
- package/dist/modules/mentions/types/mention.types.js.map +1 -0
- package/dist/modules/permissions/index.js +23 -0
- package/dist/modules/permissions/index.js.map +1 -0
- package/dist/modules/permissions/permissions.module.js +35 -0
- package/dist/modules/permissions/permissions.module.js.map +1 -0
- package/dist/modules/permissions/services/permission.service.js +269 -0
- package/dist/modules/permissions/services/permission.service.js.map +1 -0
- package/dist/modules/permissions/services/prompt.service.js +116 -0
- package/dist/modules/permissions/services/prompt.service.js.map +1 -0
- package/dist/modules/permissions/types/permission.types.js +32 -0
- package/dist/modules/permissions/types/permission.types.js.map +1 -0
- package/dist/modules/project/index.js +24 -0
- package/dist/modules/project/index.js.map +1 -0
- package/dist/modules/project/project.module.js +38 -0
- package/dist/modules/project/project.module.js.map +1 -0
- package/dist/modules/project/services/project-analyzer.service.js +1063 -0
- package/dist/modules/project/services/project-analyzer.service.js.map +1 -0
- package/dist/modules/project/services/project-context.service.js +62 -0
- package/dist/modules/project/services/project-context.service.js.map +1 -0
- package/dist/modules/project/services/project-loader.service.js +147 -0
- package/dist/modules/project/services/project-loader.service.js.map +1 -0
- package/dist/modules/project/types/index.js +20 -0
- package/dist/modules/project/types/index.js.map +1 -0
- package/dist/modules/project/types/project.types.js +6 -0
- package/dist/modules/project/types/project.types.js.map +1 -0
- package/dist/modules/repl/index.js +21 -0
- package/dist/modules/repl/index.js.map +1 -0
- package/dist/modules/repl/repl.module.js +66 -0
- package/dist/modules/repl/repl.module.js.map +1 -0
- package/dist/modules/repl/services/commands/agent-commands.service.js +196 -0
- package/dist/modules/repl/services/commands/agent-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/git-commands.service.js +500 -0
- package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/mcp-commands.service.js +579 -0
- package/dist/modules/repl/services/commands/mcp-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/project-commands.service.js +226 -0
- package/dist/modules/repl/services/commands/project-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js +254 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -0
- package/dist/modules/repl/services/repl.service.js +647 -0
- package/dist/modules/repl/services/repl.service.js.map +1 -0
- package/dist/modules/repl/services/smart-input.js +544 -0
- package/dist/modules/repl/services/smart-input.js.map +1 -0
- package/dist/modules/repl/services/welcome-screen.service.js +117 -0
- package/dist/modules/repl/services/welcome-screen.service.js.map +1 -0
- package/dist/modules/repl/utils/prompts-with-esc.js +187 -0
- package/dist/modules/repl/utils/prompts-with-esc.js.map +1 -0
- package/dist/modules/repl/utils/theme.js +185 -0
- package/dist/modules/repl/utils/theme.js.map +1 -0
- package/dist/modules/skills/definitions/general/file-operations.md +60 -0
- package/dist/modules/skills/definitions/general/git-operations.md +59 -0
- package/dist/modules/skills/definitions/general/planning.md +86 -0
- package/dist/modules/skills/definitions/general/search.md +59 -0
- package/dist/modules/skills/definitions/specialized/api-design.md +85 -0
- package/dist/modules/skills/definitions/specialized/database-operations.md +78 -0
- package/dist/modules/skills/definitions/specialized/frontend-bootstrap.md +71 -0
- package/dist/modules/skills/definitions/specialized/react-patterns.md +77 -0
- package/dist/modules/skills/definitions/specialized/testing-strategies.md +79 -0
- package/dist/modules/skills/index.js +23 -0
- package/dist/modules/skills/index.js.map +1 -0
- package/dist/modules/skills/services/skill-loader.service.js +130 -0
- package/dist/modules/skills/services/skill-loader.service.js.map +1 -0
- package/dist/modules/skills/services/skill-registry.service.js +96 -0
- package/dist/modules/skills/services/skill-registry.service.js.map +1 -0
- package/dist/modules/skills/skills.module.js +38 -0
- package/dist/modules/skills/skills.module.js.map +1 -0
- package/dist/modules/skills/types/index.js +20 -0
- package/dist/modules/skills/types/index.js.map +1 -0
- package/dist/modules/skills/types/skill.types.js +6 -0
- package/dist/modules/skills/types/skill.types.js.map +1 -0
- package/dist/modules/tasks/index.js +24 -0
- package/dist/modules/tasks/index.js.map +1 -0
- package/dist/modules/tasks/services/plan-executor.service.js +199 -0
- package/dist/modules/tasks/services/plan-executor.service.js.map +1 -0
- package/dist/modules/tasks/services/plan-mode.service.js +118 -0
- package/dist/modules/tasks/services/plan-mode.service.js.map +1 -0
- package/dist/modules/tasks/services/plan-persistence.service.js +148 -0
- package/dist/modules/tasks/services/plan-persistence.service.js.map +1 -0
- package/dist/modules/tasks/services/task-management.service.js +255 -0
- package/dist/modules/tasks/services/task-management.service.js.map +1 -0
- package/dist/modules/tasks/services/task-tools.service.js +270 -0
- package/dist/modules/tasks/services/task-tools.service.js.map +1 -0
- package/dist/modules/tasks/tasks.module.js +49 -0
- package/dist/modules/tasks/tasks.module.js.map +1 -0
- package/dist/modules/tasks/types/task.types.js +21 -0
- package/dist/modules/tasks/types/task.types.js.map +1 -0
- package/dist/modules/tools/index.js +24 -0
- package/dist/modules/tools/index.js.map +1 -0
- package/dist/modules/tools/services/filesystem-tools.service.js +450 -0
- package/dist/modules/tools/services/filesystem-tools.service.js.map +1 -0
- package/dist/modules/tools/services/search-tools.service.js +63 -0
- package/dist/modules/tools/services/search-tools.service.js.map +1 -0
- package/dist/modules/tools/services/shell-tools.service.js +194 -0
- package/dist/modules/tools/services/shell-tools.service.js.map +1 -0
- package/dist/modules/tools/services/tools-registry.service.js +83 -0
- package/dist/modules/tools/services/tools-registry.service.js.map +1 -0
- package/dist/modules/tools/tools.module.js +46 -0
- package/dist/modules/tools/tools.module.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "McpCommandsService", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return McpCommandsService;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _common = require("@nestjs/common");
|
|
12
|
+
const _theme = require("../../utils/theme");
|
|
13
|
+
const _mcpregistryservice = require("../../../mcp/services/mcp-registry.service");
|
|
14
|
+
const _mcpclientservice = require("../../../mcp/services/mcp-client.service");
|
|
15
|
+
const _promptswithesc = require("../../utils/prompts-with-esc");
|
|
16
|
+
const _mcptemplates = require("../../../mcp/catalog/mcp-templates");
|
|
17
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
}
|
|
23
|
+
function _ts_metadata(k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
}
|
|
26
|
+
let McpCommandsService = class McpCommandsService {
|
|
27
|
+
async cmdMcp(args, smartInput) {
|
|
28
|
+
const sub = args[0] || 'menu';
|
|
29
|
+
const w = (s)=>process.stdout.write(s);
|
|
30
|
+
smartInput.pause();
|
|
31
|
+
try {
|
|
32
|
+
switch(sub){
|
|
33
|
+
case 'menu':
|
|
34
|
+
await this.showMcpMenu(smartInput);
|
|
35
|
+
break;
|
|
36
|
+
case 'list':
|
|
37
|
+
{
|
|
38
|
+
await this.listServers();
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'tools':
|
|
42
|
+
{
|
|
43
|
+
await this.listTools();
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'add':
|
|
47
|
+
{
|
|
48
|
+
await this.addMcpWizard(smartInput);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'remove':
|
|
52
|
+
{
|
|
53
|
+
await this.removeMcpWizard(smartInput);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'test':
|
|
57
|
+
{
|
|
58
|
+
await this.testMcpTool(smartInput);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'what':
|
|
62
|
+
case 'about':
|
|
63
|
+
this.printWhatIsMcp();
|
|
64
|
+
break;
|
|
65
|
+
case 'help':
|
|
66
|
+
default:
|
|
67
|
+
this.printMcpHelp();
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof _promptswithesc.CancelledPromptError || error?.name === 'CancelledPromptError') {
|
|
72
|
+
console.log((0, _theme.colorize)('\n❌ Cancelado. Voltando ao chat...\n', 'warning'));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
} finally{
|
|
77
|
+
smartInput.resume();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async showMcpMenu(smartInput) {
|
|
81
|
+
const w = (s)=>process.stdout.write(s);
|
|
82
|
+
while(true){
|
|
83
|
+
w(`\n${(0, _theme.colorize)('☁️ MCP Hub', 'bold')}\n`);
|
|
84
|
+
w(`${(0, _theme.colorize)(_theme.Box.horizontal.repeat(30), 'subtle')}\n\n`);
|
|
85
|
+
const summaries = this.mcpRegistry.getServerSummaries();
|
|
86
|
+
const totalTools = summaries.reduce((sum, s)=>sum + s.toolCount, 0);
|
|
87
|
+
w(`${(0, _theme.colorize)('Servidores:', 'muted')} ${summaries.length} `);
|
|
88
|
+
w(`${(0, _theme.colorize)('Ferramentas:', 'muted')} ${totalTools}\n\n`);
|
|
89
|
+
console.log((0, _theme.colorize)('(pressione ESC para voltar ao chat)\n', 'muted'));
|
|
90
|
+
const action = await this.withEsc(()=>smartInput.askChoice('O que deseja fazer?', [
|
|
91
|
+
{
|
|
92
|
+
key: '1',
|
|
93
|
+
label: 'Ver servidores',
|
|
94
|
+
description: 'Listar MCPs configurados'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
key: '2',
|
|
98
|
+
label: 'Ver ferramentas',
|
|
99
|
+
description: 'Todas as tools disponíveis'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: '3',
|
|
103
|
+
label: 'Adicionar servidor',
|
|
104
|
+
description: 'Configurar novo MCP'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: '4',
|
|
108
|
+
label: 'Remover servidor',
|
|
109
|
+
description: 'Desconectar MCP'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: '5',
|
|
113
|
+
label: 'O que é MCP?',
|
|
114
|
+
description: 'Entenda o protocolo'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: '6',
|
|
118
|
+
label: 'Como criar um MCP',
|
|
119
|
+
description: 'Guia de desenvolvimento'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: 'q',
|
|
123
|
+
label: 'Voltar',
|
|
124
|
+
description: 'Sair do MCP Hub'
|
|
125
|
+
}
|
|
126
|
+
]));
|
|
127
|
+
if (action === null) {
|
|
128
|
+
console.log((0, _theme.colorize)('\nSaindo do MCP Hub...\n', 'muted'));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
switch(action){
|
|
132
|
+
case '1':
|
|
133
|
+
await this.listServers();
|
|
134
|
+
break;
|
|
135
|
+
case '2':
|
|
136
|
+
await this.listTools();
|
|
137
|
+
break;
|
|
138
|
+
case '3':
|
|
139
|
+
await this.addMcpWizard(smartInput);
|
|
140
|
+
break;
|
|
141
|
+
case '4':
|
|
142
|
+
await this.removeMcpWizard(smartInput);
|
|
143
|
+
break;
|
|
144
|
+
case '5':
|
|
145
|
+
this.printWhatIsMcp();
|
|
146
|
+
break;
|
|
147
|
+
case '6':
|
|
148
|
+
this.printHowToCreate();
|
|
149
|
+
break;
|
|
150
|
+
case 'q':
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async withEsc(fn) {
|
|
156
|
+
try {
|
|
157
|
+
return await fn();
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (error instanceof _promptswithesc.CancelledPromptError || error.name === 'CancelledPromptError') {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async listServers() {
|
|
166
|
+
const w = (s)=>process.stdout.write(s);
|
|
167
|
+
const summaries = this.mcpRegistry.getServerSummaries();
|
|
168
|
+
w('\r\n');
|
|
169
|
+
w((0, _theme.colorize)(_theme.Icons.cloud + ' ', 'accent') + (0, _theme.colorize)('MCP Servers', 'bold') + '\r\n');
|
|
170
|
+
w((0, _theme.colorize)(_theme.Box.horizontal.repeat(40), 'subtle') + '\r\n\n');
|
|
171
|
+
if (summaries.length === 0) {
|
|
172
|
+
w(` ${(0, _theme.colorize)('Nenhum servidor MCP configurado', 'muted')}\r\n\n`);
|
|
173
|
+
w(` ${(0, _theme.colorize)('O que é MCP?', 'cyan')} → /mcp what\r\n`);
|
|
174
|
+
w(` ${(0, _theme.colorize)('Como adicionar?', 'cyan')} → /mcp add\r\n\n`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
for (const s of summaries){
|
|
178
|
+
const statusIcon = s.status === 'connected' ? (0, _theme.colorize)('●', 'success') : (0, _theme.colorize)('○', 'error');
|
|
179
|
+
const statusText = s.status === 'connected' ? (0, _theme.colorize)('conectado', 'success') : (0, _theme.colorize)(s.status, 'error');
|
|
180
|
+
w(` ${statusIcon} ${(0, _theme.colorize)(s.name, 'cyan')} ${(0, _theme.colorize)(`(${s.transport})`, 'muted')}\r\n`);
|
|
181
|
+
w(` Status: ${statusText} | Ferramentas: ${s.toolCount}\r\n`);
|
|
182
|
+
if (s.toolCount > 0) {
|
|
183
|
+
const toolNames = s.toolDescriptions.slice(0, 3).map((t)=>t.name.split('_').pop()).join(', ');
|
|
184
|
+
const more = s.toolCount > 3 ? ` +${s.toolCount - 3} mais` : '';
|
|
185
|
+
w(` Tools: ${(0, _theme.colorize)(toolNames + more, 'muted')}\r\n`);
|
|
186
|
+
}
|
|
187
|
+
w('\r\n');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async listTools() {
|
|
191
|
+
const w = (s)=>process.stdout.write(s);
|
|
192
|
+
const summaries = this.mcpRegistry.getServerSummaries();
|
|
193
|
+
const totalTools = summaries.reduce((sum, s)=>sum + s.toolCount, 0);
|
|
194
|
+
w('\r\n');
|
|
195
|
+
w((0, _theme.colorize)(_theme.Icons.tool + ' ', 'accent') + (0, _theme.colorize)(`MCP Tools (${totalTools})`, 'bold') + '\r\n');
|
|
196
|
+
w((0, _theme.colorize)(_theme.Box.horizontal.repeat(40), 'subtle') + '\r\n');
|
|
197
|
+
if (totalTools === 0) {
|
|
198
|
+
w(`\n ${(0, _theme.colorize)('Nenhuma ferramenta disponível', 'muted')}\r\n\n`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (const server of summaries){
|
|
202
|
+
if (server.toolCount === 0) continue;
|
|
203
|
+
w(`\n ${(0, _theme.colorize)(server.name, 'bold')} ${(0, _theme.colorize)(`(${server.transport}, ${server.status})`, 'muted')}\r\n`);
|
|
204
|
+
w(` ${(0, _theme.colorize)(_theme.Box.horizontal.repeat(30), 'subtle')}\r\n`);
|
|
205
|
+
for (const td of server.toolDescriptions){
|
|
206
|
+
const shortName = td.name.replace(`${server.name}_`, '');
|
|
207
|
+
w(` ${(0, _theme.colorize)('•', 'primary')} ${(0, _theme.colorize)(shortName, 'cyan')}\r\n`);
|
|
208
|
+
const desc = td.description.length > 70 ? td.description.slice(0, 67) + '...' : td.description;
|
|
209
|
+
w(` ${(0, _theme.colorize)(desc, 'muted')}\r\n`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
w('\r\n');
|
|
213
|
+
}
|
|
214
|
+
async addMcpWizard(smartInput) {
|
|
215
|
+
const fs = require('fs');
|
|
216
|
+
const path = require('path');
|
|
217
|
+
const mcpDir = path.join(process.cwd(), '.cast', 'mcp');
|
|
218
|
+
if (!fs.existsSync(mcpDir)) {
|
|
219
|
+
fs.mkdirSync(mcpDir, {
|
|
220
|
+
recursive: true
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const w = (s)=>process.stdout.write(s);
|
|
224
|
+
w('\r\n');
|
|
225
|
+
w((0, _theme.colorize)(_theme.Icons.cloud + ' ', 'accent') + (0, _theme.colorize)('Adicionar Servidor MCP', 'bold') + '\r\n');
|
|
226
|
+
w((0, _theme.colorize)(_theme.Box.horizontal.repeat(30), 'subtle') + '\r\n\r\n');
|
|
227
|
+
console.log((0, _theme.colorize)('(pressione ESC para cancelar a qualquer momento)\r\n', 'muted'));
|
|
228
|
+
const category = await (0, _promptswithesc.selectWithEsc)({
|
|
229
|
+
message: 'Escolha uma categoria:',
|
|
230
|
+
choices: [
|
|
231
|
+
{
|
|
232
|
+
name: '🔧 Dev Tools (GitHub, Linear, Jira, Sentry, Docker)',
|
|
233
|
+
value: 'dev'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: '🎨 Design (Figma)',
|
|
237
|
+
value: 'design'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: '🗄️ Data (PostgreSQL, MongoDB, Redis, Supabase)',
|
|
241
|
+
value: 'data'
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: '🔍 Search (Brave, Exa, Perplexity, Context7)',
|
|
245
|
+
value: 'search'
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: '☁️ Cloud (Vercel, Cloudflare, AWS S3)',
|
|
249
|
+
value: 'cloud'
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: '📋 Productivity (Slack, Notion, Google Drive, Maps)',
|
|
253
|
+
value: 'productivity'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: '💳 Payments (Stripe, Twilio)',
|
|
257
|
+
value: 'payments'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: '🌐 Browser (Puppeteer)',
|
|
261
|
+
value: 'browser'
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: '📁 Filesystem',
|
|
265
|
+
value: 'filesystem'
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: '➕ Configuração manual',
|
|
269
|
+
value: 'custom'
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
});
|
|
273
|
+
if (category === null) {
|
|
274
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado.\r\n\r\n', 'warning'));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
let config = {};
|
|
278
|
+
let name;
|
|
279
|
+
if (category !== 'custom') {
|
|
280
|
+
const templates = (0, _mcptemplates.getTemplatesByCategory)(category);
|
|
281
|
+
const templateId = await (0, _promptswithesc.selectWithEsc)({
|
|
282
|
+
message: 'Escolha um servidor:',
|
|
283
|
+
choices: templates.map((t)=>({
|
|
284
|
+
name: `${t.name} - ${t.description}`,
|
|
285
|
+
value: t.id
|
|
286
|
+
}))
|
|
287
|
+
});
|
|
288
|
+
if (templateId === null) {
|
|
289
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado.\r\n\r\n', 'warning'));
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const template = (0, _mcptemplates.getTemplate)(templateId);
|
|
293
|
+
if (!template) {
|
|
294
|
+
w((0, _theme.colorize)('\r\n ❌ Template não encontrado.\r\n\r\n', 'error'));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
name = template.id;
|
|
298
|
+
config = JSON.parse(JSON.stringify(template.config)); // Deep clone
|
|
299
|
+
if (template.credentials.length > 0) {
|
|
300
|
+
w(`\r\n${(0, _theme.colorize)('📝 Configuração:', 'bold')}\r\n`);
|
|
301
|
+
for (const cred of template.credentials){
|
|
302
|
+
if (cred.isArg) {
|
|
303
|
+
const value = await smartInput.question((0, _theme.colorize)(` ${cred.name} (${cred.placeholder}): `, 'cyan'));
|
|
304
|
+
if (!value.trim() && cred.required) {
|
|
305
|
+
w((0, _theme.colorize)('\r\n ❌ Campo obrigatório!\r\n\r\n', 'error'));
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (value.trim()) {
|
|
309
|
+
config.args.push(value.trim());
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
const value = await smartInput.question((0, _theme.colorize)(` ${cred.name} (${cred.placeholder}): `, 'cyan'));
|
|
313
|
+
if (!value.trim() && cred.required) {
|
|
314
|
+
w((0, _theme.colorize)('\r\n ❌ Campo obrigatório!\r\n\r\n', 'error'));
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (value.trim()) {
|
|
318
|
+
if (!config.env) config.env = {};
|
|
319
|
+
config.env[cred.envVar] = value.trim();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const filePath = path.join(mcpDir, `${name}.json`);
|
|
325
|
+
fs.writeFileSync(filePath, JSON.stringify({
|
|
326
|
+
[name]: config
|
|
327
|
+
}, null, 2));
|
|
328
|
+
w(`\r\n${(0, _theme.colorize)('✓', 'success')} MCP configurado: ${(0, _theme.colorize)(filePath, 'accent')}\r\n`);
|
|
329
|
+
if (template.config.type === 'http') {
|
|
330
|
+
w((0, _theme.colorize)('\r\n ⚠️ Servidor HTTP/OAuth detectado!\r\n', 'warning'));
|
|
331
|
+
w((0, _theme.colorize)(' Autenticação pode ser necessária após conectar.\r\n\r\n', 'muted'));
|
|
332
|
+
}
|
|
333
|
+
w((0, _theme.colorize)(' Reinicie o Cast para conectar\r\n\r\n', 'muted'));
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const nameInput = await (0, _promptswithesc.inputWithEsc)({
|
|
337
|
+
message: (0, _theme.colorize)(' Nome do servidor: ', 'cyan')
|
|
338
|
+
});
|
|
339
|
+
if (nameInput === null || !nameInput.trim()) {
|
|
340
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
name = nameInput;
|
|
344
|
+
const typeChoice = await smartInput.askChoice(' Tipo de transporte:', [
|
|
345
|
+
{
|
|
346
|
+
key: 'stdio',
|
|
347
|
+
label: 'stdio',
|
|
348
|
+
description: 'Processo local (npx, node, python)'
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
key: 'http',
|
|
352
|
+
label: 'http',
|
|
353
|
+
description: 'Endpoint HTTP'
|
|
354
|
+
}
|
|
355
|
+
]);
|
|
356
|
+
config.type = typeChoice;
|
|
357
|
+
if (typeChoice === 'stdio') {
|
|
358
|
+
const command = await (0, _promptswithesc.inputWithEsc)({
|
|
359
|
+
message: (0, _theme.colorize)(' Comando: ', 'cyan')
|
|
360
|
+
});
|
|
361
|
+
if (command === null) {
|
|
362
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const argsInput = await (0, _promptswithesc.inputWithEsc)({
|
|
366
|
+
message: (0, _theme.colorize)(' Argumentos (separados por vírgula): ', 'cyan')
|
|
367
|
+
});
|
|
368
|
+
if (argsInput === null) {
|
|
369
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
config.command = command.trim();
|
|
373
|
+
config.args = argsInput.trim() ? argsInput.split(',').map((a)=>a.trim()) : [];
|
|
374
|
+
const hasEnv = await (0, _promptswithesc.confirmWithEsc)({
|
|
375
|
+
message: 'Precisa de variáveis de ambiente?',
|
|
376
|
+
default: false
|
|
377
|
+
});
|
|
378
|
+
if (hasEnv === null) {
|
|
379
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (hasEnv) {
|
|
383
|
+
config.env = {};
|
|
384
|
+
while(true){
|
|
385
|
+
const key = await (0, _promptswithesc.inputWithEsc)({
|
|
386
|
+
message: (0, _theme.colorize)(' Nome da variável (ou vazio para parar): ', 'cyan')
|
|
387
|
+
});
|
|
388
|
+
if (key === null) {
|
|
389
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (!key) break;
|
|
393
|
+
const value = await (0, _promptswithesc.inputWithEsc)({
|
|
394
|
+
message: (0, _theme.colorize)(` Valor para ${key}: `, 'cyan')
|
|
395
|
+
});
|
|
396
|
+
if (value === null) {
|
|
397
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
config.env[key] = value;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
} else {
|
|
404
|
+
const endpoint = await (0, _promptswithesc.inputWithEsc)({
|
|
405
|
+
message: (0, _theme.colorize)(' URL do endpoint: ', 'cyan')
|
|
406
|
+
});
|
|
407
|
+
if (endpoint === null) {
|
|
408
|
+
w((0, _theme.colorize)('\r\n ❌ Cancelado\r\n', 'muted'));
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
config.endpoint = endpoint.trim();
|
|
412
|
+
}
|
|
413
|
+
const filePath = path.join(mcpDir, `${name.trim().toLowerCase()}.json`);
|
|
414
|
+
fs.writeFileSync(filePath, JSON.stringify({
|
|
415
|
+
[name.trim()]: config
|
|
416
|
+
}, null, 2));
|
|
417
|
+
w(`\r\n${(0, _theme.colorize)('✓', 'success')} Config salva: ${(0, _theme.colorize)(filePath, 'accent')}\r\n`);
|
|
418
|
+
w((0, _theme.colorize)(' Reinicie o Cast para conectar\r\n\r\n', 'muted'));
|
|
419
|
+
}
|
|
420
|
+
async removeMcpWizard(smartInput) {
|
|
421
|
+
const fs = require('fs');
|
|
422
|
+
const path = require('path');
|
|
423
|
+
const mcpDir = path.join(process.cwd(), '.cast', 'mcp');
|
|
424
|
+
if (!fs.existsSync(mcpDir)) {
|
|
425
|
+
console.log((0, _theme.colorize)('\nNenhum MCP configurado\n', 'muted'));
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const files = fs.readdirSync(mcpDir).filter((f)=>f.endsWith('.json'));
|
|
429
|
+
if (files.length === 0) {
|
|
430
|
+
console.log((0, _theme.colorize)('\nNenhum MCP configurado\n', 'muted'));
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const w = (s)=>process.stdout.write(s);
|
|
434
|
+
w('\r\n');
|
|
435
|
+
w((0, _theme.colorize)(_theme.Icons.cloud + ' ', 'accent') + (0, _theme.colorize)('Remover Servidor MCP', 'bold') + '\r\n');
|
|
436
|
+
w((0, _theme.colorize)(_theme.Box.horizontal.repeat(25), 'subtle') + '\r\n\n');
|
|
437
|
+
const toRemove = await select({
|
|
438
|
+
message: 'Qual servidor remover?',
|
|
439
|
+
choices: files.map((f)=>({
|
|
440
|
+
name: f.replace('.json', ''),
|
|
441
|
+
value: f
|
|
442
|
+
}))
|
|
443
|
+
});
|
|
444
|
+
const confirmRemove = await confirm({
|
|
445
|
+
message: `Tem certeza que deseja remover "${toRemove.replace('.json', '')}"?`,
|
|
446
|
+
default: false
|
|
447
|
+
});
|
|
448
|
+
if (confirmRemove) {
|
|
449
|
+
fs.unlinkSync(path.join(mcpDir, toRemove));
|
|
450
|
+
console.log((0, _theme.colorize)(`\n✓ Servidor removido\n`, 'success'));
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async testMcpTool(smartInput) {
|
|
454
|
+
console.log((0, _theme.colorize)('\nEm breve!\n', 'muted'));
|
|
455
|
+
}
|
|
456
|
+
printWhatIsMcp() {
|
|
457
|
+
const w = (s)=>process.stdout.write(s);
|
|
458
|
+
w(`\n${(0, _theme.colorize)('☁️ O que é MCP?', 'bold')}\n`);
|
|
459
|
+
w(`${(0, _theme.colorize)(_theme.Box.horizontal.repeat(50), 'subtle')}\n\n`);
|
|
460
|
+
w(`${(0, _theme.colorize)('Model Context Protocol (MCP)', 'cyan')} é um protocolo aberto\n`);
|
|
461
|
+
w(`que permite que assistentes de IA se conectem a fontes de dados\n`);
|
|
462
|
+
w(`e ferramentas externas de forma padronizada.\n\n`);
|
|
463
|
+
w(`${(0, _theme.colorize)('Como funciona:', 'bold')}\n`);
|
|
464
|
+
w(` ${(0, _theme.colorize)('1.', 'primary')} Um servidor MCP expõe ferramentas (tools)\n`);
|
|
465
|
+
w(` ${(0, _theme.colorize)('2.', 'primary')} O Cast se conecta a esse servidor\n`);
|
|
466
|
+
w(` ${(0, _theme.colorize)('3.', 'primary')} A IA pode chamar essas ferramentas automaticamente\n\n`);
|
|
467
|
+
w(`${(0, _theme.colorize)('Exemplos de uso:', 'bold')}\n`);
|
|
468
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} GitHub: criar issues, ler PRs, fazer commits\n`);
|
|
469
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} Filesystem: acessar arquivos fora do projeto\n`);
|
|
470
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} PostgreSQL: consultar bancos de dados\n`);
|
|
471
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} Brave: buscar informações atualizadas na web\n\n`);
|
|
472
|
+
w(`${(0, _theme.colorize)('Vantagens:', 'bold')}\n`);
|
|
473
|
+
w(` ${(0, _theme.colorize)('✓', 'success')} Segurança: o usuário controla o acesso\n`);
|
|
474
|
+
w(` ${(0, _theme.colorize)('✓', 'success')} Flexibilidade: qualquer linguagem/framework\n`);
|
|
475
|
+
w(` ${(0, _theme.colorize)('✓', 'success')} Padrão aberto: não é vendor lock-in\n\n`);
|
|
476
|
+
w(`${(0, _theme.colorize)('Quer criar seu próprio MCP?', 'accent')}\n`);
|
|
477
|
+
w(` → /mcp help (guia completo)\n`);
|
|
478
|
+
w(` → https://modelcontextprotocol.io\n\n`);
|
|
479
|
+
}
|
|
480
|
+
printHowToCreate() {
|
|
481
|
+
const w = (s)=>process.stdout.write(s);
|
|
482
|
+
w(`\n${(0, _theme.colorize)('🛠️ Como Criar um Servidor MCP', 'bold')}\n`);
|
|
483
|
+
w(`${(0, _theme.colorize)(_theme.Box.horizontal.repeat(50), 'subtle')}\n\n`);
|
|
484
|
+
w(`${(0, _theme.colorize)('Opção 1: TypeScript/JavaScript (mais fácil)', 'bold')}\n\n`);
|
|
485
|
+
w(`${(0, _theme.colorize)('1.', 'primary')} Crie um projeto:\n`);
|
|
486
|
+
w(` ${(0, _theme.colorize)('mkdir meu-mcp && cd meu-mcp', 'muted')}\n`);
|
|
487
|
+
w(` ${(0, _theme.colorize)('npm init -y', 'muted')}\n`);
|
|
488
|
+
w(` ${(0, _theme.colorize)('npm install @modelcontextprotocol/sdk zod', 'muted')}\n\n`);
|
|
489
|
+
w(`${(0, _theme.colorize)('2.', 'primary')} Crie o servidor (index.ts):\n`);
|
|
490
|
+
w((0, _theme.colorize)(` import { Server } from '@modelcontextprotocol/sdk/server/index.js';\n`, 'muted'));
|
|
491
|
+
w((0, _theme.colorize)(` import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n`, 'muted'));
|
|
492
|
+
w((0, _theme.colorize)(`\n`, 'muted'));
|
|
493
|
+
w((0, _theme.colorize)(` const server = new Server(\n`, 'muted'));
|
|
494
|
+
w((0, _theme.colorize)(` { name: 'meu-mcp', version: '1.0.0' },\n`, 'muted'));
|
|
495
|
+
w((0, _theme.colorize)(` { capabilities: { tools: {} } }\n`, 'muted'));
|
|
496
|
+
w((0, _theme.colorize)(` );\n`, 'muted'));
|
|
497
|
+
w((0, _theme.colorize)(`\n`, 'muted'));
|
|
498
|
+
w((0, _theme.colorize)(` server.setRequestHandler(ListToolsRequestSchema, async () => ({\n`, 'muted'));
|
|
499
|
+
w((0, _theme.colorize)(` tools: [{\n`, 'muted'));
|
|
500
|
+
w((0, _theme.colorize)(` name: 'minha_tool',\n`, 'muted'));
|
|
501
|
+
w((0, _theme.colorize)(` description: 'Faz algo útil',\n`, 'muted'));
|
|
502
|
+
w((0, _theme.colorize)(` inputSchema: {\n`, 'muted'));
|
|
503
|
+
w((0, _theme.colorize)(` type: 'object',\n`, 'muted'));
|
|
504
|
+
w((0, _theme.colorize)(` properties: { nome: { type: 'string' } },\n`, 'muted'));
|
|
505
|
+
w((0, _theme.colorize)(` required: ['nome']\n`, 'muted'));
|
|
506
|
+
w((0, _theme.colorize)(` }\n`, 'muted'));
|
|
507
|
+
w((0, _theme.colorize)(` }]\n`, 'muted'));
|
|
508
|
+
w((0, _theme.colorize)(` }));\n`, 'muted'));
|
|
509
|
+
w((0, _theme.colorize)(`\n`, 'muted'));
|
|
510
|
+
w((0, _theme.colorize)(` server.setRequestHandler(CallToolRequestSchema, async (req) => {\n`, 'muted'));
|
|
511
|
+
w((0, _theme.colorize)(` const args = req.params.arguments;\n`, 'muted'));
|
|
512
|
+
w((0, _theme.colorize)(` return { content: [{ type: 'text', text: 'Resultado!' }] };\n`, 'muted'));
|
|
513
|
+
w((0, _theme.colorize)(` });\n`, 'muted'));
|
|
514
|
+
w((0, _theme.colorize)(`\n`, 'muted'));
|
|
515
|
+
w((0, _theme.colorize)(` const transport = new StdioServerTransport();\n`, 'muted'));
|
|
516
|
+
w((0, _theme.colorize)(` await server.connect(transport);\n`, 'muted'));
|
|
517
|
+
w(`\n`);
|
|
518
|
+
w(`${(0, _theme.colorize)('Opção 2: Python', 'bold')}\n\n`);
|
|
519
|
+
w(` ${(0, _theme.colorize)('pip install mcp', 'muted')}\n\n`);
|
|
520
|
+
w(` Veja: ${(0, _theme.colorize)('https://github.com/modelcontextprotocol/python-sdk', 'accent')}\n\n`);
|
|
521
|
+
w(`${(0, _theme.colorize)('3.', 'primary')} Publique no npm (opcional):\n`);
|
|
522
|
+
w(` Outros poderão usar: ${(0, _theme.colorize)('npx -y seu-mcp-server', 'muted')}\n\n`);
|
|
523
|
+
w(`${(0, _theme.colorize)('Recursos:', 'bold')}\n`);
|
|
524
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} Documentação: https://modelcontextprotocol.io\n`);
|
|
525
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} SDK TypeScript: @modelcontextprotocol/sdk\n`);
|
|
526
|
+
w(` ${(0, _theme.colorize)('•', 'muted')} Exemplos: github.com/modelcontextprotocol/servers\n\n`);
|
|
527
|
+
}
|
|
528
|
+
printMcpHelp() {
|
|
529
|
+
const w = (s)=>process.stdout.write(s);
|
|
530
|
+
w(`\n${(0, _theme.colorize)('☁️ MCP - Guia Rápido', 'bold')}\n`);
|
|
531
|
+
w(`${(0, _theme.colorize)(_theme.Box.horizontal.repeat(40), 'subtle')}\n\n`);
|
|
532
|
+
w(`${(0, _theme.colorize)('Comandos:', 'bold')}\n`);
|
|
533
|
+
w(` ${(0, _theme.colorize)('/mcp', 'cyan')} → Menu interativo\n`);
|
|
534
|
+
w(` ${(0, _theme.colorize)('/mcp list', 'cyan')} → Ver servidores\n`);
|
|
535
|
+
w(` ${(0, _theme.colorize)('/mcp tools', 'cyan')} → Ver ferramentas\n`);
|
|
536
|
+
w(` ${(0, _theme.colorize)('/mcp add', 'cyan')} → Adicionar servidor\n`);
|
|
537
|
+
w(` ${(0, _theme.colorize)('/mcp remove', 'cyan')} → Remover servidor\n`);
|
|
538
|
+
w(` ${(0, _theme.colorize)('/mcp what', 'cyan')} → O que é MCP?\n\n`);
|
|
539
|
+
w(`${(0, _theme.colorize)('Servidores populares:', 'bold')}\n`);
|
|
540
|
+
w(` ${(0, _theme.colorize)('@modelcontextprotocol/server-github', 'muted')}\n`);
|
|
541
|
+
w(` Acesse repositórios, issues, PRs\n\n`);
|
|
542
|
+
w(` ${(0, _theme.colorize)('@figma/mcp-server (HTTP)', 'muted')}\n`);
|
|
543
|
+
w(` Acesse designs e componentes (requer OAuth)\n\n`);
|
|
544
|
+
w(` ${(0, _theme.colorize)('@modelcontextprotocol/server-filesystem', 'muted')}\n`);
|
|
545
|
+
w(` Leia/escrita de arquivos locais\n\n`);
|
|
546
|
+
w(` ${(0, _theme.colorize)('@modelcontextprotocol/server-postgres', 'muted')}\n`);
|
|
547
|
+
w(` Consulte bancos PostgreSQL\n\n`);
|
|
548
|
+
w(` ${(0, _theme.colorize)('@modelcontextprotocol/server-brave-search', 'muted')}\n`);
|
|
549
|
+
w(` Busca na web via Brave\n\n`);
|
|
550
|
+
w(`${(0, _theme.colorize)('Servidores HTTP (OAuth):', 'bold')}\n`);
|
|
551
|
+
w(` Alguns servidores como Figma usam HTTP + OAuth.\n`);
|
|
552
|
+
w(` Após adicionar, a autenticação será solicitada.\n\n`);
|
|
553
|
+
w(`${(0, _theme.colorize)('Configuração manual:', 'bold')}\n`);
|
|
554
|
+
w(` Crie: ${(0, _theme.colorize)('.cast/mcp/nome.json', 'cyan')}\n\n`);
|
|
555
|
+
w((0, _theme.colorize)(` {\n`, 'muted'));
|
|
556
|
+
w((0, _theme.colorize)(` "meu-mcp": {\n`, 'muted'));
|
|
557
|
+
w((0, _theme.colorize)(` "type": "stdio",\n`, 'muted'));
|
|
558
|
+
w((0, _theme.colorize)(` "command": "npx",\n`, 'muted'));
|
|
559
|
+
w((0, _theme.colorize)(` "args": ["-y", "@modelcontextprotocol/server-github"],\n`, 'muted'));
|
|
560
|
+
w((0, _theme.colorize)(` "env": { "GITHUB_TOKEN": "..." }\n`, 'muted'));
|
|
561
|
+
w((0, _theme.colorize)(` }\n`, 'muted'));
|
|
562
|
+
w((0, _theme.colorize)(` }\n`, 'muted'));
|
|
563
|
+
w(`\n`);
|
|
564
|
+
}
|
|
565
|
+
constructor(mcpRegistry, mcpClient){
|
|
566
|
+
this.mcpRegistry = mcpRegistry;
|
|
567
|
+
this.mcpClient = mcpClient;
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
McpCommandsService = _ts_decorate([
|
|
571
|
+
(0, _common.Injectable)(),
|
|
572
|
+
_ts_metadata("design:type", Function),
|
|
573
|
+
_ts_metadata("design:paramtypes", [
|
|
574
|
+
typeof _mcpregistryservice.McpRegistryService === "undefined" ? Object : _mcpregistryservice.McpRegistryService,
|
|
575
|
+
typeof _mcpclientservice.McpClientService === "undefined" ? Object : _mcpclientservice.McpClientService
|
|
576
|
+
])
|
|
577
|
+
], McpCommandsService);
|
|
578
|
+
|
|
579
|
+
//# sourceMappingURL=mcp-commands.service.js.map
|