Loading...
Loading...
Onboards an AI agent into the Senpi trading platform by creating an account, generating an API key, and configuring the Senpi MCP server connection. Supports wallet, Telegram, or agent-generated wallet identity. Use when the user says "set up Senpi", "onboard to Senpi", "connect to Senpi", "install Senpi", "register with Senpi", or when the agent needs to self-register with Senpi for autonomous trading. Do NOT use for trading operations, strategy management, or market queries -- those require the Senpi MCP server to already be connected.
npx skill4agent add senpi-ai/senpi-skills senpi-onboardnpxSENPI_MCP_ENDPOINThttps://mcp.prod.senpi.ai{{SENPI_MCP_ENDPOINT}}REFERRAL_CODE{{REFERRAL_CODE}}state.jsonFRESHif [ ! -f ~/.config/senpi/state.json ]; then
mkdir -p ~/.config/senpi
cat > ~/.config/senpi/state.json << 'STATEEOF'
{
"version": "1.0.0",
"state": "FRESH",
"error": null,
"onboarding": {
"step": "IDENTITY",
"startedAt": null,
"completedAt": null,
"identityType": null,
"subject": null,
"walletGenerated": false,
"existingAccount": false
},
"account": {},
"wallet": { "funded": false },
"firstTrade": { "completed": false, "skipped": false },
"mcp": { "configured": false }
}
STATEEOF
fiFRESHstate.jsonstateONBOARDINGonboarding.startedAtonboarding.stepIDENTITYnode -e "
const fs = require('fs');
const p = require('os').homedir() + '/.config/senpi/state.json';
const s = JSON.parse(fs.readFileSync(p, 'utf8'));
if (s.state === 'FRESH') {
s.state = 'ONBOARDING';
s.onboarding = s.onboarding || {};
s.onboarding.startedAt = new Date().toISOString();
s.onboarding.step = s.onboarding.step || 'IDENTITY';
fs.writeFileSync(p, JSON.stringify(s, null, 2));
}
"ONBOARDINGonboarding.stepmcporterif command -v mcporter &> /dev/null; then
MCPORTER_AVAILABLE=true
else
MCPORTER_AVAILABLE=false
finpm i -g mcporter
mcporter --versionMCPORTER_AVAILABLE=true@0xIDENTITY_TYPE="TELEGRAM" # or "WALLET"
IDENTITY_VALUE="username" # without @ for Telegram, or 0x... for wallet# Try npx first, then local install fallbacks
WALLET_DATA=$(npx -y -p ethers@6 node scripts/generate_wallet.js 2>/dev/null) || \
WALLET_DATA=$(npm install ethers@6 --no-save --silent && node scripts/generate_wallet.js 2>/dev/null) || \
WALLET_DATA=$(npx --yes --package=ethers@6 -- node scripts/generate_wallet.js)scripts/generate_wallet.jsWALLET_DATA=$(npx -y -p ethers@6 node -e "
const { ethers } = require('ethers');
const w = ethers.Wallet.createRandom();
console.log(JSON.stringify({
address: w.address,
privateKey: w.privateKey,
mnemonic: w.mnemonic.phrase
}));
")WALLET_DATAaddressprivateKeymnemonicmkdir -p ~/.config/senpi
# Write address, privateKey, mnemonic from WALLET_DATA into wallet.json
chmod 600 ~/.config/senpi/wallet.jsonaddressprivateKeymnemonicgeneratedAt"generatedBy": "senpi-onboard"wallet.jsonWALLET_GENERATED=true
IDENTITY_TYPE="WALLET"
IDENTITY_VALUE="<address from WALLET_DATA>"~/.config/senpi/wallet.jsonIDENTITY_TYPE"WALLET""TELEGRAM"IDENTITY_VALUE0x@WALLET_GENERATEDtrue~/.config/senpi/state.jsononboarding.stepREFERRALonboarding.identityTypeonboarding.subjectonboarding.walletGeneratedREFERRAL_CODE="{{REFERRAL_CODE}}"~/.config/senpi/state.jsononboarding.stepAPI_CALLCreateAgentStubAccountRESPONSE=$(curl -s -X POST https://moxie-backend.prod.senpi.ai/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "mutation CreateAgentStubAccount($input: CreateAgentStubAccountInput!) { CreateAgentStubAccount(input: $input) { user { id privyId userName name referralCode referrerId } apiKey apiKeyExpiresIn apiKeyTokenType referralCode agentWalletAddress } }",
"variables": {
"input": {
"from": "'"${IDENTITY_TYPE}"'",
"subject": "'"${IDENTITY_VALUE}"'",
'"$([ "$IDENTITY_TYPE" = "TELEGRAM" ] && echo "\"userName\": \"${IDENTITY_VALUE}\",")"'
"referralCode": "'"${REFERRAL_CODE}"'",
"apiKeyName": "agent-'"$(date +%s)"'"
}
}
}')"userName"IDENTITY_VALUE~/.config/senpi/state.jsononboarding.stepPARSEresponse.errorserrors[0].messageAPI_KEYdata.CreateAgentStubAccount.apiKeyUSER_IDdata.CreateAgentStubAccount.user.idUSER_REFERRAL_CODEdata.CreateAgentStubAccount.referralCodeAGENT_WALLET_ADDRESSdata.CreateAgentStubAccount.agentWalletAddress~/.config/senpi/state.jsononboarding.stepCREDENTIALSmkdir -p ~/.config/senpi
cat > ~/.config/senpi/credentials.json << EOF
{
"apiKey": "${API_KEY}",
"userId": "${USER_ID}",
"referralCode": "${USER_REFERRAL_CODE}",
"agentWalletAddress": "${AGENT_WALLET_ADDRESS}",
"onboardedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"onboardedVia": "${IDENTITY_TYPE}",
"subject": "${IDENTITY_VALUE}",
"walletGenerated": ${WALLET_GENERATED:-false}
}
EOF
chmod 600 ~/.config/senpi/credentials.json~/.config/senpi/wallet.json~/.config/senpi/state.jsononboarding.stepMCP_CONFIGmcporter config add senpi ...claude mcp add senpi ....mcp.jsonSENPI_MCP_ENDPOINThttps://mcp.prod.senpi.aiAPI_KEYstate: UNFUNDEDonboarding.step: COMPLETEUNFUNDEDonboarding.startedAtONBOARDING_STARTED_AT=$(node -e "
try {
const fs = require('fs');
const p = require('os').homedir() + '/.config/senpi/state.json';
const j = JSON.parse(fs.readFileSync(p, 'utf8'));
const v = j.onboarding && j.onboarding.startedAt;
console.log(v ? JSON.stringify(v) : 'null');
} catch (e) { console.log('null'); }
")
cat > ~/.config/senpi/state.json << EOF
{
"version": "1.0.0",
"state": "UNFUNDED",
"error": null,
"onboarding": {
"step": "COMPLETE",
"startedAt": ${ONBOARDING_STARTED_AT},
"completedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"identityType": "${IDENTITY_TYPE}",
"subject": "${IDENTITY_VALUE}",
"walletGenerated": ${WALLET_GENERATED:-false}
},
"account": {
"userId": "${USER_ID}",
"referralCode": "${USER_REFERRAL_CODE}",
"agentWalletAddress": "${AGENT_WALLET_ADDRESS}"
},
"wallet": {
"address": "${AGENT_WALLET_ADDRESS}",
"funded": false
},
"mcp": {
"configured": true,
"endpoint": "${SENPI_MCP_ENDPOINT}"
},
"firstTrade": {
"completed": false,
"skipped": false
}
}
EOFhttps://senpi.ai/skill.md?ref=<USER_REFERRAL_CODE>~/.config/senpi/credentials.jsonAGENT_WALLET_ADDRESSsenpi-getting-started-guide~/.config/senpi/wallet.jsonUNFUNDEDAWAITING_FIRST_TRADEAWAITING_FIRST_TRADEsenpi-getting-started-guide~/.config/senpi/credentials.json{{SENPI_MCP_ENDPOINT}}wallet.json