cognitivtrust-claude
v1.1.0
Published
CognitivTrust CLI — one-command setup for Claude Code + Cursor hook integration.
Maintainers
Readme
CognitivTrust CLI
One-command setup for the CognitivTrust AI security layer in Claude Code and Cursor. Runs the OAuth login flow, writes the IDE config, installs the hook sidecar, and you're done.
Requirements
- Node.js 24 or newer (
node -v) - Claude Code CLI (for
claude_codetarget) or Cursor (forcursortarget) - Network access to your CognitivTrust backend
Install & run
No install needed — use npx:
npx cognitivtrust-claudeOr install globally:
npm install -g cognitivtrust-claude
cognitivtrust-claudeWhat it does
- Opens your browser at the CognitivTrust web app and walks you through OAuth.
- Receives a long-lived JWT back on the local poll endpoint.
- Writes
~/.claude.json(MCP server entry) and~/.claude/settings.json(hook entries) for Claude Code. Writes~/.cursor/mcp.jsonand~/.cursor/hooks.jsonfor Cursor. - Places the
hook.jssidecar so your IDE can call it before every tool use, prompt submission, file read, etc.
Configuration
Override the backend / MCP / frontend URLs with env vars or CLI flags
(same knobs the VS Code / Cursor extension exposes as ctrust.backendUrl,
ctrust.mcpUrl, ctrust.frontendUrl).
| Flag | Env var | Default |
| ------------ | ------------------------- | --------------------------------------- |
| --backend | COGNITIVTRUST_BACKEND | https://dev-api.cognitivtrust.com |
| --mcp | COGNITIVTRUST_MCP | https://dev-mcp.cognitivtrust.com |
| --frontend | COGNITIVTRUST_FRONTEND | https://dev-app.cognitivtrust.com |
# Env
export COGNITIVTRUST_BACKEND=https://api.cognitivtrust.com
export COGNITIVTRUST_MCP=https://mcp.cognitivtrust.com
export COGNITIVTRUST_FRONTEND=https://app.cognitivtrust.com
npx cognitivtrust-claude
# Or flags
npx cognitivtrust-claude \
--backend https://api.cognitivtrust.com \
--mcp https://mcp.cognitivtrust.com \
--frontend https://app.cognitivtrust.com!!! note "MCP is a separate host"
The MCP server is served from its own subdomain (mcp.…) in production and
its own port/path in local dev. Keep it configurable separately from the
backend — deriving it from --backend works by convention but breaks as
soon as you deploy behind a proxy or split hosts.
Uninstall
npx cognitivtrust-claude --uninstall
# or, if globally installed:
cognitivtrust-claude --uninstallRemoves the CognitivTrust mcpServers.cognitivtrust entry from
~/.claude.json and the CognitivTrust hook entries from
~/.claude/settings.json. Other MCP servers, other hooks, and unrelated
settings in those files are preserved. Restart Claude Code to pick up the
change. The same command is re-runnable — it's a no-op when there's
nothing to remove.
Source
This package mirrors files from
extension/
at publish time (see scripts/prepack.js). Bugs and PRs go there.
License
MIT © CognitivTrust
