viewgate-mcp 1.0.11 → 1.0.12

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 (2) hide show
  1. package/dist/index.js +19 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ const sessions = new Map();
34
34
  /**
35
35
  * Create a new MCP server instance for a specific context.
36
36
  */
37
- function createMcpServer(apiKey) {
37
+ function createMcpServer(apiKey, personalKey) {
38
38
  const server = new Server({
39
39
  name: "viewgate-mcp",
40
40
  version: "1.0.0",
@@ -153,7 +153,8 @@ function createMcpServer(apiKey) {
153
153
  const statuses = 'pending,bug_fixing';
154
154
  const response = await fetch(`${BACKEND_URL}/api/mcp/annotations?status=${statuses}`, {
155
155
  headers: {
156
- 'x-api-key': apiKey
156
+ 'x-api-key': apiKey,
157
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
157
158
  }
158
159
  });
159
160
  if (!response.ok) {
@@ -257,7 +258,8 @@ Instruction: ${ann.message}`
257
258
  method: 'PATCH',
258
259
  headers: {
259
260
  'Content-Type': 'application/json',
260
- 'x-api-key': apiKey
261
+ 'x-api-key': apiKey,
262
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
261
263
  },
262
264
  body: JSON.stringify({ results: args.results })
263
265
  });
@@ -282,7 +284,10 @@ Instruction: ${ann.message}`
282
284
  if (!args.results) {
283
285
  // Fetch Backlog Mode
284
286
  const response = await fetch(`${BACKEND_URL}/api/mcp/backlog`, {
285
- headers: { 'x-api-key': apiKey }
287
+ headers: {
288
+ 'x-api-key': apiKey,
289
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
290
+ }
286
291
  });
287
292
  if (!response.ok) {
288
293
  throw new Error(`Backend responded with ${response.status}`);
@@ -304,7 +309,8 @@ Instruction: ${ann.message}`
304
309
  method: 'PATCH',
305
310
  headers: {
306
311
  'Content-Type': 'application/json',
307
- 'x-api-key': apiKey
312
+ 'x-api-key': apiKey,
313
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
308
314
  },
309
315
  body: JSON.stringify({ results: args.results, force: args.force })
310
316
  });
@@ -334,7 +340,8 @@ Instruction: ${ann.message}`
334
340
  method: 'POST',
335
341
  headers: {
336
342
  'Content-Type': 'application/json',
337
- 'x-api-key': apiKey
343
+ 'x-api-key': apiKey,
344
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
338
345
  },
339
346
  body: JSON.stringify({
340
347
  endpoints: args.endpoints,
@@ -361,7 +368,8 @@ Instruction: ${ann.message}`
361
368
  try {
362
369
  const response = await fetch(`${BACKEND_URL}/api/projects/endpoints`, {
363
370
  headers: {
364
- 'x-api-key': apiKey
371
+ 'x-api-key': apiKey,
372
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
365
373
  }
366
374
  });
367
375
  if (!response.ok) {
@@ -394,11 +402,12 @@ if (!useSSE) {
394
402
  // STDIO Mode (NPM Package Default)
395
403
  // In Stdio mode, we use the API key from environment variable
396
404
  const apiKey = process.env.VIEWGATE_API_KEY || process.env.API_KEY || "";
405
+ const personalKey = process.env.VIEWGATE_PERSONAL_KEY || "";
397
406
  if (!apiKey) {
398
407
  console.error("Error: VIEWGATE_API_KEY environment variable is required in STDIO mode.");
399
408
  process.exit(1);
400
409
  }
401
- const server = createMcpServer(apiKey);
410
+ const server = createMcpServer(apiKey, personalKey);
402
411
  const transport = new StdioServerTransport();
403
412
  server.connect(transport).catch((error) => {
404
413
  console.error("Failed to start Stdio transport:", error);
@@ -422,12 +431,13 @@ else {
422
431
  });
423
432
  app.get("/sse", async (req, res) => {
424
433
  const apiKey = req.query.apiKey || req.headers['x-api-key'];
434
+ const personalKey = req.query.personalKey || req.headers['x-personal-key'];
425
435
  if (!apiKey) {
426
436
  res.status(401).send("API Key is required");
427
437
  return;
428
438
  }
429
439
  const transport = new SSEServerTransport("/message", res);
430
- const server = createMcpServer(apiKey);
440
+ const server = createMcpServer(apiKey, personalKey);
431
441
  await server.connect(transport);
432
442
  const sessionId = transport.sessionId;
433
443
  sessions.set(sessionId, { server, transport });
@@ -443,6 +453,5 @@ else {
443
453
  await session.transport.handlePostMessage(req, res);
444
454
  });
445
455
  app.listen(port, () => {
446
- console.log(`ViewGate MCP (SSE) listening on port ${port}`);
447
456
  });
448
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"