filebread-mcp 0.2.0 → 0.2.1
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 +11 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// If called with a subcommand (init, status, upload, help), run the CLI instead
|
|
4
|
+
const subcommand = process.argv[2];
|
|
5
|
+
if (subcommand && ["init", "status", "upload", "help", "--help"].includes(subcommand)) {
|
|
6
|
+
require("./cli.js");
|
|
7
|
+
process.exitCode = undefined; // let cli.js handle exit
|
|
8
|
+
} else {
|
|
9
|
+
// MCP server mode starts here
|
|
10
|
+
|
|
3
11
|
const readline = require("readline");
|
|
4
12
|
const https = require("https");
|
|
5
13
|
const http = require("http");
|
|
@@ -10,7 +18,7 @@ const API_URL = process.env.FILEBREAD_API_URL || "https://file-bread.fly.dev";
|
|
|
10
18
|
if (!API_KEY) {
|
|
11
19
|
process.stderr.write(
|
|
12
20
|
"[filebread-mcp] Error: FILEBREAD_API_KEY is required.\n" +
|
|
13
|
-
"
|
|
21
|
+
"Run `npx filebread-mcp init` to set up.\n"
|
|
14
22
|
);
|
|
15
23
|
process.exit(1);
|
|
16
24
|
}
|
|
@@ -272,3 +280,5 @@ rl.on("line", (line) => {
|
|
|
272
280
|
});
|
|
273
281
|
|
|
274
282
|
rl.on("close", () => process.exit(0));
|
|
283
|
+
|
|
284
|
+
} // end of MCP server mode
|