mcp-state-machine-test-framework 1.0.8 → 1.1.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/README.md +8 -0
- package/mcp_cli.js +33 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,5 +40,13 @@ This framework enforces a "Strict Contract" via MCP tools. Agents are instructed
|
|
|
40
40
|
- [📱 Perfecto Mobile Cloud Setup](./DOCUMENTATION/Perfecto_Setup.md)
|
|
41
41
|
- [🤖 Agent Guidelines](./agent_protocol.md)
|
|
42
42
|
|
|
43
|
+
## 🤖 AI Agent Quickstart (For Copilot/Cursor/Antigravity)
|
|
44
|
+
If you are an AI agent helping with this project, follow these rules:
|
|
45
|
+
1. **Environment**: This is a Node.js project. Always use `npm`.
|
|
46
|
+
2. **Setup**: Install via `npm install mcp-state-machine-test-framework`.
|
|
47
|
+
3. **Configuration**: Use `npx mcp-sms` as the command in `mcp_config.json`.
|
|
48
|
+
4. **Initialization**: Your very first action after installation **MUST** be calling the `init_project` tool to create the directory structure and templates.
|
|
49
|
+
5. **Workflow**: Use `inspect_framework` to understand the current state before proposing changes.
|
|
50
|
+
|
|
43
51
|
---
|
|
44
52
|
*Developed with ❤️ for maximum automation efficiency.*
|
package/mcp_cli.js
CHANGED
|
@@ -8,9 +8,32 @@ import { fileURLToPath } from "url";
|
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
|
|
10
10
|
async function run() {
|
|
11
|
-
|
|
11
|
+
let args = process.argv.slice(2);
|
|
12
|
+
|
|
13
|
+
// Soporte para --help
|
|
14
|
+
if (args.includes("--help") || args.length === 0) {
|
|
15
|
+
console.log(`
|
|
16
|
+
🚀 MCP CLI Client - State Machine Test Framework
|
|
17
|
+
Uso: mcp-cli <server-name> <tool-name> [json-args] [--config path/to/config.json]
|
|
18
|
+
|
|
19
|
+
Ejemplos:
|
|
20
|
+
npx mcp-cli mcp-sms init_project
|
|
21
|
+
npx mcp-cli mcp-sms execute_suite '{"name":"Sanity"}'
|
|
22
|
+
npx mcp-cli mcp-sms upsert_node '{"mapName":"map.json", "nodeName":"HOME", "nodeData":{}}' --config my_custom_config.json
|
|
23
|
+
`);
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Extraer --config si existe
|
|
28
|
+
let configPath = path.join(process.cwd(), "mcp_config.json");
|
|
29
|
+
const configIdx = args.indexOf("--config");
|
|
30
|
+
if (configIdx !== -1) {
|
|
31
|
+
configPath = path.resolve(args[configIdx + 1]);
|
|
32
|
+
args.splice(configIdx, 2); // Quitar --config y su valor de los argumentos
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
if (args.length < 2) {
|
|
13
|
-
console.error("
|
|
36
|
+
console.error("❌ Error: Faltan argumentos. Usa --help para ver el uso correcto.");
|
|
14
37
|
process.exit(1);
|
|
15
38
|
}
|
|
16
39
|
|
|
@@ -20,11 +43,14 @@ async function run() {
|
|
|
20
43
|
// Cargar config
|
|
21
44
|
let config;
|
|
22
45
|
try {
|
|
23
|
-
const configPath = path.join(process.cwd(), "mcp_config.json");
|
|
24
46
|
const content = await fs.readFile(configPath, "utf8");
|
|
25
|
-
|
|
47
|
+
const fullConfig = JSON.parse(content);
|
|
48
|
+
config = (fullConfig.mcpServers && fullConfig.mcpServers[serverName]) || fullConfig[serverName];
|
|
49
|
+
|
|
50
|
+
if (!config) throw new Error(`El servidor '${serverName}' no está en la configuración.`);
|
|
26
51
|
} catch (e) {
|
|
27
|
-
console.error(`❌
|
|
52
|
+
console.error(`❌ Error de configuración: ${e.message}`);
|
|
53
|
+
console.error(`Ruta buscada: ${configPath}`);
|
|
28
54
|
process.exit(1);
|
|
29
55
|
}
|
|
30
56
|
|
|
@@ -38,12 +64,12 @@ async function run() {
|
|
|
38
64
|
const client = new Client({ name: "mcp-cli-client", version: "1.0.0" }, { capabilities: {} });
|
|
39
65
|
await client.connect(transport);
|
|
40
66
|
|
|
41
|
-
console.error(`🚀 Ejecutando
|
|
67
|
+
console.error(`🚀 Ejecutando: ${toolName}`);
|
|
42
68
|
try {
|
|
43
69
|
const result = await client.callTool({ name: toolName, arguments: toolArgs });
|
|
44
70
|
console.log(JSON.stringify(result, null, 2));
|
|
45
71
|
} catch (error) {
|
|
46
|
-
console.error(`❌ Error
|
|
72
|
+
console.error(`❌ Error: ${error.message}`);
|
|
47
73
|
} finally {
|
|
48
74
|
process.exit(0);
|
|
49
75
|
}
|