@skyramp/mcp 0.0.2 → 0.0.4

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 CHANGED
@@ -83,9 +83,11 @@ Add the following configuration. For more information, read the [Cursor MCP docu
83
83
  }
84
84
  ```
85
85
 
86
- [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=skyramp-mcp&config=eyJjb21tYW5kIjoibnB4IC15IEBza3lyYW1wL21jcEBsYXRlc3QifQ==)
86
+ [![Install MCP Server on MacOS](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=skyramp-mcp&config=eyJjb21tYW5kIjoibnB4IC15IEBza3lyYW1wL21jcEBsYXRlc3QifQ==)
87
87
 
88
- **For Claude Desktop, you must set the `HOME` environment variable in your MCP server configuration.**
88
+ ### Note: To pull latest changes restart the MCP server
89
+
90
+ ### For Claude Desktop, you must set the `HOME` environment variable in your MCP server configuration
89
91
 
90
92
  This is required because some tools expect a valid home directory for file operations. Set `HOME` to the path where you want Skyramp to generate and execute tests. For example:
91
93
 
@@ -118,7 +120,7 @@ On Windows, you might need to use this alternative configuration:
118
120
  }
119
121
  ```
120
122
 
121
- [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=skyramp-mcp&config=eyJjb21tYW5kIjoiY21kIC9rIG5weCAteSBAc2t5cmFtcC9tY3BAbGF0ZXN0In0=)
123
+ [![Install MCP Server on Windows](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=skyramp-mcp&config=eyJjb21tYW5kIjoiY21kIC9rIG5weCAteSBAc2t5cmFtcC9tY3BAbGF0ZXN0In0=)
122
124
 
123
125
  ## Available tools
124
126
 
@@ -5,6 +5,7 @@ import { logger } from "../utils/logger.js";
5
5
  const isDockerEnv = process.env.MCP_SERVER_RUNTIME === "docker";
6
6
  logger.info("MCP server runtime environment", { isDockerEnv });
7
7
  export function registerStartTraceCollectionPrompt(mcpServer) {
8
+ logger.info("registering start trace collection prompt");
8
9
  mcpServer.prompt("skyramp_trace_prompt", "Skyramp trace collection prompt", {
9
10
  include: z
10
11
  .string()
@@ -1,18 +1,11 @@
1
1
  // src/prompts/skyrampPrompt.ts
2
- import { z } from "zod";
3
2
  import { logger } from "../utils/logger.js";
4
3
  // read env variable and use it to set custom prompt
5
4
  const isDockerEnv = process.env.MCP_SERVER_RUNTIME === "docker";
6
5
  logger.info("MCP server runtime environment", { isDockerEnv });
7
6
  export function registerTestGenerationPrompt(mcpServer) {
8
- mcpServer.prompt("skyramp_test_generation_prompt", "Skyramp test generation prompt", {
9
- endpointURL: z.string().optional(),
10
- outputDir: z.string().optional(),
11
- trace: z.string().optional().describe("MUST be absolute path"),
12
- playwrightTrace: z.string().optional().describe("MUST be absolute path"),
13
- schemaInput: z.string().optional().describe("MUST be absolute path"),
14
- parameters: z.string().optional(),
15
- }, ({ endpointURL, outputDir, trace, playwrightTrace, schemaInput, parameters, }) => ({
7
+ logger.info("test generation prompt");
8
+ mcpServer.prompt("skyramp_test_generation_prompt", "Skyramp test generation prompt", {}, () => ({
16
9
  messages: [
17
10
  {
18
11
  role: "user",
@@ -18,17 +18,111 @@ export class TestGenerationService {
18
18
  return apiAnalysisResult;
19
19
  }
20
20
  const result = await this.executeGeneration(generateOptions);
21
+ let modularizedResultPrompt = `
22
+ **IMPORTANT: Now please modularize the code by**
23
+
24
+ 1. Group related lines logically (e.g., login steps together) to improve readability.
25
+ 2. Parameterize the test function(s) with meaningful parameters to make it more flexible. Preserve the original order of code lines within each function
26
+ 3. Do not change or remove any existing lines of code, variable names, function names, or function structures.
27
+ 4. Only extract reusable logical sections into helper functions or parameterized structures where applicable.
28
+ 5. Do not create any new test cases but only helper functions.
29
+ 6. Make sure the logic is same and the test works as expected.
30
+ 7. Do not add any new logic or classes or any other files.
31
+
32
+ Please refactor the code with these modularization principles.
33
+ `;
34
+ let languageSteps = "";
35
+ switch (params.language) {
36
+ case "python":
37
+ // python steps
38
+ languageSteps += `
39
+ # Install skyramp dependency
40
+ pip3 install skyramp
41
+ `;
42
+ // e2e and ui tests
43
+ if (params.testType == "e2e" || params.testType == "ui") {
44
+ languageSteps += `
45
+ # Install playwright dependencies
46
+ pip3 install pytest-playwright
47
+ # Execute the test file
48
+ python3 -m pytest --browser chromium <test-file>.py
49
+ `;
50
+ }
51
+ //framework pytest
52
+ languageSteps += `
53
+ # Install pytest dependency
54
+ pip3 install pytest
55
+
56
+ # Execution test file
57
+ python3 -m pytest <test-file>.py
58
+ `;
59
+ // robot framework
60
+ languageSteps += `
61
+ # Install robotframework dependency
62
+ pip3 install robotframework
63
+
64
+ # Execution of test file
65
+ python3 -m robot <robot-file>.robot
66
+ `;
67
+ break;
68
+ case "javascript":
69
+ languageSteps += `
70
+ # install dependencies for package.json
71
+ npm install @skyramp/skyramp @playwright/test
72
+
73
+ # Execution of test file
74
+ npx playwright test <test-file>.spec.js --reporter=list
75
+ `;
76
+ break;
77
+ case "typescript":
78
+ languageSteps += `
79
+ # install dependencies for package.json
80
+ npm install @skyramp/skyramp @playwright/test
81
+
82
+ # Execution of test file
83
+ npx playwright test <test-file>.spec.ts --reporter=list
84
+ `;
85
+ break;
86
+ case "java":
87
+ languageSteps += `
88
+ # Prerequisites
89
+ # Compile the test file
90
+ javac -cp "./lib/*" -d target <test-file>.java
91
+
92
+ # Execution of test file
93
+ JUNIT_PLATFORM_VER="1.9.3"
94
+ classpath="target:$(echo ./lib/*.jar | tr ' ' ':')"
95
+ java -jar "./lib/junit-platform-console-standalone-\${JUNIT_PLATFORM_VER}.jar" \\
96
+ --classpath "\$classpath" \\
97
+ --include-engine=junit-jupiter \\
98
+ --select-class=<test-file> \\
99
+ --reports-dir=target/test-results
100
+ `;
101
+ break;
102
+ }
103
+ let isError = false;
104
+ // check the result include 'Successfully generated/updated tests files:'
105
+ if (!result.includes("Successfully generated/updated tests files:")) {
106
+ isError = true;
107
+ }
108
+ const testType = this.getTestType();
109
+ const shouldModularize = testType == "ui" || testType == "e2e";
21
110
  return {
22
111
  content: [
23
112
  {
24
113
  type: "text",
25
- text: `${result}
114
+ text: `${shouldModularize
115
+ ? "Generated the test and WILL NOW MODULARIZE THE CODE USING THE FOLLOWING MODULARIZATION PRINCIPLES"
116
+ : "Generated the test and DO NOT MODULARIZE THE CODE"}
117
+ ${result} ${shouldModularize ? modularizedResultPrompt : ""}
118
+ ${languageSteps}
26
119
 
27
- If the test is successfully created, I can go ahead and refactor your test code to make it modular and reusable?
28
- Reply "yes" to continue, or "no" to skip this step.`,
120
+ - Notify the user that they can also use **Execute with Skyramp** tool to run the test. If this is your first test you are trying to execute with Skyramp, it may take a little bit longer than usual.
121
+ - Before I can execute the test for you, I need to confirm the following information:
122
+ Authentication: Please provide me with your authentication token (by default we assume a Bearer Token). If you don't require any token for your service please just say: 'No token required'`,
29
123
  },
30
124
  ],
31
- isError: false,
125
+ isError: isError,
32
126
  };
33
127
  }
34
128
  catch (error) {
@@ -13,7 +13,9 @@ const LANGUAGE_PATHS = {
13
13
  export function registerExecuteSkyrampTestTool(server) {
14
14
  server.registerTool("skyramp_execute_test", {
15
15
  description: `Execute a Skyramp test to validate your application using isolated containerized environments.
16
- Before I can execute the test for you, I need to confirm the following information:
16
+ IMPORTANT: Follow the instructions below to execute the test.
17
+ - Notify the user that the first time the tool is used, it will take some time to pull the image.
18
+ - Before I can execute the test for you, I need to confirm the following information:
17
19
  Authentication: Please provide me with your authentication token (by default we assume a Bearer Token). If you don't require any token for your service please just say: 'No token required'`,
18
20
  inputSchema: {
19
21
  language: z
@@ -27,7 +29,7 @@ export function registerExecuteSkyrampTestTool(server) {
27
29
  .describe("ALWAYS USE ABSOLUTE PATH to the test file to execute"),
28
30
  token: z
29
31
  .string()
30
- .describe("Skyramp authentication token for test execution. Use '' when user confirms 'No token required'"),
32
+ .describe("Skyramp authentication token for test execution. USE EMPTY STRING WHEN USER CONFIRMS 'No token required'"),
31
33
  },
32
34
  annotations: {
33
35
  keywords: ["run test", "execute test"],
@@ -98,7 +100,7 @@ export function registerExecuteSkyrampTestTool(server) {
98
100
  stream.end();
99
101
  statusCode = result.StatusCode;
100
102
  logger.debug("Docker container execution completed");
101
- return container.remove();
103
+ return container;
102
104
  })
103
105
  .then(function (data) {
104
106
  logger.debug("Docker container removed successfully");
@@ -73,7 +73,7 @@ export const baseTestSchema = {
73
73
  method: z
74
74
  .string()
75
75
  .optional()
76
- .describe("HTTP method to use (GET, POST, PUT, DELETE, etc.)"),
76
+ .describe("HTTP method to use (GET, POST, PUT, DELETE, etc.). DO NOT ASSUME METHOD IF NOT PROVIDED AND TRY TO DETECT THE METHOD FROM OPENAPI SCHEMA"),
77
77
  apiSchema: z
78
78
  .string()
79
79
  .optional()
@@ -97,5 +97,5 @@ export const baseTestSchema = {
97
97
  responseStatusCode: z
98
98
  .string()
99
99
  .optional()
100
- .describe("Expected HTTP response status code (e.g., '200', '201', '404')"),
100
+ .describe("Expected HTTP response status code (e.g., '200', '201', '404'). DO NOT ASSUME STATUS CODE IF NOT PROVIDED AND TRY TO DETECT THE STATUS CODE FROM OPENAPI SCHEMA"),
101
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/mcp",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "main": "build/index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,4 +58,4 @@
58
58
  "engines": {
59
59
  "node": ">=18"
60
60
  }
61
- }
61
+ }