gitlab-mcp 0.1.1 → 0.1.2
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/build/index.js +37 -15
- package/package.json +5 -1
package/build/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
4
5
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
6
|
import fetch from "node-fetch";
|
|
6
7
|
import { z } from "zod";
|
|
@@ -10,16 +11,19 @@ import { dirname } from "path";
|
|
|
10
11
|
import fs from "fs";
|
|
11
12
|
import path from "path";
|
|
12
13
|
import { config } from "dotenv";
|
|
14
|
+
import yargs from "yargs";
|
|
15
|
+
import { hideBin } from "yargs/helpers";
|
|
16
|
+
import express from "express";
|
|
13
17
|
import { GitLabForkSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabIssueSchema, GitLabMergeRequestSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabSearchResponseSchema, GitLabTreeSchema, GitLabCommitSchema, GitLabNamespaceSchema, GitLabNamespaceExistsResponseSchema, GitLabProjectSchema, CreateOrUpdateFileSchema, SearchRepositoriesSchema, CreateRepositorySchema, GetFileContentsSchema, PushFilesSchema, CreateIssueSchema, CreateMergeRequestSchema, ForkRepositorySchema, CreateBranchSchema, GitLabMergeRequestDiffSchema, GetMergeRequestSchema, GetMergeRequestDiffsSchema, UpdateMergeRequestSchema, ListIssuesSchema, GetIssueSchema, UpdateIssueSchema, DeleteIssueSchema, GitLabIssueLinkSchema, GitLabIssueWithLinkDetailsSchema, ListIssueLinksSchema, GetIssueLinkSchema, CreateIssueLinkSchema, DeleteIssueLinkSchema, ListNamespacesSchema, GetNamespaceSchema, VerifyNamespaceSchema, GetProjectSchema, ListProjectsSchema, ListLabelsSchema, GetLabelSchema, CreateLabelSchema, UpdateLabelSchema, DeleteLabelSchema, CreateNoteSchema, ListGroupProjectsSchema,
|
|
14
18
|
// Discussion Schemas
|
|
15
19
|
GitLabDiscussionNoteSchema, // Added
|
|
16
20
|
GitLabDiscussionSchema, UpdateMergeRequestNoteSchema, // Added
|
|
17
21
|
ListMergeRequestDiscussionsSchema, } from "./schemas.js";
|
|
18
22
|
// Load .env from the current working directory
|
|
19
|
-
config({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
config({ path: path.resolve(process.cwd(), ".env") });
|
|
24
|
+
const argv = yargs(hideBin(process.argv)).argv;
|
|
25
|
+
const isSSE = argv.mode === "sse";
|
|
26
|
+
const port = argv.port ?? 3044;
|
|
23
27
|
/**
|
|
24
28
|
* Read version from package.json
|
|
25
29
|
*/
|
|
@@ -1636,18 +1640,36 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1636
1640
|
* 서버 초기화 및 실행
|
|
1637
1641
|
*/
|
|
1638
1642
|
async function runServer() {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1643
|
+
if (isSSE) {
|
|
1644
|
+
const app = express();
|
|
1645
|
+
let transport;
|
|
1646
|
+
app.get("/sse", async (req, res) => {
|
|
1647
|
+
console.log("Establishing new SSE connection");
|
|
1648
|
+
transport = new SSEServerTransport("/messages", res);
|
|
1649
|
+
await server.connect(transport);
|
|
1650
|
+
server.onclose = async () => {
|
|
1651
|
+
await server.close();
|
|
1652
|
+
process.exit(0);
|
|
1653
|
+
};
|
|
1654
|
+
});
|
|
1655
|
+
app.post("/messages", async (req, res) => {
|
|
1656
|
+
await transport?.handlePostMessage(req, res);
|
|
1657
|
+
});
|
|
1647
1658
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1659
|
+
else {
|
|
1660
|
+
try {
|
|
1661
|
+
console.error("========================");
|
|
1662
|
+
console.error(`GitLab MCP Server v${SERVER_VERSION}`);
|
|
1663
|
+
console.error(`API URL: ${GITLAB_API_URL}`);
|
|
1664
|
+
console.error("========================");
|
|
1665
|
+
const transport = new StdioServerTransport();
|
|
1666
|
+
await server.connect(transport);
|
|
1667
|
+
console.error("GitLab MCP Server running on stdio");
|
|
1668
|
+
}
|
|
1669
|
+
catch (error) {
|
|
1670
|
+
console.error("Error initializing server:", error);
|
|
1671
|
+
process.exit(1);
|
|
1672
|
+
}
|
|
1651
1673
|
}
|
|
1652
1674
|
}
|
|
1653
1675
|
runServer().catch((error) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitlab-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Model Context Protocol server for GitLab integration",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@modelcontextprotocol/sdk": "1.8.0",
|
|
29
|
+
"@types/express": "^5.0.1",
|
|
29
30
|
"@types/node-fetch": "^2.6.12",
|
|
31
|
+
"@types/yargs": "^17.0.33",
|
|
30
32
|
"node-fetch": "^3.3.2",
|
|
31
33
|
"zod-to-json-schema": "^3.23.5"
|
|
32
34
|
},
|
|
@@ -34,7 +36,9 @@
|
|
|
34
36
|
"@modelcontextprotocol/sdk": "1.8.0",
|
|
35
37
|
"@types/node-fetch": "^2.6.12",
|
|
36
38
|
"dotenv": "^16.5.0",
|
|
39
|
+
"express": "^5.1.0",
|
|
37
40
|
"node-fetch": "^3.3.2",
|
|
41
|
+
"yargs": "^17.7.2",
|
|
38
42
|
"zod-to-json-schema": "^3.23.5"
|
|
39
43
|
}
|
|
40
44
|
}
|