gitlab-mcp 0.0.1 → 0.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.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * This test file verifies that the createNote function works correctly
3
+ * with the fixed endpoint URL construction that uses plural resource names
4
+ * (issues instead of issue, merge_requests instead of merge_request).
5
+ */
6
+ import fetch from "node-fetch";
7
+ // GitLab API configuration (replace with actual values when testing)
8
+ const GITLAB_API_URL = process.env.GITLAB_API_URL || "https://gitlab.com";
9
+ const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_TOKEN || "";
10
+ const PROJECT_ID = process.env.PROJECT_ID || "your/project";
11
+ const ISSUE_IID = Number(process.env.ISSUE_IID || "1");
12
+ async function testCreateIssueNote() {
13
+ try {
14
+ // Using plural form "issues" in the URL
15
+ const url = new URL(`${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(PROJECT_ID)}/issues/${ISSUE_IID}/notes`);
16
+ const response = await fetch(url.toString(), {
17
+ method: "POST",
18
+ headers: {
19
+ Accept: "application/json",
20
+ "Content-Type": "application/json",
21
+ Authorization: `Bearer ${GITLAB_PERSONAL_ACCESS_TOKEN}`,
22
+ },
23
+ body: JSON.stringify({ body: "Test note from API - with plural endpoint" }),
24
+ });
25
+ if (!response.ok) {
26
+ const errorBody = await response.text();
27
+ throw new Error(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
28
+ }
29
+ const data = await response.json();
30
+ console.log("Successfully created note:");
31
+ console.log(JSON.stringify(data, null, 2));
32
+ return true;
33
+ }
34
+ catch (error) {
35
+ console.error("Error creating note:", error);
36
+ return false;
37
+ }
38
+ }
39
+ // Only run the test if executed directly
40
+ if (require.main === module) {
41
+ console.log("Testing note creation with plural 'issues' endpoint...");
42
+ testCreateIssueNote().then(success => {
43
+ if (success) {
44
+ console.log("✅ Test successful!");
45
+ process.exit(0);
46
+ }
47
+ else {
48
+ console.log("❌ Test failed!");
49
+ process.exit(1);
50
+ }
51
+ });
52
+ }
53
+ // Export for use in other tests
54
+ export { testCreateIssueNote };
package/package.json CHANGED
@@ -1,11 +1,40 @@
1
1
  {
2
2
  "name": "gitlab-mcp",
3
- "version": "0.0.1",
4
- "main": "index.js",
3
+ "version": "0.1.1",
4
+ "description": "Model Context Protocol server for GitLab integration",
5
+ "main": "./build/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "gitlab-mcp": "build/index.js"
9
+ },
10
+ "files": [
11
+ "build"
12
+ ],
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
5
16
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
17
+ "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
18
+ "prepare": "npm run build",
19
+ "watch": "tsc --watch",
20
+ "deploy": "npm publish --access public"
21
+ },
22
+ "engines": {
23
+ "node": ">=18.0.0"
7
24
  },
8
25
  "author": "unadlib",
9
- "license": "ISC",
10
- "description": ""
26
+ "license": "MIT",
27
+ "devDependencies": {
28
+ "@modelcontextprotocol/sdk": "1.8.0",
29
+ "@types/node-fetch": "^2.6.12",
30
+ "node-fetch": "^3.3.2",
31
+ "zod-to-json-schema": "^3.23.5"
32
+ },
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "1.8.0",
35
+ "@types/node-fetch": "^2.6.12",
36
+ "dotenv": "^16.5.0",
37
+ "node-fetch": "^3.3.2",
38
+ "zod-to-json-schema": "^3.23.5"
39
+ }
11
40
  }