feedkeeper 0.36.1 → 0.36.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/package.json +1 -1
- package/server/dist/auth/users.js +13 -0
- package/server/dist/cli.js +4 -0
- package/server/dist/feedkeeper.js +5 -0
- package/server/dist/mcp-stdio.js +29 -0
- package/server/package.json +1 -1
- package/web/dist/assets/index-DQ0jYGch.js +32 -0
- package/web/dist/index.html +1 -1
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/index-CilgZLF5.js +0 -32
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
1
2
|
import { db } from "../db/index.js";
|
|
2
3
|
import { hashPassword } from "./password.js";
|
|
3
4
|
// Joins only the avatar timestamp; the image itself is loaded on demand.
|
|
@@ -17,6 +18,18 @@ export function findUserByEmail(email) {
|
|
|
17
18
|
export function findUserById(id) {
|
|
18
19
|
return db.prepare(`${SELECT_USER} WHERE users.id = ?`).get(id);
|
|
19
20
|
}
|
|
21
|
+
/** Returns the first existing user, or creates a local admin user for single-user/stdio mode. */
|
|
22
|
+
export function getOrCreateDefaultUser() {
|
|
23
|
+
const existing = db.prepare(`${SELECT_USER} ORDER BY users.id ASC LIMIT 1`).get();
|
|
24
|
+
if (existing)
|
|
25
|
+
return existing;
|
|
26
|
+
return createUser({
|
|
27
|
+
email: "local@feedkeeper.internal",
|
|
28
|
+
password: randomBytes(32).toString("hex"),
|
|
29
|
+
displayName: "FeedKeeper User",
|
|
30
|
+
role: "admin",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
20
33
|
export function createUser(input) {
|
|
21
34
|
const result = db
|
|
22
35
|
.prepare(`INSERT INTO users (email, password_hash, display_name, role)
|
package/server/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ export const HELP = `FeedKeeper: a self-hosted RSS reader and remote MCP server
|
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
feedkeeper [options] Start the server
|
|
9
|
+
feedkeeper mcp [options] Start in stdio MCP mode
|
|
9
10
|
feedkeeper backup <file> Back up the database (see docs for restore)
|
|
10
11
|
feedkeeper restore <file> --force Restore the database from a backup
|
|
11
12
|
|
|
@@ -69,6 +70,9 @@ export function parseArgs(argv) {
|
|
|
69
70
|
options.dataDir = value;
|
|
70
71
|
index = next;
|
|
71
72
|
}
|
|
73
|
+
else if (options.action === "start" && argument === "mcp") {
|
|
74
|
+
options.action = "mcp";
|
|
75
|
+
}
|
|
72
76
|
else if (options.action === "start" && (argument === "backup" || argument === "restore")) {
|
|
73
77
|
options.action = argument;
|
|
74
78
|
options.forwarded.push(argument);
|
|
@@ -20,6 +20,11 @@ async function main() {
|
|
|
20
20
|
await import("./backup-cli.js");
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
+
if (options.action === "mcp" || (options.action === "start" && process.env.GLAMA_VERSION)) {
|
|
24
|
+
const { runMcpStdio } = await import("./mcp-stdio.js");
|
|
25
|
+
await runMcpStdio();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
23
28
|
console.log(`[feedkeeper] version ${APP_VERSION}, data in ${prepared.dataDir}`);
|
|
24
29
|
if (prepared.secretCreated)
|
|
25
30
|
console.log(`[feedkeeper] created a session secret at ${prepared.secretPath}; keep it with your backups`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { prepareEnvironment } from "./cli.js";
|
|
6
|
+
// Ensure stdout is exclusively reserved for MCP JSON-RPC messages.
|
|
7
|
+
console.log = console.error;
|
|
8
|
+
console.info = console.error;
|
|
9
|
+
export async function runMcpStdio() {
|
|
10
|
+
const envFile = resolve(process.cwd(), ".env");
|
|
11
|
+
if (existsSync(envFile))
|
|
12
|
+
process.loadEnvFile(envFile);
|
|
13
|
+
prepareEnvironment({ action: "start", forwarded: [] }, process.env);
|
|
14
|
+
const { runMigrations } = await import("./db/index.js");
|
|
15
|
+
runMigrations();
|
|
16
|
+
const { getOrCreateDefaultUser } = await import("./auth/users.js");
|
|
17
|
+
const { createMcpServerForUser } = await import("./mcp/server.js");
|
|
18
|
+
const user = getOrCreateDefaultUser();
|
|
19
|
+
const server = createMcpServerForUser(user.id, "write");
|
|
20
|
+
const transport = new StdioServerTransport();
|
|
21
|
+
await server.connect(transport);
|
|
22
|
+
}
|
|
23
|
+
if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith("mcp-stdio.js")) {
|
|
24
|
+
runMcpStdio().catch((error) => {
|
|
25
|
+
console.error("mcp-stdio error:", error);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=mcp-stdio.js.map
|