Generated note: shared plugin assets for this package live at the plugin root. Common local references were rewritten when they appeared in backticks or markdown links.
CornerStone MCP x402 Skill (for Agents)
This skill gives you (the agent) a set of tools to: create and manage Aptos and EVM wallets, check balances, and call x402-paid MCP tools (stock prediction, backtest, bank linking, agent/borrower scores). Payment is automatic — when a paid tool returns 402, the skill signs, verifies, settles, and retries transparently. You just call the tool; the result comes back.
Quick-start workflow
Follow this sequence on first use, then skip to the tool you need:
- Check wallets → call
get_wallet_addresses (no args).
- If empty → call
create_aptos_wallet then create_evm_wallet.
- Fund → call
credit_aptos_wallet (Aptos faucet) and fund_evm_wallet (EVM faucet instructions).
- Tell the user to whitelist the returned addresses at
https://arnstein.ch/flow.html.
- Check balance → call
balance_aptos (must have USDC for predictions/backtests) and/or balance_evm (must have ETH for bank linking).
- Use paid tools →
run_prediction, run_backtest, link_bank_account, or score tools.
Important: Paid tools will fail with a wallet/whitelist error if the address has not been funded and whitelisted. Always verify wallets and balances first.
Tool reference
Wallet management tools (local)
get_wallet_addresses
- Args: none
- Returns:
{ aptos: [{ address, network }], evm: [{ address, network }] } — may be empty arrays.
- When to use: Always call first before any wallet or paid tool action. Determines what exists.
- Decision: If both arrays are empty → create wallets. If only one is empty → create the missing one. If both have entries → proceed to balance check or paid tools.
create_aptos_wallet
- Args:
{ force?: boolean, network?: "testnet" | "mainnet" } — defaults: force=false, network=testnet.
- Returns:
{ success, address, network, message } or { success: false, message, addresses } if wallet exists and force=false.
- When to use: When
get_wallet_addresses returns empty aptos array, or user requests a new wallet.
- Error handling: If
success: false and wallet already exists, either use the existing wallet or retry with force: true to add another.
create_evm_wallet
- Args:
{ force?: boolean, network?: "testnet" | "mainnet" } — defaults: force=false, network=testnet.
- Returns:
{ success, address, network, message } or { success: false, message, addresses }.
- Same pattern as
create_aptos_wallet.
credit_aptos_wallet
- Args:
{ amount_octas?: number } — default 100,000,000 (= 1 APT).
- Returns on devnet:
{ success: true, address } (programmatic faucet funded).
- Returns on testnet:
{ success: true, address, faucet_url } (instructions only; no programmatic faucet).
- Prerequisite: Aptos wallet must exist (
create_aptos_wallet first).
- Note: Funded APT is for gas; tools pay in USDC (~6¢). The user may need to acquire testnet USDC separately.
fund_evm_wallet
- Args: none
- Returns:
{ success: true, address, faucet_url, message } (manual funding instructions).
- Prerequisite: EVM wallet must exist (
create_evm_wallet first).
- Note: Returns a Base Sepolia faucet URL. The user must fund manually; there is no programmatic faucet.
Balance tools (local)
balance_aptos
- Args: none
- Returns:
{ address, balances: { usdc, apt } } or { error }.
- When to use: Before calling
run_prediction, run_backtest, or score tools to confirm sufficient USDC.
balance_evm
- Args:
{ chain?: string } — default "base". Supported: base, baseSepolia, ethereum, polygon, arbitrum, optimism.
- Returns:
{ address, chain, balance, symbol } or { error }.
- When to use: Before calling
link_bank_account to confirm sufficient ETH on Base Sepolia.
- Note: For testnet tools, use
chain: "baseSepolia".
Paid MCP tools (x402 — payment handled automatically)
All paid tools accept both Aptos and EVM payment. The skill picks the best option or follows PREFERRED_PAYMENT_ORDER. You never see 402 errors — just call the tool and get the result or an error message.
run_prediction
- Args:
{ symbol: string, horizon?: number } — symbol is a stock ticker (e.g. "AAPL"), horizon is days (default 30).
- Returns: Prediction result object (forecast data, confidence intervals, etc.) or
{ error }.
- Cost: ~6¢ USDC (Aptos or EVM).
- Prerequisite: Funded + whitelisted Aptos or EVM wallet.
- Example call:
run_prediction({ symbol: "AAPL", horizon: 30 })
run_backtest
- Args:
{ symbol: string, startDate?: string, endDate?: string, strategy?: string } — dates in "YYYY-MM-DD", strategy defaults to "chronos".
- Returns: Backtest result (returns, drawdown, sharpe, etc.) or
{ error }.
- Cost: ~6¢ USDC.
- Example call:
run_backtest({ symbol: "TSLA", startDate: "2024-01-01", endDate: "2024-12-31", strategy: "chronos" })
link_bank_account
- Args: none
- Returns:
{ link_token } or account ID for Plaid bank linking, or { error }.
- Cost: ~5¢ (EVM/Base).
- Prerequisite: Funded + whitelisted EVM wallet (Base Sepolia for testnet).
get_agent_reputation_score
- Args:
{ agent_address?: string, payer_wallet?: string } — both optional; uses the configured wallet if omitted.
- Returns:
{ reputation_score: number } (e.g. 100) or 403 if not allowlisted, or { error }.
- Cost: ~6¢ via x402, or free with lender credits (pass
payer_wallet).
get_borrower_score
- Args:
{ agent_address?: string, payer_wallet?: string } — same pattern.
- Returns:
{ score: number } (100 base; higher with bank linked) or { error }.
- Cost: ~6¢ via x402, or free with lender credits.
get_agent_reputation_score_by_email
- Args:
{ email: string, payer_wallet?: string } — resolves email to allowlisted agent.
- Returns:
{ reputation_score: number } or { error }.
- Prerequisite:
SCORE_BY_EMAIL_ENABLED must be set on the server. Higher fee.
get_borrower_score_by_email
- Args:
{ email: string, payer_wallet?: string } — same pattern.
- Returns:
{ score: number } or { error }.
- Prerequisite:
SCORE_BY_EMAIL_ENABLED must be set on the server. Higher fee.
Decision tree for common tasks
"Run a prediction for X"
get_wallet_addresses
→ aptos empty? → create_aptos_wallet → credit_aptos_wallet → tell user to whitelist
→ aptos exists? → balance_aptos
→ has USDC? → run_prediction({ symbol: "X", horizon: 30 })
→ no USDC? → tell user to fund USDC, provide address
"Link a bank account"
get_wallet_addresses
→ evm empty? → create_evm_wallet → fund_evm_wallet → tell user to whitelist
→ evm exists? → balance_evm({ chain: "baseSepolia" })
→ has ETH? → link_bank_account
→ no ETH? → fund_evm_wallet (returns faucet URL)
"Get my scores"
get_wallet_addresses
→ has aptos or evm? → get_agent_reputation_score + get_borrower_score
→ neither? → create wallets first, whitelist, then query
Error handling
| Error pattern |
Meaning |
What to do |
"No Aptos wallet" |
Wallet file missing |
Call create_aptos_wallet |
"No EVM wallet" |
Wallet file missing |
Call create_evm_wallet |
"already exist. Use force: true" |
Wallet exists, not overwriting |
Use existing wallet, or pass force: true to add another |
"Payment verification failed" |
Insufficient funds or wrong asset |
Check balance; tell user to fund the wallet |
"No Aptos wallet configured" / "No EVM wallet configured" |
Paid tool needs wallet that doesn't exist |
Create the missing wallet type |
"Unsupported chain" |
Invalid chain name for balance_evm |
Use one of: base, baseSepolia, ethereum, polygon, arbitrum, optimism |
"timed out after 300s" |
MCP call took too long |
Retry once; the server may be under load |
"403" or "not allowlisted" |
Wallet not whitelisted |
Tell user to whitelist address at https://arnstein.ch/flow.html |
Setup (for the human installing this skill)
- Install:
npm install from repo root. Copy .env.example to .env.
- Configure: Set wallet paths (
APTOS_WALLET_PATH, EVM_WALLET_PATH or EVM_PRIVATE_KEY).
- Wallets: Create via tools (
create_aptos_wallet, create_evm_wallet) or CLI (node src/setup-aptos.js, node src/setup.js). Fund and whitelist all addresses at https://arnstein.ch/flow.html.
CLI commands (from repo root)
| Task |
Command |
| Generate Aptos wallet |
npm run setup:aptos |
| Generate EVM wallet |
npm run setup |
| Show addresses for whitelist |
npm run addresses |
| Credit Aptos (devnet) |
npm run credit:aptos (set APTOS_FAUCET_NETWORK=devnet) |
| EVM balance |
npm run balance -- <chain> |
| Transfer ETH/tokens |
npm run transfer -- <chain> <to> <amount> [tokenAddress] |
| Swap tokens (Odos) |
npm run swap -- <chain> <fromToken> <toToken> <amount> |
| Run skill demo |
npx cornerstone-agent "Run a 30-day prediction for AAPL" |
| Attest Aptos wallet |
npm run attest:aptos |
| Attest EVM wallet |
npm run attest:evm |
Source: FinTechTonic/autonomous-agent
1---2name: autonomous-agent-23description: CornerStone MCP x402 skill for agents. Tools for stock predictions, backtests, bank linking, and agent/borrower scores. Payment-protected MCP tools (run_prediction, run_backtest, link_bank_account, get_agent_reputation_score, get_borrower_score, by-email variants) with x402 flow (Aptos + Base). Skill handles 402 → pay → retry. Wallet attestation for onboarding. For marketplaces where agents download and use skills autonomously.4---5
6> Generated note: shared plugin assets for this package live at the plugin root. Common local references were rewritten when they appeared in backticks or markdown links.
7
8# CornerStone MCP x402 Skill (for Agents)
9
10This skill gives you (the agent) a set of tools to: create and manage Aptos and EVM wallets, check balances, and call x402-paid MCP tools (stock prediction, backtest, bank linking, agent/borrower scores). **Payment is automatic** — when a paid tool returns 402, the skill signs, verifies, settles, and retries transparently. You just call the tool; the result comes back.
11
12---
13
14## Quick-start workflow
15
16Follow this sequence on first use, then skip to the tool you need:
17
181. **Check wallets** → call `get_wallet_addresses` (no args).
192. **If empty** → call `create_aptos_wallet` then `create_evm_wallet`.
203. **Fund** → call `credit_aptos_wallet` (Aptos faucet) and `fund_evm_wallet` (EVM faucet instructions).
214. **Tell the user** to whitelist the returned addresses at `https://arnstein.ch/flow.html`.
225. **Check balance** → call `balance_aptos` (must have USDC for predictions/backtests) and/or `balance_evm` (must have ETH for bank linking).
236. **Use paid tools** → `run_prediction`, `run_backtest`, `link_bank_account`, or score tools.
24
25> **Important:** Paid tools will fail with a wallet/whitelist error if the address has not been funded and whitelisted. Always verify wallets and balances first.
26
27---
28
29## Tool reference
30
31### Wallet management tools (local)
32
33#### `get_wallet_addresses`
34- **Args:** none
35- **Returns:** `{ aptos: [{ address, network }], evm: [{ address, network }] }` — may be empty arrays.
36- **When to use:** Always call first before any wallet or paid tool action. Determines what exists.
37- **Decision:** If both arrays are empty → create wallets. If only one is empty → create the missing one. If both have entries → proceed to balance check or paid tools.
38
39#### `create_aptos_wallet`
40- **Args:** `{ force?: boolean, network?: "testnet" | "mainnet" }` — defaults: force=false, network=testnet.
41- **Returns:** `{ success, address, network, message }` or `{ success: false, message, addresses }` if wallet exists and force=false.
42- **When to use:** When `get_wallet_addresses` returns empty `aptos` array, or user requests a new wallet.
43- **Error handling:** If `success: false` and wallet already exists, either use the existing wallet or retry with `force: true` to add another.
44
45#### `create_evm_wallet`
46- **Args:** `{ force?: boolean, network?: "testnet" | "mainnet" }` — defaults: force=false, network=testnet.
47- **Returns:** `{ success, address, network, message }` or `{ success: false, message, addresses }`.
48- **Same pattern as** `create_aptos_wallet`.
49
50#### `credit_aptos_wallet`
51- **Args:** `{ amount_octas?: number }` — default 100,000,000 (= 1 APT).
52- **Returns on devnet:** `{ success: true, address }` (programmatic faucet funded).
53- **Returns on testnet:** `{ success: true, address, faucet_url }` (instructions only; no programmatic faucet).
54- **Prerequisite:** Aptos wallet must exist (`create_aptos_wallet` first).
55- **Note:** Funded APT is for gas; tools pay in USDC (~6¢). The user may need to acquire testnet USDC separately.
56
57#### `fund_evm_wallet`
58- **Args:** none
59- **Returns:** `{ success: true, address, faucet_url, message }` (manual funding instructions).
60- **Prerequisite:** EVM wallet must exist (`create_evm_wallet` first).
61- **Note:** Returns a Base Sepolia faucet URL. The user must fund manually; there is no programmatic faucet.
62
63### Balance tools (local)
64
65#### `balance_aptos`
66- **Args:** none
67- **Returns:** `{ address, balances: { usdc, apt } }` or `{ error }`.
68- **When to use:** Before calling `run_prediction`, `run_backtest`, or score tools to confirm sufficient USDC.
69
70#### `balance_evm`
71- **Args:** `{ chain?: string }` — default "base". Supported: `base`, `baseSepolia`, `ethereum`, `polygon`, `arbitrum`, `optimism`.
72- **Returns:** `{ address, chain, balance, symbol }` or `{ error }`.
73- **When to use:** Before calling `link_bank_account` to confirm sufficient ETH on Base Sepolia.
74- **Note:** For testnet tools, use `chain: "baseSepolia"`.
75
76### Paid MCP tools (x402 — payment handled automatically)
77
78> All paid tools accept both Aptos and EVM payment. The skill picks the best option or follows `PREFERRED_PAYMENT_ORDER`. You never see 402 errors — just call the tool and get the result or an error message.
79
80#### `run_prediction`
81- **Args:** `{ symbol: string, horizon?: number }` — symbol is a stock ticker (e.g. "AAPL"), horizon is days (default 30).
82- **Returns:** Prediction result object (forecast data, confidence intervals, etc.) or `{ error }`.
83- **Cost:** ~6¢ USDC (Aptos or EVM).
84- **Prerequisite:** Funded + whitelisted Aptos or EVM wallet.
85- **Example call:** `run_prediction({ symbol: "AAPL", horizon: 30 })`
86
87#### `run_backtest`
88- **Args:** `{ symbol: string, startDate?: string, endDate?: string, strategy?: string }` — dates in "YYYY-MM-DD", strategy defaults to "chronos".
89- **Returns:** Backtest result (returns, drawdown, sharpe, etc.) or `{ error }`.
90- **Cost:** ~6¢ USDC.
91- **Example call:** `run_backtest({ symbol: "TSLA", startDate: "2024-01-01", endDate: "2024-12-31", strategy: "chronos" })`
92
93#### `link_bank_account`
94- **Args:** none
95- **Returns:** `{ link_token }` or account ID for Plaid bank linking, or `{ error }`.
96- **Cost:** ~5¢ (EVM/Base).
97- **Prerequisite:** Funded + whitelisted EVM wallet (Base Sepolia for testnet).
98
99#### `get_agent_reputation_score`
100- **Args:** `{ agent_address?: string, payer_wallet?: string }` — both optional; uses the configured wallet if omitted.
101- **Returns:** `{ reputation_score: number }` (e.g. 100) or 403 if not allowlisted, or `{ error }`.
102- **Cost:** ~6¢ via x402, or free with lender credits (pass `payer_wallet`).
103
104#### `get_borrower_score`
105- **Args:** `{ agent_address?: string, payer_wallet?: string }` — same pattern.
106- **Returns:** `{ score: number }` (100 base; higher with bank linked) or `{ error }`.
107- **Cost:** ~6¢ via x402, or free with lender credits.
108
109#### `get_agent_reputation_score_by_email`
110- **Args:** `{ email: string, payer_wallet?: string }` — resolves email to allowlisted agent.
111- **Returns:** `{ reputation_score: number }` or `{ error }`.
112- **Prerequisite:** `SCORE_BY_EMAIL_ENABLED` must be set on the server. Higher fee.
113
114#### `get_borrower_score_by_email`
115- **Args:** `{ email: string, payer_wallet?: string }` — same pattern.
116- **Returns:** `{ score: number }` or `{ error }`.
117- **Prerequisite:** `SCORE_BY_EMAIL_ENABLED` must be set on the server. Higher fee.
118
119---
120
121## Decision tree for common tasks
122
123### "Run a prediction for X"
124```
125get_wallet_addresses
126 → aptos empty? → create_aptos_wallet → credit_aptos_wallet → tell user to whitelist
127 → aptos exists? → balance_aptos
128 → has USDC? → run_prediction({ symbol: "X", horizon: 30 })
129 → no USDC? → tell user to fund USDC, provide address
130```
131
132### "Link a bank account"
133```
134get_wallet_addresses
135 → evm empty? → create_evm_wallet → fund_evm_wallet → tell user to whitelist
136 → evm exists? → balance_evm({ chain: "baseSepolia" })
137 → has ETH? → link_bank_account
138 → no ETH? → fund_evm_wallet (returns faucet URL)
139```
140
141### "Get my scores"
142```
143get_wallet_addresses
144 → has aptos or evm? → get_agent_reputation_score + get_borrower_score
145 → neither? → create wallets first, whitelist, then query
146```
147
148---
149
150## Error handling
151
152| Error pattern | Meaning | What to do |
153|--------------|---------|------------|
154| `"No Aptos wallet"` | Wallet file missing | Call `create_aptos_wallet` |
155| `"No EVM wallet"` | Wallet file missing | Call `create_evm_wallet` |
156| `"already exist. Use force: true"` | Wallet exists, not overwriting | Use existing wallet, or pass `force: true` to add another |
157| `"Payment verification failed"` | Insufficient funds or wrong asset | Check balance; tell user to fund the wallet |
158| `"No Aptos wallet configured"` / `"No EVM wallet configured"` | Paid tool needs wallet that doesn't exist | Create the missing wallet type |
159| `"Unsupported chain"` | Invalid chain name for `balance_evm` | Use one of: base, baseSepolia, ethereum, polygon, arbitrum, optimism |
160| `"timed out after 300s"` | MCP call took too long | Retry once; the server may be under load |
161| `"403"` or `"not allowlisted"` | Wallet not whitelisted | Tell user to whitelist address at https://arnstein.ch/flow.html |
162
163---
164
165## Setup (for the human installing this skill)
166
1671. **Install:** `npm install` from repo root. Copy `.env.example` to `.env`.
1682. **Configure:** Set wallet paths (`APTOS_WALLET_PATH`, `EVM_WALLET_PATH` or `EVM_PRIVATE_KEY`).
1693. **Wallets:** Create via tools (`create_aptos_wallet`, `create_evm_wallet`) or CLI (`node src/setup-aptos.js`, `node src/setup.js`). Fund and whitelist all addresses at https://arnstein.ch/flow.html.
170
171---
172
173## CLI commands (from repo root)
174
175| Task | Command |
176|------|--------|
177| Generate Aptos wallet | `npm run setup:aptos` |
178| Generate EVM wallet | `npm run setup` |
179| Show addresses for whitelist | `npm run addresses` |
180| Credit Aptos (devnet) | `npm run credit:aptos` (set `APTOS_FAUCET_NETWORK=devnet`) |
181| EVM balance | `npm run balance -- <chain>` |
182| Transfer ETH/tokens | `npm run transfer -- <chain> <to> <amount> [tokenAddress]` |
183| Swap tokens (Odos) | `npm run swap -- <chain> <fromToken> <toToken> <amount>` |
184| Run skill demo | `npx cornerstone-agent "Run a 30-day prediction for AAPL"` |
185| Attest Aptos wallet | `npm run attest:aptos` |
186| Attest EVM wallet | `npm run attest:evm` |
187
188---
189
190**Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)