viewgate-mcp 1.0.4 → 1.0.5
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/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,9 +20,15 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
20
20
|
import fetch from "node-fetch";
|
|
21
21
|
import cors from "cors";
|
|
22
22
|
import dotenv from "dotenv";
|
|
23
|
-
|
|
23
|
+
import path from "path";
|
|
24
|
+
import { fileURLToPath } from "url";
|
|
25
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
+
const __dirname = path.dirname(__filename);
|
|
27
|
+
dotenv.config({ path: path.join(__dirname, "..", ".env") });
|
|
24
28
|
const port = process.env.PORT || 3000;
|
|
25
29
|
const BACKEND_URL = process.env.BACKEND_URL || "https://view-gate.vercel.app";
|
|
30
|
+
console.error(`[MCP Config] BACKEND_URL: ${BACKEND_URL}`);
|
|
31
|
+
console.error(`[MCP Config] API_KEY Prefix: ${process.env.API_KEY?.substring(0, 5)}...`);
|
|
26
32
|
// Store active sessions for SSE: sessionId -> { server, transport }
|
|
27
33
|
const sessions = new Map();
|
|
28
34
|
/**
|
|
@@ -116,7 +122,7 @@ function createMcpServer(apiKey) {
|
|
|
116
122
|
throw new Error(`Backend responded with ${response.status}`);
|
|
117
123
|
}
|
|
118
124
|
const data = (await response.json());
|
|
119
|
-
const rawAnnotations = Array.isArray(data) ? data : (data?.data || []);
|
|
125
|
+
const rawAnnotations = Array.isArray(data) ? data : (data?.data || data?.annotations || []);
|
|
120
126
|
if (!Array.isArray(rawAnnotations)) {
|
|
121
127
|
return {
|
|
122
128
|
content: [{ type: "text", text: "Error: Invalid format" }],
|