gitlab-mcp 0.1.5 → 1.0.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.
Files changed (55) hide show
  1. package/.dockerignore +7 -0
  2. package/.editorconfig +9 -0
  3. package/.env.example +75 -0
  4. package/.github/workflows/nodejs.yml +31 -0
  5. package/.github/workflows/npm-publish.yml +31 -0
  6. package/.husky/pre-commit +1 -0
  7. package/.nvmrc +1 -0
  8. package/.prettierrc.json +6 -0
  9. package/Dockerfile +20 -0
  10. package/README.md +416 -251
  11. package/docker-compose.yml +10 -0
  12. package/docs/architecture.md +310 -0
  13. package/docs/authentication.md +299 -0
  14. package/docs/configuration.md +149 -0
  15. package/docs/deployment.md +336 -0
  16. package/docs/tools.md +294 -0
  17. package/eslint.config.js +23 -0
  18. package/package.json +70 -32
  19. package/scripts/get-oauth-token.example.sh +15 -0
  20. package/src/config/env.ts +171 -0
  21. package/src/http.ts +605 -0
  22. package/src/index.ts +77 -0
  23. package/src/lib/auth-context.ts +19 -0
  24. package/src/lib/gitlab-client.ts +1810 -0
  25. package/src/lib/logger.ts +17 -0
  26. package/src/lib/network.ts +45 -0
  27. package/src/lib/oauth.ts +287 -0
  28. package/src/lib/output.ts +51 -0
  29. package/src/lib/policy.ts +78 -0
  30. package/src/lib/request-runtime.ts +376 -0
  31. package/src/lib/sanitize.ts +25 -0
  32. package/src/server/build-server.ts +17 -0
  33. package/src/tools/gitlab.ts +3128 -0
  34. package/src/tools/health.ts +27 -0
  35. package/src/tools/mr-code-context.ts +473 -0
  36. package/src/types/context.ts +13 -0
  37. package/tests/auth-context.test.ts +102 -0
  38. package/tests/gitlab-client.test.ts +674 -0
  39. package/tests/graphql-guard.test.ts +121 -0
  40. package/tests/integration/agent-loop.integration.test.ts +552 -0
  41. package/tests/integration/server.integration.test.ts +543 -0
  42. package/tests/mr-code-context.test.ts +600 -0
  43. package/tests/oauth.test.ts +43 -0
  44. package/tests/output.test.ts +186 -0
  45. package/tests/policy.test.ts +324 -0
  46. package/tests/request-runtime.test.ts +252 -0
  47. package/tests/sanitize.test.ts +123 -0
  48. package/tests/upload-reference.test.ts +84 -0
  49. package/tsconfig.build.json +11 -0
  50. package/tsconfig.json +21 -0
  51. package/vitest.config.ts +12 -0
  52. package/LICENSE +0 -21
  53. package/build/index.js +0 -1642
  54. package/build/schemas.js +0 -684
  55. package/build/test-note.js +0 -54
@@ -1,54 +0,0 @@
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 };