@dainprotocol/installer
v0.12.10
Published
Install DAIN Claude Code / Codex CLI plugin in one paste command.
Downloads
2,044
Readme
@dainprotocol/installer
Install the DAIN MCP server for Claude Code or Codex with one paste-command.
This is the public Bun-native pairing shim; the service-development CLI
and its restricted package are documented in
../dev-cli/README.md.
Install
Sign in to DAIN account settings and generate an install code.
Paste the host-specific command, for example:
bunx --bun @dainprotocol/installer claude install --code dxc_xxxxxxxxxxxx
The command redeems the code at
/api/cli/install-code/redeem, writes a device-scoped CLI JWT to
~/.config/dain/profile.json (directory mode 0700, file mode 0600), and
registers the DAIN MCP server with the selected host. Codes are single-use and
expire after five minutes. Restart Claude Code or Codex after installation.
On macOS the CLI JWT is not written to that file in the clear: a random
32-byte key is stored in the login Keychain and the profile holds the token
AES-256-GCM encrypted, so the file on its own is not a credential. The key is
minted only from an interactive terminal. If no key exists, a non-interactive
install leaves the token in the mode-0600 file. To enable Keychain storage,
generate a fresh install code in Connected apps and re-run
bunx --bun @dainprotocol/installer claude install --code <fresh-code> from an
interactive terminal (add --host codex for Codex). Approve the system prompt
if one appears; a used install code cannot be reused.
DAIN_CREDENTIAL_STORE=file keeps it there; every other platform uses the file.
The install code is a short-lived pairing credential, not a service API key. The installer does not print or persist the long-form DPL service API key used by DAIN services.
Requirements and hosts
- Bun
>=1.4.1onPATH— the enforced end-user floor (MINIMUM_BUN_VERSIONinsrc/install.ts), validated before the one-time code is redeemed. Deliberately lower than the workspace's ownengines.bun; do not sync the two. - macOS or Linux for automatic host registration.
- Pairing always names a real MCP host:
--host claude-codeor--host codex. - Windows: the server accepts Windows as a pairing platform, but this CLI does
not complete an install there. Run
--host claude-code(or--host codex): the code is redeemed and the profile is written, then host registration throwsWindows host installation is not supported in v1. It prints no configuration — copy the launcher from "Host launchers" below into your host's MCP settings by hand.
The command path is claude install. The package publishes it under two
interchangeable bin names, installer and claude-install, both resolving to
dist/index.js (the program's own .name() is claude-install), plus the
separate dain-mcp bin. Options:
--code <code> install code from DAIN account settings
--host <host> claude-code | codex (default: claude-code)
--server <url> DAIN client base URL (default: https://daintrader.com)
--allow-untrusted-server accept a non-allowlisted server (development only)The current public server is https://daintrader.com. Trusted server URLs must
use HTTPS and an exact hostname from the source allowlist. The canonical host
and local-tunnel.daintrader.com are exact matches, never wildcard trust.
Arbitrary subdomains and retired domains are rejected. Any other custom
deployment requires the explicit development-only --allow-untrusted-server
escape hatch.
Validation and defaults are implemented in
src/install.ts.
Host launchers
Automatic installation registers an unpinned launcher using the explicit package selector below. The selector matters because the installer package exposes multiple bins:
bunx --bun -p @dainprotocol/installer dain-mcp serveThe launcher has carried no @<version> token since 0.6.2. A pin froze every
user's config to whatever build was current on the day they paired, so a
published fix could not reach them without a re-pair — 0.6.0 shipped a
dain-mcp that crashed on startup and the 0.6.1 fix was structurally unable to
land. Unpinned, bunx resolves latest per launch, and --bun guarantees the
downloaded executable also runs under Bun. See
src/host-installers.ts and its argv test.
Claude Code receives a user-scoped mcp add-json registration. Codex receives
an mcp add command with the same launcher. See
src/host-installers.ts.
The executable has one launcher form: dain-mcp serve. The entry point is
src/mcp-bin.ts.
MCP surface
The installed server exposes the current DAIN Finance MCP contract over stdio. At startup it builds direct finance tools from the DAIN manifest. The current direct IDs are grouped by the producer's declared side-effect class:
# reads
markets portfolio get-skill hyperliquid-list-open-orders
# writes
send swap lend stake perp composeThat is the current producer manifest, pinned by
../dev-cli/__tests__/snapshots/expected-mcp-tool-ids.json;
the MCP does not hard-code the count and will register whatever validated tools
the connected manifest
contains. It also exposes account, flow-status, and the read-only
ai-teams recommended-Team discovery/detail tool. account supports
list, switch, create-wallet, request-signer, status, login, and
info; wallet selection is session-scoped. flow-status reports interactive
sign-session and headless automation flow state, with a bounded wait option.
Transaction-capable tools preserve the execution boundary: an interactive
wallet returns a sign-session flow, while a selected agent wallet can
route eligible txPayloadRelay tools through the agent execute endpoint
(/api/cli/agent/execute). The MCP server obtains an agent-scoped service
token, calls the raw tool, and posts the returned payload to DAIN client for
signing/broadcast. Dry-run
paths do not sign or broadcast. The
implementation is owned by @dainprotocol/cli and bundled into this package.
Configuration overrides
These environment variables are useful when operating against a custom DAIN deployment:
| Variable | Default | Effect |
|---|---|---|
| DAIN_DEFI_AGGREGATOR_URL | https://defi.daintrader.com | Upstream DAIN Finance service URL. |
| DAIN_MCP_MANIFEST_TTL_HOURS | 5 minutes when unset | Manifest/tool-discovery cache TTL; a positive value overrides the default in hours. |
Troubleshooting
- Expired or already-used code: generate a new code; each code is five-minute and single-use.
INVALID_PROFILE: pair the device again so the current profile format can be written.- Bun missing or too old: install Bun 1.4+ from bun.sh and rerun.
- Windows / unsupported host: run the pairing with
--host claude-codeor--host codex. The pairing itself succeeds; when host registration then fails, copy the launcher from "Host launchers" into your host's settings by hand — nothing is printed for you on that path. - Custom server rejected: use an HTTPS exact trusted hostname, or pass
--allow-untrusted-serveronly in a controlled development environment.
Security and source
The installer validates the server before redeeming a code and keeps the
resulting profile file owner-readable. Report security issues to
[email protected].
Source for this package is in
src. The workspace package manifest is
package.json; it declares engines.bun >=1.4.1 and publishes this
package publicly.
License: ISC.
