mta-mcp 2.10.0 → 2.12.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/bin/mta.cjs +29 -0
- package/package.json +1 -1
package/bin/mta.cjs
CHANGED
|
@@ -27,6 +27,35 @@ const packageRoot = join(__dirname, '..');
|
|
|
27
27
|
// 处理 CLI 参数
|
|
28
28
|
const args = process.argv.slice(2);
|
|
29
29
|
|
|
30
|
+
// --get-agent <id>: 获取指定 Agent 的完整内容
|
|
31
|
+
const getAgentIndex = args.indexOf('--get-agent');
|
|
32
|
+
if (getAgentIndex !== -1) {
|
|
33
|
+
const agentId = args[getAgentIndex + 1];
|
|
34
|
+
|
|
35
|
+
if (!agentId) {
|
|
36
|
+
console.log(JSON.stringify({ error: '请提供 Agent ID', content: null }));
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const agentsDir = join(packageRoot, 'agents');
|
|
41
|
+
const agentFile = join(agentsDir, `${agentId}.agent.md`);
|
|
42
|
+
|
|
43
|
+
if (!existsSync(agentFile)) {
|
|
44
|
+
console.log(JSON.stringify({ error: `Agent 不存在: ${agentId}`, content: null }));
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const content = readFileSync(agentFile, 'utf-8');
|
|
50
|
+
console.log(JSON.stringify({ content }));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log(JSON.stringify({ error: `读取 Agent 失败: ${e.message}`, content: null }));
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
30
59
|
// --list-agents: 列出所有可用的 Agents
|
|
31
60
|
if (args.includes('--list-agents')) {
|
|
32
61
|
const agentsDir = join(packageRoot, 'agents');
|