Skip to content

Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.

feat: token generator (Connect page button + bun run gen:secrets)

Ronalds Palacisd9bec82c13af
diff --git a/app/(app)/connect/page.tsx b/app/(app)/connect/page.tsx
index 79bc311..9e168cb 100644
--- a/app/(app)/connect/page.tsx
+++ b/app/(app)/connect/page.tsx
@@ -32,6 +32,13 @@ export default function ConnectPage() {
useEffect(() => setOrigin(window.location.origin), []);
const { data: feat } = useSWR<{ mcpAuthRequired?: boolean; harness?: boolean }>("/api/features", fetcher);
+ const [tok, setTok] = useState("");
+ function generateToken() {
+ const a = new Uint8Array(32);
+ crypto.getRandomValues(a);
+ setTok(Array.from(a, (b) => b.toString(16).padStart(2, "0")).join(""));
+ }
+
const mcp = origin ? `${origin}/api/mcp` : "…";
const needsToken = feat?.mcpAuthRequired !== false;
const tokenLine = needsToken ? ` \\\n --header "Authorization: Bearer <MCP_TOKEN>"` : "";
@@ -52,6 +59,22 @@ export default function ConnectPage() {
<Copyable text={mcp} />
</section>
+ <section className="mt-6 space-y-2">
+ <h2 className="text-sm font-medium">Generate a token</h2>
+ <p className="text-sm text-muted-foreground">
+ A strong random value for <code className="rounded bg-muted px-1">MCP_TOKEN</code> or{" "}
+ <code className="rounded bg-muted px-1">AUTH_SECRET</code>. Set it as an env var on your host — the app
+ reads secrets from the environment, nothing is stored in the app.
+ </p>
+ <button
+ onClick={generateToken}
+ className="rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-accent"
+ >
+ Generate
+ </button>
+ {tok && <Copyable text={tok} />}
+ </section>
+
<section className="mt-6 space-y-2">
<h2 className="text-sm font-medium">Claude Code</h2>
<Copyable text={claudeCmd} />
diff --git a/package.json b/package.json
index 4d45c0e..1ae54d6 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"build": "next build",
"start": "next start",
"lint": "eslint",
- "sync": "tsx scripts/git-sync.ts"
+ "gen:secrets": "tsx scripts/gen-secrets.ts"
},
"dependencies": {
"@base-ui/react": "^1.5.0",
diff --git a/sample-vault/inbox/test.md b/sample-vault/inbox/test.md
deleted file mode 100644
index 83c831f..0000000
--- a/sample-vault/inbox/test.md
+++ /dev/null
@@ -1 +0,0 @@
-# test
diff --git a/scripts/gen-secrets.ts b/scripts/gen-secrets.ts
new file mode 100644
index 0000000..399d4d9
--- /dev/null
+++ b/scripts/gen-secrets.ts
@@ -0,0 +1,8 @@
+// Print strong random secrets for the env (AUTH_SECRET, MCP_TOKEN).
+// Usage: bun run gen:secrets
+import { randomBytes } from "node:crypto";
+
+const token = () => randomBytes(32).toString("hex");
+
+console.log(`AUTH_SECRET="${randomBytes(32).toString("base64")}"`);
+console.log(`MCP_TOKEN="${token()}"`);