felix-mcp 2.0.128 → 2.0.129
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/README.md +3 -3
- package/dist/getting-started-guide.js +7 -2
- package/dist/index.js +313 -162
- package/dist/key-backup.js +15 -4
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Non-custodial trading tools for AI agents across Hyperliquid, Polymarket, and
|
|
8
8
|
Derive. Live execution is the default; paper mode must be selected explicitly.
|
|
9
9
|
|
|
10
|
-
Package version: `felix-mcp@2.0.
|
|
10
|
+
Package version: `felix-mcp@2.0.129`. For prepublication review, use the local
|
|
11
11
|
tarball below. Packaging checks do not certify live money workflows.
|
|
12
12
|
|
|
13
13
|
## Hosted (no install)
|
|
@@ -48,14 +48,14 @@ node --version
|
|
|
48
48
|
npm ci
|
|
49
49
|
candidate_dir="$(mktemp -d)"
|
|
50
50
|
npm pack --pack-destination "$candidate_dir"
|
|
51
|
-
npm install --global "$candidate_dir/felix-mcp-2.0.
|
|
51
|
+
npm install --global "$candidate_dir/felix-mcp-2.0.129.tgz"
|
|
52
52
|
felix-keys --help
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
After the operator publishes this version, the registry installation is:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
npm install --global felix-mcp@2.0.
|
|
58
|
+
npm install --global felix-mcp@2.0.129
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### 2. Set up keys locally
|
|
@@ -10,10 +10,15 @@ the current legal bundle at https://felix.trade/legal before accepting it.
|
|
|
10
10
|
|
|
11
11
|
### New local MCP user: start here
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Already connected to this MCP? Call the \`onboard\` tool. Felix asks the owner
|
|
14
|
+
to accept the terms (in the client's own question when it has one; otherwise
|
|
15
|
+
the agent asks in chat and macOS shows one confirmation the owner clicks),
|
|
16
|
+
then creates the identity and loads it into the session with no restart.
|
|
17
|
+
|
|
18
|
+
Or let your AI agent run this single command:
|
|
14
19
|
|
|
15
20
|
~~~bash
|
|
16
|
-
npx -y --package felix-mcp@2.0.
|
|
21
|
+
npx -y --package felix-mcp@2.0.129 felix-keys onboard --accept-terms --client claude
|
|
17
22
|
~~~
|
|
18
23
|
|
|
19
24
|
After the user reviews the terms and explicitly authorizes acceptance, the agent
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import * as nodeNet from "node:net";
|
|
|
18
18
|
import { homedir, userInfo } from "node:os";
|
|
19
19
|
import { dirname, join, resolve } from "node:path";
|
|
20
20
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
21
|
-
import { spawnSync } from "node:child_process";
|
|
21
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
22
22
|
import { fileURLToPath } from "node:url";
|
|
23
23
|
import { isDeepStrictEqual } from "node:util";
|
|
24
24
|
import { privateKeyToAccount } from "viem/accounts";
|
|
@@ -50,7 +50,7 @@ import { signHyperliquidAgentApproval } from "./hyperliquid-onboarding.js";
|
|
|
50
50
|
import { signPreparedSafePolicy, signPreparedWithdrawal } from "./safe-policy.js";
|
|
51
51
|
import { policySubmitAmbiguity, policySubmitPending } from "./policy-workflow.js";
|
|
52
52
|
import { executeSafeV3Migration, signSafeMigrationProof } from "./safe-migration.js";
|
|
53
|
-
import { deriveAccountOwnerPrivateKey, ownerAddressForPrivateKey, ownerPrivateKeyForAccountIdentity, signLiveKeyGrant, signRiskMandate, RISK_MANDATE_VENUE_LIST,
|
|
53
|
+
import { deriveAccountOwnerPrivateKey, ownerAddressForPrivateKey, ownerPrivateKeyForAccountIdentity, signLiveKeyGrant, signRiskMandate, RISK_MANDATE_VENUE_LIST, } from "./safe-onboarding.js";
|
|
54
54
|
import { signDeriveOnboardingTransactions } from "./derive-onboarding.js";
|
|
55
55
|
import { getCustodyRecoveryStatus } from "./key-backup.js";
|
|
56
56
|
import { clearRuntimeOwnerPrivateKey, getRuntimeOwnerPrivateKey, setRuntimeOwnerPrivateKey, } from "./secret-state.js";
|
|
@@ -123,7 +123,7 @@ export function validatedApiBase(raw = process.env.FELIX_API_URL || `https://${O
|
|
|
123
123
|
return parsed.origin;
|
|
124
124
|
}
|
|
125
125
|
const API = validatedApiBase();
|
|
126
|
-
const MCP_VERSION = "2.0.
|
|
126
|
+
const MCP_VERSION = "2.0.129";
|
|
127
127
|
const AES_GCM_IV_BYTES = 12;
|
|
128
128
|
const AES_GCM_TAG_BYTES = 16;
|
|
129
129
|
const MAX_MONEY_JOURNAL_BYTES = 16 * 1024 * 1024;
|
|
@@ -925,7 +925,13 @@ async function runMoneyWorkflowLocked(workflowKey, operation, payload, action, o
|
|
|
925
925
|
return clientError("workflow_account_mismatch", "This saved money workflow belongs to a different Felix account.", "Restore the original child account with use_child_account before resuming. Never use a new workflow key.", { workflow_account_id: existing.account_id, active_account_id: workflowAccountId || null });
|
|
926
926
|
}
|
|
927
927
|
existing.account_id = workflowAccountId;
|
|
928
|
-
|
|
928
|
+
// ARC_OWNER_BIND_MCP_20261117: a create_account that stopped on the retired Polygon Safe hub (410) moved no
|
|
929
|
+
// money and is resumed from its checkpoints (the reserved account is reused) instead of replaying the 410.
|
|
930
|
+
const retiredHubStop = operation === "create_live_account" && existing.status === "completed"
|
|
931
|
+
&& isRecord(existing.response) && existing.response.ok === false
|
|
932
|
+
&& isRecord(existing.response.error) && existing.response.error.code === "polygon_safe_hub_retired"
|
|
933
|
+
&& existing.response.money_moved !== true && existing.response.user_funds_moved !== true;
|
|
934
|
+
if (existing.status === "completed" && isRecord(existing.response) && !retiredHubStop) {
|
|
929
935
|
const replayOverride = await options.onCompletedReplay?.(existing);
|
|
930
936
|
if (isRecord(replayOverride))
|
|
931
937
|
return replayOverride;
|
|
@@ -940,8 +946,8 @@ async function runMoneyWorkflowLocked(workflowKey, operation, payload, action, o
|
|
|
940
946
|
const ownerSetupCanResume = ["create_live_account", "repair_derive_session", "archive_account"].includes(operation)
|
|
941
947
|
&& existing.status === "reconciliation_required"
|
|
942
948
|
&& progress.money_moved === false;
|
|
943
|
-
if (!(options.resumeReconciliation || options.resumable || ownerSetupCanResume)
|
|
944
|
-
|| (existing.status !== "reconciliation_required" && !staleInProgress)) {
|
|
949
|
+
if (!retiredHubStop && (!(options.resumeReconciliation || options.resumable || ownerSetupCanResume)
|
|
950
|
+
|| (existing.status !== "reconciliation_required" && !staleInProgress))) {
|
|
945
951
|
return clientError("workflow_reconciliation_required", "This money workflow may have started but did not reach a saved terminal result.", progress.money_moved
|
|
946
952
|
? "Do not use a new key. Reconcile venue and wallet balances before resuming."
|
|
947
953
|
: "Retry the same request key; Felix can resume because no user money moved.", { reconciliation_required: true, workflow: progress });
|
|
@@ -1920,6 +1926,65 @@ function createAccountFundingGate(response, accountId, ownerAddress) {
|
|
|
1920
1926
|
function createAccountArcError(error) {
|
|
1921
1927
|
return clientError(error instanceof ArcHomeError ? error.code : "arc_home_verification_failed", safeClientErrorMessage(error, "Arc home onboarding could not be verified."), "Retry create_account with the same idempotency_key; do not start another account.", { money_moved: false });
|
|
1922
1928
|
}
|
|
1929
|
+
// ARC_OWNER_BIND_MCP_20261117: bind a brand-new account's derived owner to its Arc home (owner-signed challenge).
|
|
1930
|
+
const ARC_OWNER_BIND_PURPOSE = "felix-arc-home-owner-bind:v1";
|
|
1931
|
+
async function bindArcHomeOwner(workflowKey, accountId, ownerKey) {
|
|
1932
|
+
const owner = ownerAddressForPrivateKey(ownerKey);
|
|
1933
|
+
const sameAddress = (value) => typeof value === "string" && EVM_ADDRESS_RE.test(value)
|
|
1934
|
+
&& value.toLowerCase() === owner.toLowerCase();
|
|
1935
|
+
const challenge = await call("POST", "/v1/arc-home/owner/challenge", { account_id: accountId, owner_address: owner }, {
|
|
1936
|
+
authKey: START_KEY, retryOnError: false, timeoutMs: 60_000,
|
|
1937
|
+
idempotencyKey: workflowStageKey(workflowKey, "owner:challenge"),
|
|
1938
|
+
});
|
|
1939
|
+
if (challenge.ok === false)
|
|
1940
|
+
return challenge;
|
|
1941
|
+
const message = typeof challenge.message === "string" ? challenge.message : "";
|
|
1942
|
+
const token = nonEmptyString(challenge.challenge_token);
|
|
1943
|
+
const lines = message.split("\n");
|
|
1944
|
+
const value = (index, name) => (lines[index]?.startsWith(`${name}:`)
|
|
1945
|
+
? lines[index].slice(name.length + 1) : undefined);
|
|
1946
|
+
const nonce = value(6, "nonce") || "";
|
|
1947
|
+
const issuedText = value(7, "issued_at") || "";
|
|
1948
|
+
const expiresText = value(8, "expires_at") || "";
|
|
1949
|
+
const issuedAt = /^[1-9][0-9]{0,11}$/.test(issuedText) ? Number(issuedText) : NaN;
|
|
1950
|
+
const expiresAt = /^[1-9][0-9]{0,11}$/.test(expiresText) ? Number(expiresText) : NaN;
|
|
1951
|
+
// Sign only Felix's exact owner-binding text for THIS account, owner and chain, rebuilt here byte for byte from
|
|
1952
|
+
// services/arc_owner_bind.challenge_message (never a hash, a transaction or any extra text).
|
|
1953
|
+
const canonical = Number.isSafeInteger(issuedAt) && Number.isSafeInteger(expiresAt) ? [
|
|
1954
|
+
"Felix Arc home owner binding",
|
|
1955
|
+
"domain:api.felix.trade",
|
|
1956
|
+
`purpose:${ARC_OWNER_BIND_PURPOSE}`,
|
|
1957
|
+
`account_id:${accountId}`,
|
|
1958
|
+
`chain_id:${ARC_MAINNET_CHAIN_ID}`,
|
|
1959
|
+
`owner:${owner}`,
|
|
1960
|
+
`nonce:${nonce}`,
|
|
1961
|
+
`issued_at:${issuedAt}`,
|
|
1962
|
+
`expires_at:${expiresAt}`,
|
|
1963
|
+
"Signing names this device wallet as the owner of your Felix Arc home. "
|
|
1964
|
+
+ "It moves no money and authorizes no transaction.",
|
|
1965
|
+
].join("\n") : undefined;
|
|
1966
|
+
const nowSeconds = Date.now() / 1_000;
|
|
1967
|
+
if (!token || canonical === undefined || message !== canonical || lines.length !== 10
|
|
1968
|
+
|| !/^[0-9a-f]{32}$/.test(nonce)
|
|
1969
|
+
|| expiresAt <= nowSeconds || expiresAt - issuedAt <= 0 || expiresAt - issuedAt > 600
|
|
1970
|
+
|| issuedAt > nowSeconds + 120
|
|
1971
|
+
|| challenge.account_id !== accountId || !sameAddress(challenge.owner_address)
|
|
1972
|
+
|| Number(challenge.chain_id) !== ARC_MAINNET_CHAIN_ID || challenge.purpose !== ARC_OWNER_BIND_PURPOSE
|
|
1973
|
+
|| challenge.sign_with !== "personal_sign") {
|
|
1974
|
+
return clientError("arc_owner_challenge_invalid", "Felix returned an owner-binding challenge that does not match this account and owner. Nothing was signed.", "Retry create_account with the same idempotency_key; do not create another account.", { money_moved: false });
|
|
1975
|
+
}
|
|
1976
|
+
const signature = await privateKeyToAccount(ownerKey).signMessage({ message });
|
|
1977
|
+
const bound = await call("POST", "/v1/arc-home/owner", { account_id: accountId, owner_address: owner, challenge_token: token, signature }, {
|
|
1978
|
+
authKey: START_KEY, retryOnError: false, timeoutMs: 60_000,
|
|
1979
|
+
idempotencyKey: workflowStageKey(workflowKey, `owner:bind:${nonce}`),
|
|
1980
|
+
});
|
|
1981
|
+
if (bound.ok === false)
|
|
1982
|
+
return bound;
|
|
1983
|
+
if (bound.status !== "arc_owner_bound" || bound.account_id !== accountId || !sameAddress(bound.owner_address)) {
|
|
1984
|
+
return clientError("arc_owner_bind_unconfirmed", "Felix did not confirm the Arc home owner binding for this account.", "Retry create_account with the same idempotency_key; do not create another account.", { money_moved: false });
|
|
1985
|
+
}
|
|
1986
|
+
return { ok: true, status: "arc_owner_bound", owner_address: owner, money_moved: false };
|
|
1987
|
+
}
|
|
1923
1988
|
async function createAccountArcHome(workflowKey, context, accountId, ownerKey, limits) {
|
|
1924
1989
|
const owner = ownerAddressForPrivateKey(ownerKey);
|
|
1925
1990
|
const accountPath = `/v1/arc-home/account${qs({ account_id: accountId })}`;
|
|
@@ -2965,7 +3030,7 @@ let activeToolWorkflows = 0;
|
|
|
2965
3030
|
let changingWorkflowIdentity = false;
|
|
2966
3031
|
const IDENTITY_CHANGING_TOOLS = new Set([
|
|
2967
3032
|
"use_child_account", "reload_launcher_key", "set_api_key", "derive_api_key",
|
|
2968
|
-
"create_account", "archive_account",
|
|
3033
|
+
"create_account", "archive_account", "onboard",
|
|
2969
3034
|
]);
|
|
2970
3035
|
async function withWorkflowBinding(name, args, action) {
|
|
2971
3036
|
if (isHostedTransport()) {
|
|
@@ -10962,7 +11027,7 @@ const TOOL_RISK_GROUPS = {
|
|
|
10962
11027
|
],
|
|
10963
11028
|
local_credential: ["set_api_key", "reload_launcher_key"],
|
|
10964
11029
|
account: [
|
|
10965
|
-
"prepare_venue_bootstrap", "request_withdrawal_confirmation", "verify_withdrawal_confirmation", "use_child_account", "derive_api_key", "create_account", "archive_account"
|
|
11030
|
+
"prepare_venue_bootstrap", "request_withdrawal_confirmation", "verify_withdrawal_confirmation", "use_child_account", "derive_api_key", "create_account", "archive_account", "onboard"
|
|
10966
11031
|
],
|
|
10967
11032
|
trading: [
|
|
10968
11033
|
"place_order", "place_batch_orders", "cancel_order", "close_position",
|
|
@@ -11541,6 +11606,14 @@ const TOOLS = [
|
|
|
11541
11606
|
api_key: stringProp("Felix API key in fk_<32 lowercase hex> format.", undefined, { pattern: API_KEY_RE.source }),
|
|
11542
11607
|
}, ["api_key"]),
|
|
11543
11608
|
},
|
|
11609
|
+
{
|
|
11610
|
+
name: "onboard",
|
|
11611
|
+
description: "Set up Felix for this owner from inside the chat: asks the owner to accept the Felix Terms of Service, Privacy Policy and Risk Disclosure, then creates the owner key in macOS Keychain, registers the launcher, writes and verifies the encrypted recovery file, and loads the identity into this session (no restart). When the MCP client can show questions, Felix asks the owner directly. Otherwise the first call returns the exact question: ask the owner in chat, and only if they say yes call again with owner_accepted_terms:true and terms_version; macOS then shows one native confirmation the owner must click. Never answer for the owner. Local stdio only. No key or recovery code is returned.",
|
|
11612
|
+
inputSchema: schema({
|
|
11613
|
+
owner_accepted_terms: booleanProp("Only when the client cannot ask the owner directly: true after the owner answered yes, in this chat, to the exact question this tool returned."),
|
|
11614
|
+
terms_version: stringProp("The terms version the owner accepted, exactly as returned by the first call."),
|
|
11615
|
+
}),
|
|
11616
|
+
},
|
|
11544
11617
|
{
|
|
11545
11618
|
name: "reload_launcher_key",
|
|
11546
11619
|
description: "Reload the current launcher API key and owner signer from macOS Keychain, validate their encrypted workflow journal, and explicitly leave any child account. No secret is returned.",
|
|
@@ -13289,6 +13362,68 @@ function beginLiveMutation(operation, args) {
|
|
|
13289
13362
|
}
|
|
13290
13363
|
} };
|
|
13291
13364
|
}
|
|
13365
|
+
// ONBOARD_CONSENT_20261117: shared by reload_launcher_key and onboard.
|
|
13366
|
+
async function reloadLauncherCredentials() {
|
|
13367
|
+
const candidateApiKey = KEYCHAIN_BACKED_CREDENTIALS
|
|
13368
|
+
? localKeychainCredential(KEYCHAIN_API_SERVICE)
|
|
13369
|
+
: START_KEY;
|
|
13370
|
+
const candidateOwnerKey = KEYCHAIN_BACKED_CREDENTIALS
|
|
13371
|
+
? localKeychainCredential(KEYCHAIN_OWNER_SERVICE)
|
|
13372
|
+
: START_OWNER_KEY;
|
|
13373
|
+
if (!API_KEY_RE.test(candidateApiKey)
|
|
13374
|
+
|| (KEYCHAIN_BACKED_CREDENTIALS && !EVM_PRIVATE_KEY_RE.test(candidateOwnerKey))) {
|
|
13375
|
+
return clientError("launcher_key_unavailable", KEYCHAIN_BACKED_CREDENTIALS
|
|
13376
|
+
? "macOS Keychain does not contain a complete valid Felix launcher identity."
|
|
13377
|
+
: "This MCP process was not launched with a complete valid Felix launcher identity.", "Run felix-keys status and restore the intended encrypted backup before retrying. No session credential was changed.");
|
|
13378
|
+
}
|
|
13379
|
+
try {
|
|
13380
|
+
// Authenticate local recovery state before changing either signer or
|
|
13381
|
+
// API identity. A corrupt same-owner journal remains a hard stop.
|
|
13382
|
+
if (EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)) {
|
|
13383
|
+
readMoneyWorkflowJournal(moneyWorkflowEncryptionKey(candidateOwnerKey), candidateOwnerKey);
|
|
13384
|
+
}
|
|
13385
|
+
const authenticated = await call("GET", "/v1/me/subscription", undefined, {
|
|
13386
|
+
authKey: candidateApiKey,
|
|
13387
|
+
retryOnError: false,
|
|
13388
|
+
timeoutMs: 30_000,
|
|
13389
|
+
});
|
|
13390
|
+
if (authenticated.ok === false) {
|
|
13391
|
+
return clientError("launcher_key_rejected", "Felix rejected the launcher API key currently stored in Keychain.", "Restore the matching encrypted identity backup or register a fresh unfunded launcher. No session credential was changed.");
|
|
13392
|
+
}
|
|
13393
|
+
const previousOwner = EVM_PRIVATE_KEY_RE.test(START_OWNER_KEY)
|
|
13394
|
+
? ownerAddressForPrivateKey(START_OWNER_KEY)
|
|
13395
|
+
: null;
|
|
13396
|
+
START_KEY = candidateApiKey;
|
|
13397
|
+
START_OWNER_KEY = candidateOwnerKey;
|
|
13398
|
+
launcherAccountIdCache = undefined;
|
|
13399
|
+
setKey(candidateApiKey);
|
|
13400
|
+
runtimeManagedAccountId = undefined;
|
|
13401
|
+
runtimeBindingError = undefined;
|
|
13402
|
+
forgetActiveChildAccount();
|
|
13403
|
+
if (EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)) {
|
|
13404
|
+
setRuntimeOwnerPrivateKey(candidateOwnerKey);
|
|
13405
|
+
}
|
|
13406
|
+
else {
|
|
13407
|
+
clearRuntimeOwnerPrivateKey();
|
|
13408
|
+
}
|
|
13409
|
+
const currentOwner = EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)
|
|
13410
|
+
? ownerAddressForPrivateKey(candidateOwnerKey)
|
|
13411
|
+
: null;
|
|
13412
|
+
return {
|
|
13413
|
+
ok: true,
|
|
13414
|
+
message: "Current Keychain launcher credential, owner signer, and workflow journal restored for this MCP session.",
|
|
13415
|
+
identity_changed: Boolean(previousOwner && currentOwner
|
|
13416
|
+
&& previousOwner.toLowerCase() !== currentOwner.toLowerCase()),
|
|
13417
|
+
workflow_journal_identity: currentOwner
|
|
13418
|
+
? workflowIdentityFingerprint(candidateOwnerKey)
|
|
13419
|
+
: null,
|
|
13420
|
+
_meta: { source: "mcp_keychain", key_prefix: candidateApiKey.slice(0, 12) },
|
|
13421
|
+
};
|
|
13422
|
+
}
|
|
13423
|
+
catch (error) {
|
|
13424
|
+
return clientError("operation_state_unavailable", safeClientErrorMessage(error, "The encrypted money-workflow journal could not be validated; no session credential was changed."), "Preserve the journal and restore the matching owner backup. Never delete workflow state while a money operation may be unresolved.");
|
|
13425
|
+
}
|
|
13426
|
+
}
|
|
13292
13427
|
export function makeServer() {
|
|
13293
13428
|
const server = new Server({ name: "felix", version: MCP_VERSION }, { capabilities: { tools: {}, resources: {} } });
|
|
13294
13429
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
@@ -13419,73 +13554,130 @@ export function makeServer() {
|
|
|
13419
13554
|
}
|
|
13420
13555
|
break;
|
|
13421
13556
|
}
|
|
13422
|
-
case "
|
|
13557
|
+
case "onboard": {
|
|
13558
|
+
// ONBOARD_CONSENT_20261117 (owner: "the ai should be able to accept these for the user ... do a question to
|
|
13559
|
+
// the user"): consent comes from the owner, through the client's own question when it has one, otherwise
|
|
13560
|
+
// relayed by the agent and confirmed by one native macOS click before any key exists.
|
|
13423
13561
|
if (isHostedTransport()) {
|
|
13424
|
-
out = clientError("
|
|
13562
|
+
out = clientError("local_only", "onboard runs only in the local stdio MCP on the owner's Mac.", "Install felix-mcp locally and call onboard there.");
|
|
13563
|
+
break;
|
|
13425
13564
|
}
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
:
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13565
|
+
if (process.platform !== "darwin") {
|
|
13566
|
+
out = clientError("macos_required", "Felix onboarding currently requires macOS Keychain.");
|
|
13567
|
+
break;
|
|
13568
|
+
}
|
|
13569
|
+
if (API_KEY_RE.test(START_KEY) && EVM_PRIVATE_KEY_RE.test(START_OWNER_KEY)) {
|
|
13570
|
+
out = { ok: true, status: "already_onboarded", owner_address: ownerAddressForPrivateKey(START_OWNER_KEY),
|
|
13571
|
+
next_step: "Call get_status, then create_account." };
|
|
13572
|
+
break;
|
|
13573
|
+
}
|
|
13574
|
+
const termsUrl = "https://felix.trade/legal";
|
|
13575
|
+
const question = `Do you accept the Felix Terms of Service, Privacy Policy and Risk Disclosure (${termsUrl}, version ${FELIX_LEGAL_BUNDLE_VERSION})? Felix will create your owner key in macOS Keychain. That key controls every dollar in your Felix accounts and never leaves this Mac.`;
|
|
13576
|
+
let consent;
|
|
13577
|
+
const canAsk = Boolean(server.getClientCapabilities()?.elicitation);
|
|
13578
|
+
if (canAsk && a.owner_accepted_terms === undefined) {
|
|
13579
|
+
let answer;
|
|
13580
|
+
try {
|
|
13581
|
+
answer = await server.elicitInput({
|
|
13582
|
+
message: question,
|
|
13583
|
+
requestedSchema: {
|
|
13584
|
+
type: "object",
|
|
13585
|
+
properties: {
|
|
13586
|
+
accept_terms: {
|
|
13587
|
+
type: "boolean",
|
|
13588
|
+
title: "I accept the Felix terms",
|
|
13589
|
+
description: `Terms, Privacy Policy and Risk Disclosure at ${termsUrl} (version ${FELIX_LEGAL_BUNDLE_VERSION}).`,
|
|
13590
|
+
},
|
|
13591
|
+
},
|
|
13592
|
+
required: ["accept_terms"],
|
|
13593
|
+
},
|
|
13594
|
+
});
|
|
13595
|
+
}
|
|
13596
|
+
catch {
|
|
13597
|
+
out = clientError("owner_question_unavailable", "The MCP client could not show the question to the owner. Nothing was created.", "Ask the owner the question returned by onboard in chat, then call onboard with owner_accepted_terms and terms_version.");
|
|
13438
13598
|
break;
|
|
13439
13599
|
}
|
|
13600
|
+
if (answer.action !== "accept" || answer.content?.accept_terms !== true) {
|
|
13601
|
+
out = { ok: false, status: "owner_declined", message: "The owner did not accept the Felix terms. Nothing was created." };
|
|
13602
|
+
break;
|
|
13603
|
+
}
|
|
13604
|
+
consent = "asked_by_felix";
|
|
13605
|
+
}
|
|
13606
|
+
else if (a.owner_accepted_terms === true && a.terms_version === FELIX_LEGAL_BUNDLE_VERSION) {
|
|
13607
|
+
consent = "relayed_with_mac_click";
|
|
13608
|
+
}
|
|
13609
|
+
else {
|
|
13610
|
+
out = {
|
|
13611
|
+
ok: false,
|
|
13612
|
+
status: "owner_answer_required",
|
|
13613
|
+
question,
|
|
13614
|
+
terms_url: termsUrl,
|
|
13615
|
+
terms_version: FELIX_LEGAL_BUNDLE_VERSION,
|
|
13616
|
+
instructions: "Ask the owner this exact question in chat. Only if they answer yes, call onboard again with owner_accepted_terms:true and this terms_version. macOS will then show one confirmation the owner must click. Never answer for the owner.",
|
|
13617
|
+
};
|
|
13618
|
+
break;
|
|
13619
|
+
}
|
|
13620
|
+
if (!KEYCHAIN_BACKED_CREDENTIALS) {
|
|
13621
|
+
// This process reads its identity from its environment, so a new Keychain identity could not be loaded
|
|
13622
|
+
// here (and would sit beside the configured one). Nothing is created.
|
|
13623
|
+
out = clientError("environment_credentials", "This MCP was launched with Felix credentials in its environment, so onboarding cannot run here. Nothing was created.", "Remove FELIX_API_KEY / FELIX_OWNER_PRIVATE_KEY from the MCP configuration (Felix reads Keychain by default), restart it, and call onboard again.");
|
|
13624
|
+
break;
|
|
13625
|
+
}
|
|
13626
|
+
const keyTool = fileURLToPath(new URL("./key-backup.js", import.meta.url));
|
|
13627
|
+
const cliArgs = [keyTool, "onboard", "--accept-terms", "--client", "none"];
|
|
13628
|
+
if (consent === "relayed_with_mac_click")
|
|
13629
|
+
cliArgs.push("--confirm-on-mac");
|
|
13630
|
+
reportProgress(1, 3, consent === "relayed_with_mac_click"
|
|
13631
|
+
? "Waiting for the owner to click Continue in the macOS confirmation."
|
|
13632
|
+
: "Creating the owner key and registering the launcher.");
|
|
13633
|
+
const run = await new Promise((resolveRun) => {
|
|
13634
|
+
const child = spawn(process.execPath, cliArgs, { stdio: ["ignore", "pipe", "pipe"], env: process.env });
|
|
13635
|
+
let stdout = "";
|
|
13636
|
+
child.stdout.on("data", (chunk) => { if (stdout.length < 256 * 1024)
|
|
13637
|
+
stdout += String(chunk); });
|
|
13638
|
+
child.stderr.on("data", () => { });
|
|
13639
|
+
const timer = setTimeout(() => child.kill("SIGTERM"), 300_000);
|
|
13640
|
+
child.on("error", () => { clearTimeout(timer); resolveRun({ code: -1, stdout }); });
|
|
13641
|
+
child.on("close", (code) => { clearTimeout(timer); resolveRun({ code, stdout }); });
|
|
13642
|
+
});
|
|
13643
|
+
const at = run.stdout.lastIndexOf('{\n "ok": true');
|
|
13644
|
+
let summary;
|
|
13645
|
+
if (run.code === 0 && at >= 0) {
|
|
13440
13646
|
try {
|
|
13441
|
-
|
|
13442
|
-
// API identity. A corrupt same-owner journal remains a hard stop.
|
|
13443
|
-
if (EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)) {
|
|
13444
|
-
readMoneyWorkflowJournal(moneyWorkflowEncryptionKey(candidateOwnerKey), candidateOwnerKey);
|
|
13445
|
-
}
|
|
13446
|
-
const authenticated = await call("GET", "/v1/me/subscription", undefined, {
|
|
13447
|
-
authKey: candidateApiKey,
|
|
13448
|
-
retryOnError: false,
|
|
13449
|
-
timeoutMs: 30_000,
|
|
13450
|
-
});
|
|
13451
|
-
if (authenticated.ok === false) {
|
|
13452
|
-
out = clientError("launcher_key_rejected", "Felix rejected the launcher API key currently stored in Keychain.", "Restore the matching encrypted identity backup or register a fresh unfunded launcher. No session credential was changed.");
|
|
13453
|
-
break;
|
|
13454
|
-
}
|
|
13455
|
-
const previousOwner = EVM_PRIVATE_KEY_RE.test(START_OWNER_KEY)
|
|
13456
|
-
? ownerAddressForPrivateKey(START_OWNER_KEY)
|
|
13457
|
-
: null;
|
|
13458
|
-
START_KEY = candidateApiKey;
|
|
13459
|
-
START_OWNER_KEY = candidateOwnerKey;
|
|
13460
|
-
launcherAccountIdCache = undefined;
|
|
13461
|
-
setKey(candidateApiKey);
|
|
13462
|
-
runtimeManagedAccountId = undefined;
|
|
13463
|
-
runtimeBindingError = undefined;
|
|
13464
|
-
forgetActiveChildAccount();
|
|
13465
|
-
if (EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)) {
|
|
13466
|
-
setRuntimeOwnerPrivateKey(candidateOwnerKey);
|
|
13467
|
-
}
|
|
13468
|
-
else {
|
|
13469
|
-
clearRuntimeOwnerPrivateKey();
|
|
13470
|
-
}
|
|
13471
|
-
const currentOwner = EVM_PRIVATE_KEY_RE.test(candidateOwnerKey)
|
|
13472
|
-
? ownerAddressForPrivateKey(candidateOwnerKey)
|
|
13473
|
-
: null;
|
|
13474
|
-
out = {
|
|
13475
|
-
ok: true,
|
|
13476
|
-
message: "Current Keychain launcher credential, owner signer, and workflow journal restored for this MCP session.",
|
|
13477
|
-
identity_changed: Boolean(previousOwner && currentOwner
|
|
13478
|
-
&& previousOwner.toLowerCase() !== currentOwner.toLowerCase()),
|
|
13479
|
-
workflow_journal_identity: currentOwner
|
|
13480
|
-
? workflowIdentityFingerprint(candidateOwnerKey)
|
|
13481
|
-
: null,
|
|
13482
|
-
_meta: { source: "mcp_keychain", key_prefix: candidateApiKey.slice(0, 12) },
|
|
13483
|
-
};
|
|
13647
|
+
summary = JSON.parse(run.stdout.slice(at));
|
|
13484
13648
|
}
|
|
13485
|
-
catch
|
|
13486
|
-
|
|
13649
|
+
catch {
|
|
13650
|
+
summary = undefined;
|
|
13487
13651
|
}
|
|
13488
13652
|
}
|
|
13653
|
+
if (!summary || summary.ok !== true) {
|
|
13654
|
+
out = clientError("onboarding_failed", consent === "relayed_with_mac_click" && run.code !== 0
|
|
13655
|
+
? "Onboarding stopped: the macOS confirmation was cancelled or setup failed. Nothing was replaced."
|
|
13656
|
+
: "Felix onboarding did not complete. Nothing was replaced.", "Check felix-keys status in Terminal. Never create a second identity if one already exists.");
|
|
13657
|
+
break;
|
|
13658
|
+
}
|
|
13659
|
+
reportProgress(2, 3, "Loading the new identity into this session.");
|
|
13660
|
+
const loaded = await reloadLauncherCredentials();
|
|
13661
|
+
reportProgress(3, 3, "Done.");
|
|
13662
|
+
out = {
|
|
13663
|
+
ok: loaded.ok !== false,
|
|
13664
|
+
status: loaded.ok !== false ? "onboarded" : "onboarded_restart_required",
|
|
13665
|
+
consent,
|
|
13666
|
+
terms_version: FELIX_LEGAL_BUNDLE_VERSION,
|
|
13667
|
+
owner_address: summary.owner_address,
|
|
13668
|
+
encrypted_backup: summary.encrypted_backup,
|
|
13669
|
+
backup_path: summary.backup_path,
|
|
13670
|
+
custody_recovery: summary.custody_recovery,
|
|
13671
|
+
session: loaded.ok !== false ? "identity_loaded" : "restart_the_mcp_server",
|
|
13672
|
+
secrets_displayed: false,
|
|
13673
|
+
next_step: "Call create_account (it returns a deposit address; the owner sends at least $5 themselves).",
|
|
13674
|
+
};
|
|
13675
|
+
break;
|
|
13676
|
+
}
|
|
13677
|
+
case "reload_launcher_key": {
|
|
13678
|
+
out = isHostedTransport()
|
|
13679
|
+
? clientError("hosted_transport_stateless", "reload_launcher_key is unavailable on the stateless hosted transport.", "Reconnect with the intended Bearer token.")
|
|
13680
|
+
: await reloadLauncherCredentials();
|
|
13489
13681
|
break;
|
|
13490
13682
|
}
|
|
13491
13683
|
case "use_child_account": {
|
|
@@ -17604,6 +17796,46 @@ export function makeServer() {
|
|
|
17604
17796
|
});
|
|
17605
17797
|
break;
|
|
17606
17798
|
case "deploy_agent": {
|
|
17799
|
+
// ONBOARD_CONSENT_20261117: a live agent's capital and limits are the owner's answer. When the agent did
|
|
17800
|
+
// not pass confirmed_budget_usd and the client can ask, Felix asks the owner directly (never a generic yes).
|
|
17801
|
+
if (nonEmptyString(a.mode)?.toLowerCase() !== "paper" && a.confirmed_budget_usd === undefined
|
|
17802
|
+
&& typeof a.budget_usd === "number" && Number.isFinite(a.budget_usd)
|
|
17803
|
+
&& server.getClientCapabilities()?.elicitation) {
|
|
17804
|
+
let reviewed;
|
|
17805
|
+
try {
|
|
17806
|
+
reviewed = await server.elicitInput({
|
|
17807
|
+
message: `Review this LIVE Felix agent before it can trade real money. Strategy ${String(a.strategy_id)}, markets ${JSON.stringify(a.markets)}, budget $${Number(a.budget_usd).toFixed(2)}. Proposed max position: ${typeof a.max_position_usd === "number" ? `$${a.max_position_usd}` : "none"}; proposed max daily loss: ${typeof a.max_daily_loss_usd === "number" ? `$${a.max_daily_loss_usd}` : "none"}. Type the exact budget to confirm it. The limits you enter here are the ones used.`,
|
|
17808
|
+
requestedSchema: {
|
|
17809
|
+
type: "object",
|
|
17810
|
+
properties: {
|
|
17811
|
+
confirmed_budget_usd: { type: "number", title: "Budget you approve (USD)", description: `Must be exactly ${Number(a.budget_usd).toFixed(2)}.`, minimum: 1 },
|
|
17812
|
+
max_position_usd: { type: "number", title: "Max position (USD, optional)", minimum: 0,
|
|
17813
|
+
...(typeof a.max_position_usd === "number" ? { default: a.max_position_usd } : {}) },
|
|
17814
|
+
max_daily_loss_usd: { type: "number", title: "Max daily loss (USD, optional)", minimum: 0,
|
|
17815
|
+
...(typeof a.max_daily_loss_usd === "number" ? { default: a.max_daily_loss_usd } : {}) },
|
|
17816
|
+
},
|
|
17817
|
+
required: ["confirmed_budget_usd"],
|
|
17818
|
+
},
|
|
17819
|
+
});
|
|
17820
|
+
}
|
|
17821
|
+
catch {
|
|
17822
|
+
reviewed = undefined;
|
|
17823
|
+
}
|
|
17824
|
+
if (reviewed && reviewed.action !== "accept") {
|
|
17825
|
+
out = { ok: false, status: "owner_declined", message: "The owner did not approve this live agent. Nothing was deployed." };
|
|
17826
|
+
break;
|
|
17827
|
+
}
|
|
17828
|
+
const answer = (reviewed?.content || {});
|
|
17829
|
+
if (reviewed && typeof answer.confirmed_budget_usd === "number") {
|
|
17830
|
+
a.confirmed_budget_usd = answer.confirmed_budget_usd;
|
|
17831
|
+
// The owner's numbers always win over the agent's proposal; a limit the owner left empty keeps the
|
|
17832
|
+
// proposal they were shown (never loosened behind their back).
|
|
17833
|
+
for (const field of ["max_position_usd", "max_daily_loss_usd"]) {
|
|
17834
|
+
if (typeof answer[field] === "number" && Number.isFinite(answer[field]))
|
|
17835
|
+
a[field] = answer[field];
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17838
|
+
}
|
|
17607
17839
|
const invalid = validateDeployAgentArgs(a);
|
|
17608
17840
|
if (invalid) {
|
|
17609
17841
|
out = invalid;
|
|
@@ -17922,99 +18154,16 @@ export function makeServer() {
|
|
|
17922
18154
|
const accountId = nonEmptyString(account.account_id);
|
|
17923
18155
|
const accountOwnerKey = deriveAccountOwnerPrivateKey(rootOwnerKey, accountId);
|
|
17924
18156
|
const accountOwnerAddress = ownerAddressForPrivateKey(accountOwnerKey);
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
if (!initialized) {
|
|
17936
|
-
initialized = await call("POST", "/v1/wallet/onboarding/init", walletInitBody, {
|
|
17937
|
-
idempotencyKey: workflowStageKey(workflowKey, "wallet:init"),
|
|
17938
|
-
timeoutMs: 60_000,
|
|
17939
|
-
});
|
|
17940
|
-
if (initialized.ok === false)
|
|
17941
|
-
return initialized;
|
|
17942
|
-
context.saveCheckpoint("wallet:initialized", initialized);
|
|
17943
|
-
}
|
|
17944
|
-
let onboardingId = nonEmptyString(initialized.onboarding_id);
|
|
17945
|
-
if (!onboardingId || !UUID_RE.test(onboardingId)) {
|
|
17946
|
-
throw new Error("Felix returned an invalid wallet onboarding id.");
|
|
17947
|
-
}
|
|
17948
|
-
let deployed = context.getCheckpoint("wallet:deployed");
|
|
17949
|
-
if (!deployed) {
|
|
17950
|
-
let onboardingState = await call("GET", `/v1/wallet/onboarding/${enc(onboardingId)}${qs({ account_id: accountId })}`, undefined, { authKey: START_KEY, timeoutMs: 60_000 });
|
|
17951
|
-
if (onboardingState.ok === false)
|
|
17952
|
-
return onboardingState;
|
|
17953
|
-
const challengeExpiry = Date.parse(nonEmptyString(onboardingState.expires_at) || "");
|
|
17954
|
-
if (["deployment_failed", "expired"].includes(String(onboardingState.status))
|
|
17955
|
-
|| (onboardingState.status === "challenge"
|
|
17956
|
-
&& (!Number.isFinite(challengeExpiry) || challengeExpiry <= Date.now()))) {
|
|
17957
|
-
initialized = await call("POST", "/v1/wallet/onboarding/init", walletInitBody, {
|
|
17958
|
-
idempotencyKey: workflowStageKey(workflowKey, `wallet:init:recovery:${onboardingId}`),
|
|
17959
|
-
retryOnError: false,
|
|
17960
|
-
timeoutMs: 60_000,
|
|
17961
|
-
});
|
|
17962
|
-
if (initialized.ok === false)
|
|
17963
|
-
return initialized;
|
|
17964
|
-
context.saveCheckpoint("wallet:initialized", initialized);
|
|
17965
|
-
onboardingId = nonEmptyString(initialized.onboarding_id);
|
|
17966
|
-
if (!onboardingId || !UUID_RE.test(onboardingId)) {
|
|
17967
|
-
throw new Error("Felix returned an invalid recovery onboarding id.");
|
|
17968
|
-
}
|
|
17969
|
-
onboardingState = { status: "challenge" };
|
|
17970
|
-
}
|
|
17971
|
-
if (["deployed", "completing"].includes(String(onboardingState.status))) {
|
|
17972
|
-
deployed = onboardingState;
|
|
17973
|
-
}
|
|
17974
|
-
else if (onboardingState.status === "challenge") {
|
|
17975
|
-
const proofSignature = await signSafeOnboardingProof(initialized, accountOwnerKey);
|
|
17976
|
-
deployed = await call("POST", "/v1/wallet/onboarding/deploy", {
|
|
17977
|
-
account_id: accountId,
|
|
17978
|
-
onboarding_id: onboardingId,
|
|
17979
|
-
proof_signature: proofSignature,
|
|
17980
|
-
}, {
|
|
17981
|
-
idempotencyKey: workflowStageKey(workflowKey, `wallet:deploy:${onboardingId}`),
|
|
17982
|
-
retryOnError: false,
|
|
17983
|
-
timeoutMs: 240_000,
|
|
17984
|
-
});
|
|
17985
|
-
if (deployed.ok === false) {
|
|
17986
|
-
const deploymentError = isRecord(deployed.error) ? deployed.error : {};
|
|
17987
|
-
if (deploymentError.code === "account_funding_required") {
|
|
17988
|
-
return createAccountFundingGate(deployed, accountId, accountOwnerAddress)
|
|
17989
|
-
|| clientError("account_funding_response_invalid", "The funding gate did not return a usable Polygon owner address.", "Do not send funds. Retry create_account with this same idempotency_key.", { account_id: accountId });
|
|
17990
|
-
}
|
|
17991
|
-
return deployed;
|
|
17992
|
-
}
|
|
17993
|
-
}
|
|
17994
|
-
else {
|
|
17995
|
-
return clientError("wallet_onboarding_reconciliation_required", `Safe onboarding is ${String(onboardingState.status || "unknown")}.`, "Retry this same create_account idempotency key after the current deployment settles.", { account_id: accountId, onboarding_id: onboardingId });
|
|
17996
|
-
}
|
|
17997
|
-
context.saveCheckpoint("wallet:deployed", deployed);
|
|
17998
|
-
}
|
|
17999
|
-
let wallet = context.getCheckpoint("wallet:complete");
|
|
18000
|
-
if (!wallet) {
|
|
18001
|
-
const signatures = await signSafeOnboardingTransactions({
|
|
18002
|
-
...deployed,
|
|
18003
|
-
proof_message: initialized.proof_message,
|
|
18004
|
-
}, accountOwnerKey);
|
|
18005
|
-
wallet = await call("POST", "/v1/wallet/onboarding/complete", {
|
|
18006
|
-
account_id: accountId,
|
|
18007
|
-
onboarding_id: onboardingId,
|
|
18008
|
-
enable_signature: signatures.enableSignature,
|
|
18009
|
-
fallback_signature: signatures.fallbackSignature,
|
|
18010
|
-
}, {
|
|
18011
|
-
idempotencyKey: workflowStageKey(workflowKey, "wallet:complete"),
|
|
18012
|
-
retryOnError: false,
|
|
18013
|
-
timeoutMs: 240_000,
|
|
18014
|
-
});
|
|
18015
|
-
if (wallet.ok === false)
|
|
18016
|
-
return wallet;
|
|
18017
|
-
context.saveCheckpoint("wallet:complete", wallet);
|
|
18157
|
+
// ARC_OWNER_BIND_MCP_20261117: the engine retired the Polygon Safe hub (410 polygon_safe_hub_retired,
|
|
18158
|
+
// b6a7ece28); a new account's wallet is its Arc home. Its device owner is bound with an owner-signed,
|
|
18159
|
+
// single-use challenge (POST /v1/arc-home/owner/challenge, then /v1/arc-home/owner), exactly as the app
|
|
18160
|
+
// does. Accounts whose Polygon Safe steps already completed keep their checkpoints and skip this.
|
|
18161
|
+
const legacyWallet = context.getCheckpoint("wallet:complete");
|
|
18162
|
+
if (!legacyWallet && !context.getCheckpoint("owner:bound")) {
|
|
18163
|
+
const bound = await bindArcHomeOwner(workflowKey, accountId, accountOwnerKey);
|
|
18164
|
+
if (bound.ok === false)
|
|
18165
|
+
return { ...bound, account_id: accountId };
|
|
18166
|
+
context.saveCheckpoint("owner:bound", bound);
|
|
18018
18167
|
}
|
|
18019
18168
|
let arcHomeReady = context.getCheckpoint("arc_home:ready");
|
|
18020
18169
|
if (!arcHomeReady) {
|
|
@@ -18284,11 +18433,13 @@ export function makeServer() {
|
|
|
18284
18433
|
account_id: accountId,
|
|
18285
18434
|
wallet_status: "ready",
|
|
18286
18435
|
custody: "non_custodial",
|
|
18287
|
-
|
|
18436
|
+
// ARC_OWNER_BIND_MCP_20261117: legacy accounts keep their Polygon Safe facts; new ones fund the
|
|
18437
|
+
// client-held owner address (the Arc home funding gate's address) and their wallet is the Arc home.
|
|
18438
|
+
deposit_address: legacyWallet ? legacyWallet.deposit_address : accountOwnerAddress,
|
|
18288
18439
|
deposit_address_role: "client_held_account_owner_eoa",
|
|
18289
18440
|
account_owner_address: accountOwnerAddress,
|
|
18290
18441
|
account_owner_derivation: "hkdf-sha256/felix-account-owner-v1",
|
|
18291
|
-
safe:
|
|
18442
|
+
safe: legacyWallet ? legacyWallet.safe : confirmedArcHome.safe,
|
|
18292
18443
|
safe_role: "owner_controlled_policy_wallet",
|
|
18293
18444
|
arc_home_status: "ready",
|
|
18294
18445
|
arc_home_safe: confirmedArcHome.safe,
|
package/dist/key-backup.js
CHANGED
|
@@ -281,6 +281,14 @@ export function parseCliArgs(argv) {
|
|
|
281
281
|
parsed.acceptTerms = true;
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
|
+
if (item === "--confirm-on-mac") {
|
|
285
|
+
// ONBOARD_CONSENT_20261117: the owner's answer was relayed by an AI agent, so a new owner key is created
|
|
286
|
+
// only after the owner clicks the native macOS confirmation as well.
|
|
287
|
+
if (parsed.confirmOnMac)
|
|
288
|
+
throw new Error("--confirm-on-mac may be provided only once.");
|
|
289
|
+
parsed.confirmOnMac = true;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
284
292
|
throw new Error(`Unknown argument: ${item}`);
|
|
285
293
|
}
|
|
286
294
|
if (["backup", "onboard"].includes(parsed.command) && parsed.input) {
|
|
@@ -295,6 +303,9 @@ export function parseCliArgs(argv) {
|
|
|
295
303
|
if (parsed.command !== "onboard" && parsed.client) {
|
|
296
304
|
throw new Error("--client is accepted only by onboard.");
|
|
297
305
|
}
|
|
306
|
+
if (parsed.command !== "onboard" && parsed.confirmOnMac) {
|
|
307
|
+
throw new Error("--confirm-on-mac is accepted only by onboard.");
|
|
308
|
+
}
|
|
298
309
|
if (parsed.command !== "onboard" && parsed.acceptTerms) {
|
|
299
310
|
throw new Error("--accept-terms is accepted only by onboard.");
|
|
300
311
|
}
|
|
@@ -1077,9 +1088,9 @@ async function registerCommand(allowExisting = false, agentManaged = false) {
|
|
|
1077
1088
|
console.log(`API key stored in Keychain (prefix ${apiKey.slice(0, 8)}). The key itself was not printed.`);
|
|
1078
1089
|
console.log("Run guided onboarding to create and authenticate the encrypted recovery file automatically before funding.");
|
|
1079
1090
|
}
|
|
1080
|
-
async function onboardCommand(client = "claude", output) {
|
|
1091
|
+
async function onboardCommand(client = "claude", output, confirmOnMac = false) {
|
|
1081
1092
|
requireNativeMacSession();
|
|
1082
|
-
await registerCommand(true,
|
|
1093
|
+
await registerCommand(true, !confirmOnMac);
|
|
1083
1094
|
const ownerKey = readKeychainPassword(OWNER_KEYCHAIN_SERVICE);
|
|
1084
1095
|
const apiKey = readKeychainPassword(API_KEYCHAIN_SERVICE);
|
|
1085
1096
|
if (!ownerKey || !PRIVATE_KEY_RE.test(ownerKey) || !apiKey || !API_KEY_RE.test(apiKey)) {
|
|
@@ -1185,7 +1196,7 @@ function printHelp() {
|
|
|
1185
1196
|
console.log(`Felix local custody setup and recovery
|
|
1186
1197
|
|
|
1187
1198
|
Usage:
|
|
1188
|
-
felix-keys onboard --accept-terms [--client claude|none] [--output <file>]
|
|
1199
|
+
felix-keys onboard --accept-terms [--client claude|none] [--output <file>] [--confirm-on-mac]
|
|
1189
1200
|
felix-keys setup
|
|
1190
1201
|
felix-keys register
|
|
1191
1202
|
felix-keys set-api-key
|
|
@@ -1213,7 +1224,7 @@ async function main() {
|
|
|
1213
1224
|
if (args.command === "help")
|
|
1214
1225
|
printHelp();
|
|
1215
1226
|
else if (args.command === "onboard")
|
|
1216
|
-
await onboardCommand(args.client, args.output);
|
|
1227
|
+
await onboardCommand(args.client, args.output, args.confirmOnMac === true);
|
|
1217
1228
|
else if (args.command === "setup")
|
|
1218
1229
|
setupCommand();
|
|
1219
1230
|
else if (args.command === "set-api-key")
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "trade.felix/mcp",
|
|
4
4
|
"title": "Felix MCP",
|
|
5
5
|
"description": "Non-custodial trading infrastructure for AI agents across prediction markets, crypto, and options.",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.129",
|
|
7
7
|
"websiteUrl": "https://felix.trade/docs",
|
|
8
8
|
"icons": [
|
|
9
9
|
{
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{
|
|
26
26
|
"registryType": "npm",
|
|
27
27
|
"identifier": "felix-mcp",
|
|
28
|
-
"version": "2.0.
|
|
28
|
+
"version": "2.0.129",
|
|
29
29
|
"transport": {
|
|
30
30
|
"type": "stdio"
|
|
31
31
|
}
|