workfullcircle-mcp-local 1.4.1 → 1.4.3
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/index.js +26 -10
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -14,7 +14,8 @@ function printUsage() {
|
|
|
14
14
|
function parseArgs(argv) {
|
|
15
15
|
const parsed = {
|
|
16
16
|
token: null,
|
|
17
|
-
url: process.env.WFC_API_URL || 'https://workfullcircle.com'
|
|
17
|
+
url: process.env.WFC_API_URL || 'https://workfullcircle.com',
|
|
18
|
+
project: null
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -24,6 +25,9 @@ function parseArgs(argv) {
|
|
|
24
25
|
} else if (argv[i] === '--url') {
|
|
25
26
|
parsed.url = argv[i + 1];
|
|
26
27
|
i++;
|
|
28
|
+
} else if (argv[i] === '--project') {
|
|
29
|
+
parsed.project = argv[i + 1];
|
|
30
|
+
i++;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -32,6 +36,11 @@ function parseArgs(argv) {
|
|
|
32
36
|
parsed.token = process.env.WFC_TOKEN;
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
// Fallback to environment variable for project
|
|
40
|
+
if (!parsed.project) {
|
|
41
|
+
parsed.project = process.env.WFC_PROJECT;
|
|
42
|
+
}
|
|
43
|
+
|
|
35
44
|
if (!parsed.token) {
|
|
36
45
|
printUsage();
|
|
37
46
|
}
|
|
@@ -39,7 +48,7 @@ function parseArgs(argv) {
|
|
|
39
48
|
return parsed;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
const { token: API_TOKEN, url: API_URL } = parseArgs(args);
|
|
51
|
+
const { token: API_TOKEN, url: API_URL, project: PROJECT_ID } = parseArgs(args);
|
|
43
52
|
|
|
44
53
|
// Create HTTPS agent with keepAlive disabled to prevent stale connections
|
|
45
54
|
const httpsAgent = new https.Agent({
|
|
@@ -53,13 +62,20 @@ async function makeRequest(url, payload, retryCount = 0) {
|
|
|
53
62
|
const timeout = setTimeout(() => controller.abort(), 15000); // 15s timeout
|
|
54
63
|
|
|
55
64
|
try {
|
|
65
|
+
const requestHeaders = {
|
|
66
|
+
'Content-Type': 'application/json',
|
|
67
|
+
'Authorization': `Bearer ${API_TOKEN}`,
|
|
68
|
+
'Connection': 'close' // Explicitly request connection close
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Add project ID header if available
|
|
72
|
+
if (PROJECT_ID) {
|
|
73
|
+
requestHeaders['X-Project-ID'] = PROJECT_ID;
|
|
74
|
+
}
|
|
75
|
+
|
|
56
76
|
const response = await fetch(url, {
|
|
57
77
|
method: 'POST',
|
|
58
|
-
headers:
|
|
59
|
-
'Content-Type': 'application/json',
|
|
60
|
-
'Authorization': `Bearer ${API_TOKEN}`,
|
|
61
|
-
'Connection': 'close' // Explicitly request connection close
|
|
62
|
-
},
|
|
78
|
+
headers: requestHeaders,
|
|
63
79
|
body: JSON.stringify(payload),
|
|
64
80
|
agent: httpsAgent,
|
|
65
81
|
signal: controller.signal
|
|
@@ -123,12 +139,12 @@ async function handleStdio() {
|
|
|
123
139
|
process.stdout.write(`${responseText}\n`);
|
|
124
140
|
} catch (error) {
|
|
125
141
|
console.error(`MCP request failed: ${error.message}`);
|
|
126
|
-
// Send error response back to MCP client
|
|
142
|
+
// Send error response back to MCP client in proper JSON-RPC format
|
|
127
143
|
const errorResponse = JSON.stringify({
|
|
128
144
|
jsonrpc: "2.0",
|
|
129
|
-
id: payload.id || null
|
|
145
|
+
id: payload.id || "error-response", // Never use null for JSON-RPC compliance
|
|
130
146
|
error: {
|
|
131
|
-
code: -
|
|
147
|
+
code: -32000, // Server error code
|
|
132
148
|
message: `Request failed: ${error.message}`
|
|
133
149
|
}
|
|
134
150
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "workfullcircle-mcp-local",
|
|
4
|
-
"version": "1.4.
|
|
5
|
-
"description": "Local STDIO MCP server for WorkFullCircle API with connection leak fixes",
|
|
4
|
+
"version": "1.4.3",
|
|
5
|
+
"description": "Local STDIO MCP server for WorkFullCircle API with project ID support and connection leak fixes",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"workfullcircle-mcp-local": "index.js"
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"windsurf",
|
|
21
21
|
"antigravity",
|
|
22
22
|
"path-fix",
|
|
23
|
-
"plug-and-play"
|
|
23
|
+
"plug-and-play",
|
|
24
|
+
"project-id"
|
|
24
25
|
],
|
|
25
26
|
"author": "Afreensiyad",
|
|
26
27
|
"license": "MIT",
|