story-vault-mcp 2.0.2 → 2.0.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/dist/index.cjs +32 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49558,12 +49558,12 @@ function debugLog(message) {
|
|
|
49558
49558
|
targets.add(import_node_path.default.join(process.env.STORY_VAULT_DATA_DIR, "mcp-debug.log"));
|
|
49559
49559
|
}
|
|
49560
49560
|
targets.add(import_node_path.default.resolve(process.cwd(), "mcp-debug.log"));
|
|
49561
|
-
|
|
49561
|
+
targets.forEach((target) => {
|
|
49562
49562
|
try {
|
|
49563
49563
|
import_node_fs.default.appendFileSync(target, line, "utf-8");
|
|
49564
49564
|
} catch {
|
|
49565
49565
|
}
|
|
49566
|
-
}
|
|
49566
|
+
});
|
|
49567
49567
|
}
|
|
49568
49568
|
debugLog(
|
|
49569
49569
|
`=== story-vault-mcp started ===
|
|
@@ -50489,8 +50489,7 @@ var TOOLS = [
|
|
|
50489
50489
|
}
|
|
50490
50490
|
}
|
|
50491
50491
|
];
|
|
50492
|
-
|
|
50493
|
-
initDb();
|
|
50492
|
+
function buildMcpServer() {
|
|
50494
50493
|
const server = new Server(
|
|
50495
50494
|
{ name: "story-vault", version: "2.0.0" },
|
|
50496
50495
|
{ capabilities: { tools: {} } }
|
|
@@ -50515,25 +50514,33 @@ async function main() {
|
|
|
50515
50514
|
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
50516
50515
|
}
|
|
50517
50516
|
});
|
|
50517
|
+
return server;
|
|
50518
|
+
}
|
|
50519
|
+
async function startMcpHttpServer(server, port) {
|
|
50520
|
+
const transport = new StreamableHTTPServerTransport({
|
|
50521
|
+
sessionIdGenerator: () => (0, import_node_crypto.randomUUID)()
|
|
50522
|
+
});
|
|
50523
|
+
await server.connect(transport);
|
|
50524
|
+
const app = (0, import_express.default)();
|
|
50525
|
+
app.use(localhostHostValidation());
|
|
50526
|
+
app.all("/mcp", async (req, res) => {
|
|
50527
|
+
try {
|
|
50528
|
+
await transport.handleRequest(req, res, void 0);
|
|
50529
|
+
} catch (err) {
|
|
50530
|
+
console.error("MCP handler error:", err);
|
|
50531
|
+
if (!res.headersSent) res.status(500).json({ error: "MCP handler error: " + (err instanceof Error ? err.message : String(err)) });
|
|
50532
|
+
}
|
|
50533
|
+
});
|
|
50534
|
+
app.listen(port, "127.0.0.1", () => {
|
|
50535
|
+
console.error(`Story Vault MCP server (HTTP) listening on http://127.0.0.1:${port}/mcp`);
|
|
50536
|
+
debugLog(`HTTP transport listening on http://127.0.0.1:${port}/mcp`);
|
|
50537
|
+
});
|
|
50538
|
+
}
|
|
50539
|
+
async function runStandalone() {
|
|
50540
|
+
initDb();
|
|
50541
|
+
const server = buildMcpServer();
|
|
50518
50542
|
if (TRANSPORT_MODE === "http") {
|
|
50519
|
-
|
|
50520
|
-
const transport = new StreamableHTTPServerTransport({
|
|
50521
|
-
sessionIdGenerator: () => (0, import_node_crypto.randomUUID)()
|
|
50522
|
-
});
|
|
50523
|
-
await server.connect(transport);
|
|
50524
|
-
const app = (0, import_express.default)();
|
|
50525
|
-
app.use(localhostHostValidation());
|
|
50526
|
-
app.all("/mcp", async (req, res) => {
|
|
50527
|
-
try {
|
|
50528
|
-
await transport.handleRequest(req, res, void 0);
|
|
50529
|
-
} catch (err) {
|
|
50530
|
-
console.error("MCP handler error:", err);
|
|
50531
|
-
if (!res.headersSent) res.status(500).json({ error: "MCP handler error: " + (err instanceof Error ? err.message : String(err)) });
|
|
50532
|
-
}
|
|
50533
|
-
});
|
|
50534
|
-
app.listen(HTTP_PORT, "127.0.0.1", () => {
|
|
50535
|
-
console.error(`Story Vault MCP server (HTTP) listening on http://127.0.0.1:${HTTP_PORT}/mcp`);
|
|
50536
|
-
});
|
|
50543
|
+
await startMcpHttpServer(server, HTTP_PORT);
|
|
50537
50544
|
} else {
|
|
50538
50545
|
const transport = new StdioServerTransport();
|
|
50539
50546
|
transport.onmessage = (msg) => {
|
|
@@ -50554,8 +50561,9 @@ async function main() {
|
|
|
50554
50561
|
console.error("Story Vault MCP server (STDIO) running");
|
|
50555
50562
|
}
|
|
50556
50563
|
}
|
|
50557
|
-
|
|
50558
|
-
|
|
50564
|
+
|
|
50565
|
+
// server/mcpCli.ts
|
|
50566
|
+
runStandalone().catch((err) => {
|
|
50559
50567
|
console.error("Fatal error:", err);
|
|
50560
50568
|
process.exit(1);
|
|
50561
50569
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "story-vault-mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "MCP server for Story Vault — lets external AI clients (Claude Desktop, Cursor, Cline, Qwen Chat…) read and write your local encrypted writing vault.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|