brainhub
v0.2.0
Published
Connect your AI tools to shared knowledge. CLI, MCP server and JavaScript client for BrainHub.
Maintainers
Readme
BrainHub
One connection to shared knowledge for your AI tools. Requires Node.js 22 or newer.
npx brainhubChoose public access or enter a Cognitum key privately, select one or more brains from the list, then choose your app. Public knowledge needs no account. No clone, build, global installation or background service is needed. Your app starts MCP automatically whenever it needs BrainHub.
Change your brains without reconnecting
npx brainhub brainsChoose up to ten public or authorized private brains. Type their numbers separated
by commas; Enter keeps current visible selections, and none clears the selection.
Every app using this connection picks up changes on its next request. A result
still in flight when you change the selection is discarded; content already received
by an app cannot be recalled.
Ask your assistant: “Search my selected BrainHub brains for our deployment process, and cite the sources.” Search results are grouped by brain, with source citations. Unavailable brains are reported explicitly. The assistant can inspect its current connection, but only you can change the selection in a terminal.
Connect another app
After guided setup, run the command for your app:
npx brainhub connect claude
npx brainhub connect codex
npx brainhub connect grokThese use the installed Claude Code, Codex or Grok Build CLI. Restart the app once after adding the connection; later brain changes need no restart. All three use your saved default connection. Existing registrations are preserved.
For Cursor, Claude Desktop, other apps, or Windows, print the configuration and merge it into your app's MCP settings, keeping other servers:
npx brainhub connect cursor
npx brainhub connect desktop
npx brainhub connect jsonWindows prints TOML for Codex/Grok and JSON for other apps. If a desktop app cannot
find npx, use its absolute path. A minimal configuration is:
{
"mcpServers": {
"brainhub": {
"command": "npx",
"args": ["-y", "[email protected]", "mcp", "--profile", "default"]
}
}
}The generated configuration also pins your absolute settings directory, so apps with a different home directory use the same connection. Saved configurations pin the package version. To upgrade an existing registration, update that version in the app's settings after reviewing the release. A 0.1.0 fixed-brain connection does not become a profile automatically: run setup to add one, then remove the old registration yourself if you no longer need it.
Private knowledge and separate connections
npx brainhub login # hidden key entry, then choose brains
npx brainhub status # selected brains; never prints the key
npx brainhub logout # clear local key AND selections
npx brainhub setup --profile work
npx brainhub connect codex --profile work
npx brainhub brains --profile work
npx brainhub login --profile work
npx brainhub logout --profile workPrivate brains appear only if the API authorizes the key. A successful public list alone cannot verify a key: the client reports saved-key, not verified login. Browser sign-in is separate and does not authenticate this connector yet. Never paste a key into chat, command arguments or a knowledge base.
Profiles live in ~/.brainhub/connections (or an absolute BRAINHUB_CONFIG_DIR).
Their keys are plaintext local credentials: use a private OS account directory.
On macOS/Linux, the connections directory and files require 0700/0600 and your
ownership; on Windows, keep the inherited private user-directory ACLs. Same-user
local tools can read these files. Selection is a convenience for trusted tools,
not a sandbox or a platform-issued grant. Logout does not revoke the Cognitum key;
revoke it through Cognitum if needed.
Use a new profile for a different server:
npx brainhub setup --profile local --remote http://localhost:4100A concurrent settings change makes an old picker stop without saving. A crashed
setup can leave connections/NAME.lock; close all setup commands before removing
that named lock directory and retrying.
Fixed connections and advanced access
Existing --brain owner/name connections remain supported. Repeat --brain for
multiple fixed brains; add --remote for another server. --private generates a
placeholder to replace in that app's protected settings. Explicit --profile
connections ignore inherited credentials, server, scope and write settings, and
cannot be combined with legacy flags.
Profile connections are read-only. Legacy MCP can explicitly enable authorized
new notes and replacement proposals using --allow-writes and BRAINHUB_TOKEN
or COGNITUM_API_KEY; replacements still need review. Writes depend on the API's
deployed features. An explicit legacy --all-brains allows API-visible discovery.
Direct CLI commands keep their explicit target/environment configuration; they do not use connection profiles:
npx brainhub list
npx brainhub query cognitum/brainhub-docs "How do I connect my tools?"
npx brainhub --helpJavaScript
npm install brainhubimport { BrainhubClient, parseTarget } from 'brainhub';
const client = new BrainhubClient({ baseUrl: 'https://brainhub.cognitum.one' });
const hits = await client.query(parseTarget('cognitum/brainhub-docs'), 'How do I connect my tools?');
console.log(hits);The MIT package contains only the client, stdio MCP adapter and SDK. It includes no native vector engine, cloud-storage SDK, hosted API or install script. Hosted MCP with browser consent is planned; the website URL is not an MCP endpoint. Explore knowledge and connection instructions.
