mcp-state-machine-test-framework 1.0.9 → 1.1.1
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/.mcp_agent_rules +20 -0
- package/mcp_cli.js +33 -7
- package/package.json +1 -1
package/.mcp_agent_rules
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 🤖 Rules for AI Agents (Copilot, Cursor, etc.)
|
|
2
|
+
|
|
3
|
+
## 🚀 Environment & Tools
|
|
4
|
+
- This is a **Node.js** project using **npm**.
|
|
5
|
+
- You have **FULL PERMISSION** to execute terminal commands and create/modify files.
|
|
6
|
+
- The primary framework is `mcp-state-machine-test-framework`.
|
|
7
|
+
|
|
8
|
+
## 🛠️ Mandatory Workflow
|
|
9
|
+
1. **Never ask for language or setup details**: Read `package.json` and `README.md` first.
|
|
10
|
+
2. **Initialization**: If folders are missing, run the `init_project` tool immediately.
|
|
11
|
+
3. **Structured Design**: DO NOT edit JSON files in `/maps`, `/suites`, or `/test_cases` directly. ALWAYS use the provided MCP tools (`upsert_node`, `save_test_case`, `save_suite`).
|
|
12
|
+
4. **Validation**: Use `inspect_framework` to verify integrity before finalizing any task.
|
|
13
|
+
|
|
14
|
+
## 🏁 How to Start
|
|
15
|
+
- Run `npm install mcp-state-machine-test-framework` if not present.
|
|
16
|
+
- Configure `mcp_config.json` in the root.
|
|
17
|
+
- Use `npx mcp-cli --help` to understand CLI usage if needed.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
*Follow these rules to ensure high-fidelity automation.*
|
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
|
}
|