fless-mcp 1.1.1 → 1.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/index.js +16 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,7 +9,14 @@ import { request } from 'node:https';
|
|
|
9
9
|
import { request as httpRequest } from 'node:http';
|
|
10
10
|
|
|
11
11
|
const REMOTE = process.env.FLESS_MCP_URL || 'https://mcp.fless.io/mcp';
|
|
12
|
-
const UA = process.env.FLESS_MCP_UA || 'fless-mcp-npm/1.
|
|
12
|
+
const UA = process.env.FLESS_MCP_UA || 'fless-mcp-npm/1.1.2 (+https://fless.io/ai-agents)';
|
|
13
|
+
|
|
14
|
+
let inflight = 0;
|
|
15
|
+
let stdinClosed = false;
|
|
16
|
+
|
|
17
|
+
function maybeExit() {
|
|
18
|
+
if (stdinClosed && inflight === 0) process.exit(0);
|
|
19
|
+
}
|
|
13
20
|
|
|
14
21
|
const rl = createInterface({ input: process.stdin });
|
|
15
22
|
|
|
@@ -27,6 +34,7 @@ rl.on('line', (line) => {
|
|
|
27
34
|
|
|
28
35
|
const url = new URL(REMOTE);
|
|
29
36
|
const mod = url.protocol === 'https:' ? request : httpRequest;
|
|
37
|
+
inflight++;
|
|
30
38
|
const req = mod(url, {
|
|
31
39
|
method: 'POST',
|
|
32
40
|
headers: {
|
|
@@ -51,6 +59,8 @@ rl.on('line', (line) => {
|
|
|
51
59
|
process.stdout.write(body.replace(/\n$/, '') + '\n');
|
|
52
60
|
}
|
|
53
61
|
process.stdout.write('');
|
|
62
|
+
inflight--;
|
|
63
|
+
maybeExit();
|
|
54
64
|
});
|
|
55
65
|
});
|
|
56
66
|
|
|
@@ -58,6 +68,8 @@ rl.on('line', (line) => {
|
|
|
58
68
|
const err = { jsonrpc: '2.0', id: parsed.id ?? null,
|
|
59
69
|
error: { code: -32000, message: `fless-mcp proxy error: ${e.message}` } };
|
|
60
70
|
process.stdout.write(JSON.stringify(err) + '\n');
|
|
71
|
+
inflight--;
|
|
72
|
+
maybeExit();
|
|
61
73
|
});
|
|
62
74
|
|
|
63
75
|
req.on('timeout', () => {
|
|
@@ -65,10 +77,12 @@ rl.on('line', (line) => {
|
|
|
65
77
|
const err = { jsonrpc: '2.0', id: parsed.id ?? null,
|
|
66
78
|
error: { code: -32000, message: 'fless-mcp proxy timeout (120s)' } };
|
|
67
79
|
process.stdout.write(JSON.stringify(err) + '\n');
|
|
80
|
+
inflight--;
|
|
81
|
+
maybeExit();
|
|
68
82
|
});
|
|
69
83
|
|
|
70
84
|
req.write(line);
|
|
71
85
|
req.end();
|
|
72
86
|
});
|
|
73
87
|
|
|
74
|
-
rl.on('close', () =>
|
|
88
|
+
rl.on('close', () => { stdinClosed = true; maybeExit(); });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fless-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Fless apartment-hunting MCP server \u2014 research cities, neighborhoods, rents, and build pre-filled hunt links. Stdio proxy to https://mcp.fless.io/mcp.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"type": "module",
|