cornerstone-autonomous-agent 1.3.0 → 2.1.0
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/.env.example +3 -8
- package/LICENSE.md +384 -384
- package/README.md +91 -116
- package/adapters/local/README.md +2 -2
- package/adapters/openai/openapi.yaml +3 -3
- package/adapters/openclaw/SKILL.md +40 -29
- package/package.json +7 -7
- package/skills/README.md +1 -1
- package/skills/autonomous-agent/SKILL.md +41 -30
- package/src/agent/agent.js +77 -53
- package/src/agent/tools/localTools.js +260 -259
- package/src/agent/tools/mcpTools.js +150 -150
- package/src/cli.js +57 -0
- package/src/lib/aptos/signPayment.js +1 -1
- package/src/lib/evm/signPayment.js +1 -1
- package/src/lib/mcp/client.js +35 -17
- package/src/run-agent.js +2 -2
- package/src/show-agent-addresses.js +33 -33
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CornerStone MCP x402 Skill – Tools for Agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Published as [cornerstone-autonomous-agent](https://www.npmjs.com/package/cornerstone-autonomous-agent)** on npm; **source: [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)**.
|
|
4
|
+
|
|
5
|
+
A **skill** that gives agents a set of **x402-paid MCP tools**: predict tickers, backtest strategies, link bank accounts, and query agent/borrower scores. Agents using this skill pay with **Aptos** or **EVM** via the x402 facilitator. Designed for marketplaces where agents can autonomously download and use the skill; also usable from Cursor, OpenClaw/Moltbot, and headless runners.
|
|
4
6
|
|
|
5
7
|
## Why?
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Agents need tools, not a full backend. This skill provides **run_prediction**, **run_backtest**, **link_bank_account**, and **score tools** (get_agent_reputation_score, get_borrower_score, by-email variants). Agents using it talk to an **x402 MCP server**, pay with their own Aptos and EVM wallets (verify → settle), and get results after minimal setup—whitelist the agent’s addresses, fund wallets, then the agent can call the tools. The server offers both Aptos and EVM payment options; the skill handles 402 → pay → retry so the agent just calls the tool.
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -14,7 +16,7 @@ Most agent demos need a full backend and separate API keys. This agent talks to
|
|
|
14
16
|
npm install cornerstone-autonomous-agent
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
Copy the package’s `.env.example` into your project and set `
|
|
19
|
+
Copy the package’s `.env.example` into your project and set `X402_FACILITATOR_URL`, `HUGGINGFACE_API_KEY`, `LLM_MODEL`, and wallet paths. See [Config](#config).
|
|
18
20
|
|
|
19
21
|
### From source
|
|
20
22
|
|
|
@@ -23,108 +25,110 @@ git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-
|
|
|
23
25
|
npm install
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
**OpenClaw /
|
|
27
|
-
|
|
28
|
+
**OpenClaw / Moltbot:** See [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) or use your platform’s skill install (e.g. ClawHub).
|
|
28
29
|
## Quick Start
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
**Important:** Another npm package is named [autonomous](https://www.npmjs.com/package/autonomous). To run **this** package without installing, always use the full name: **`npx cornerstone-autonomous-agent`**. After you `npm install cornerstone-autonomous-agent`, the short binary `autonomous` in that project runs this CLI.
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
# Run without installing (use full package name so the other "autonomous" package isn’t used)
|
|
35
|
+
npx cornerstone-autonomous-agent setup:aptos
|
|
36
|
+
npx cornerstone-autonomous-agent setup
|
|
37
|
+
npx cornerstone-autonomous-agent addresses
|
|
38
|
+
npx cornerstone-autonomous-agent attest:aptos
|
|
39
|
+
npx cornerstone-autonomous-agent "Run a 30-day prediction for AAPL"
|
|
40
|
+
|
|
41
|
+
# Or install first, then you can use the short command in that project
|
|
42
|
+
npm install cornerstone-autonomous-agent
|
|
43
|
+
npx autonomous setup:aptos
|
|
44
|
+
npx autonomous attest:aptos
|
|
41
45
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
# Or install globally for the short command everywhere
|
|
47
|
+
npm i -g cornerstone-autonomous-agent
|
|
48
|
+
autonomous setup:aptos
|
|
49
|
+
autonomous "Run a 30-day prediction for AAPL"
|
|
46
50
|
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
# From source:
|
|
52
|
+
node src/setup-aptos.js
|
|
53
|
+
node src/run-agent.js "Run a 30-day prediction for AAPL"
|
|
50
54
|
```
|
|
51
55
|
|
|
56
|
+
**CLI:** This package registers the **`autonomous`** binary (short name) and **`cornerstone-autonomous-agent`** (matches package name). Use **`npx cornerstone-autonomous-agent <command>`** when you haven’t installed the package; use **`npx autonomous <command>`** only inside a project that has `cornerstone-autonomous-agent` installed, or **`autonomous <command>`** after a global install.
|
|
57
|
+
|
|
52
58
|
## Config
|
|
53
59
|
|
|
54
60
|
Copy `.env.example` to `.env` and set:
|
|
55
61
|
|
|
56
62
|
| Variable | Description |
|
|
57
63
|
|----------|-------------|
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
64
|
+
| `X402_FACILITATOR_URL` | Facilitator base URL (Aptos + EVM verify/settle). Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo. |
|
|
65
|
+
| `X402_EVM_FACILITATOR_URL` | Optional. EVM facilitator; defaults to X402_FACILITATOR_URL. |
|
|
66
|
+
| `PREFERRED_PAYMENT_ORDER` | Optional. Comma-separated `network|asset` (e.g. `aptos:2|usdc,eip155:84532|usdc`) to choose payment option when server returns multiple. |
|
|
61
67
|
| `LLM_BASE_URL` | OpenAI-compatible base URL (default https://router.huggingface.co/v1) |
|
|
62
68
|
| `HUGGINGFACE_API_KEY` or `HF_TOKEN` | Hugging Face API key |
|
|
63
69
|
| `LLM_MODEL` | Model ID (e.g. meta-llama/Llama-3.2-3B-Instruct) |
|
|
64
70
|
| `APTOS_WALLET_PATH` | Aptos wallet JSON path. Multi-wallet: ~/.aptos-agent-wallets.json. |
|
|
65
71
|
| `EVM_WALLET_PATH` | EVM wallet path. Multi-wallet: ~/.evm-wallets.json. Or set EVM_PRIVATE_KEY. |
|
|
66
|
-
| `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC
|
|
72
|
+
| `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC. Skill supports all EVM chains in lib/chains.js (Base, Ethereum, Polygon, etc.). |
|
|
67
73
|
|
|
68
74
|
## Commands
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
Use **`npx cornerstone-autonomous-agent <command>`** (or, in a project that has this package installed, **`npx autonomous <command>`**). From source: `node src/<script>.js` or `npm run <script>`.
|
|
71
77
|
|
|
72
78
|
| Command | Description |
|
|
73
79
|
|---------|-------------|
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
|
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
80
|
+
| `autonomous setup` | Generate EVM wallet (single; for multi use agent tool create_evm_wallet) |
|
|
81
|
+
| `autonomous setup:aptos` | Generate Aptos wallet (single; for multi use create_aptos_wallet) |
|
|
82
|
+
| `autonomous setup:evm:multichain` | Generate EVM multi-chain wallet |
|
|
83
|
+
| `autonomous addresses` | Print all Aptos and EVM addresses for whitelisting at https://arnstein.ch/flow.html |
|
|
84
|
+
| `autonomous attest:aptos` | Sign attestation for Aptos wallet (set `APTOS_PRIVATE_KEY` or `APTOS_TESTNET_*`); submit to POST /attest/aptos |
|
|
85
|
+
| `autonomous attest:evm` | Sign attestation for EVM wallet; submit to POST /attest/evm |
|
|
86
|
+
| `autonomous balance [chain]` | EVM balance |
|
|
87
|
+
| `autonomous transfer` | Transfer (see script for args) |
|
|
88
|
+
| `autonomous contract` | Contract interaction helper |
|
|
89
|
+
| `autonomous swap` | Swap helper |
|
|
90
|
+
| `autonomous` or `autonomous agent` or `autonomous start [message]` | Run skill demo (default: balance + prediction) |
|
|
91
|
+
| `npm run credit:aptos` | Credit Aptos wallet (devnet: programmatic; testnet: instructions) |
|
|
92
|
+
| `npx cornerstone-agent [message]` | Run skill demo (legacy bin name) |
|
|
84
93
|
|
|
85
94
|
**Crediting Aptos:** Testnet has no programmatic faucet—use [Aptos testnet faucet](https://aptos.dev/network/faucet). Devnet: `APTOS_FAUCET_NETWORK=devnet npm run credit:aptos`. See [Canteen – Aptos x402](https://canteenapp-aptos-x402.notion.site/).
|
|
86
95
|
|
|
87
96
|
## MCP Tools
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `get_agent_reputation_score_by_email` | `/mcp/scores/reputation-by-email` | Reputation by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
|
|
99
|
-
| `get_borrower_score_by_email` | `/mcp/scores/borrower-by-email` | Borrower score by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
|
|
98
|
+
| Tool | Description | Payment |
|
|
99
|
+
|------|-------------|---------|
|
|
100
|
+
| `run_prediction` | Stock prediction (symbol, horizon) | x402: Aptos or EVM |
|
|
101
|
+
| `run_backtest` | Backtest trading strategy | x402: Aptos or EVM |
|
|
102
|
+
| `link_bank_account` | CornerStone bank link (Plaid) | x402: Aptos or EVM |
|
|
103
|
+
| `get_agent_reputation_score` | Reputation Score: measures the agent's ability to transact using x402 | x402 or lender credits |
|
|
104
|
+
| `get_borrower_score` | Borrower score: measures real borrower behavior | x402 or lender credits |
|
|
105
|
+
| `get_agent_reputation_score_by_email` | Reputation score by email (resolves to agent) | x402 or lender credits |
|
|
106
|
+
| `get_borrower_score_by_email` | Borrower score by email | x402 or lender credits |
|
|
100
107
|
|
|
101
|
-
|
|
108
|
+
**Score definitions:** Reputation Score measures an agent’s ability to transact using x402. Borrower score measures real borrower behavior.
|
|
102
109
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- **Aptos:** `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — outputs `address`, `message`, `signature` (hex), `public_key_hex`.
|
|
106
|
-
- **EVM:** `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — outputs `address`, `message`, `signature`.
|
|
107
|
-
|
|
108
|
-
Options: `--address 0x...` to attest a specific address, `--message "Custom message"` for a custom payload.
|
|
110
|
+
All paid tools accept **both Aptos and EVM**; the server returns 402 with multiple options. Use `PREFERRED_PAYMENT_ORDER` to prefer one chain/asset.
|
|
109
111
|
|
|
110
112
|
## Supported Networks
|
|
111
113
|
|
|
112
|
-
| Network | Use |
|
|
113
|
-
|
|
114
|
-
| Aptos testnet | run_prediction, run_backtest
|
|
115
|
-
| Base Sepolia
|
|
116
|
-
| Base (mainnet) | link_bank_account (production) | ~$3.65 |
|
|
114
|
+
| Network | Use |
|
|
115
|
+
|---------|-----|
|
|
116
|
+
| Aptos testnet (aptos:2) / mainnet (aptos:1) | run_prediction, run_backtest, score tools |
|
|
117
|
+
| Base Sepolia (eip155:84532), Base (eip155:8453), Ethereum, Polygon, Arbitrum, Optimism | link_bank_account, score tools (when server offers them) |
|
|
117
118
|
|
|
118
119
|
## x402 Flow
|
|
119
120
|
|
|
120
121
|
```
|
|
121
|
-
Agent calls MCP tool
|
|
122
|
-
→ Server returns 402 +
|
|
123
|
-
→
|
|
124
|
-
→
|
|
125
|
-
→
|
|
122
|
+
Agent (using this skill) calls MCP tool
|
|
123
|
+
→ Server returns 402 + payment requirements (single or array of options: USDC, APT, native ETH)
|
|
124
|
+
→ Skill picks one option (by preferredPaymentOrder or first), builds payload (Aptos or EVM)
|
|
125
|
+
→ Skill calls facilitator /verify then /settle
|
|
126
|
+
→ Skill retries request with payment_payload
|
|
127
|
+
→ Server returns result + payment_receipt
|
|
126
128
|
```
|
|
127
129
|
|
|
130
|
+
**Multi-asset:** The server may return multiple `paymentRequirements` (e.g. USDC on Aptos, USDC on EVM, APT on Aptos, native ETH on EVM). The client uses `preferredPaymentOrder` (e.g. `["aptos:2|usdc", "eip155:84532|native"]`) to choose, or the first option. Native ETH: client submits the ETH transfer, then sends the `txHash` in the payload; facilitator verifies on-chain.
|
|
131
|
+
|
|
128
132
|
## Architecture
|
|
129
133
|
|
|
130
134
|
```
|
|
@@ -136,84 +140,55 @@ autonomous/
|
|
|
136
140
|
│ │ ├── aptos/ # Aptos wallet, balance, signPayment
|
|
137
141
|
│ │ ├── evm/ # EVM wallet, signPayment (Base)
|
|
138
142
|
│ │ └── x402/ # Payment types, verify/settle flow
|
|
139
|
-
│ ├──
|
|
143
|
+
│ ├── cli.js # CLI router (autonomous / cornerstone-autonomous-agent)
|
|
144
|
+
│ ├── run-agent.js # Skill demo entrypoint (agent + tools)
|
|
140
145
|
│ ├── setup.js # EVM wallet generation
|
|
141
146
|
│ ├── setup-aptos.js # Aptos wallet generation
|
|
142
|
-
│ ├──
|
|
143
|
-
│
|
|
144
|
-
│ └── attest-evm-wallet.js # Sign attestation for POST /attest/evm
|
|
145
|
-
├── skills/ # MoltBook/OpenClaw (AgentSkills layout)
|
|
146
|
-
│ └── autonomous-agent/
|
|
147
|
-
│ └── SKILL.md
|
|
147
|
+
│ ├── attest-aptos-wallet.js / attest-evm-wallet.js
|
|
148
|
+
│ └── show-agent-addresses.js
|
|
148
149
|
├── adapters/ # OpenClaw, OpenAI, Anthropic, local
|
|
149
150
|
├── .env.example
|
|
150
151
|
└── package.json
|
|
151
152
|
```
|
|
152
153
|
|
|
153
|
-
**Core pieces:** `lib/mcp` — MCP client and 402 retry; `lib/aptos` / `lib/evm` — wallets and payment signing; `lib/x402` — verify/settle; `agent/` — LangChain.js ReAct
|
|
154
|
+
**Core pieces:** `lib/mcp` — MCP client and 402 retry; `lib/aptos` / `lib/evm` — wallets and payment signing; `lib/x402` — verify/settle; `agent/` — LangChain.js ReAct runner and tools (for agents using the skill).
|
|
154
155
|
|
|
155
156
|
## Tech Stack
|
|
156
157
|
|
|
157
158
|
- **Runtime:** Node.js 18+
|
|
158
|
-
- **
|
|
159
|
+
- **Runner:** LangChain.js (ReAct), OpenAI-compatible LLM (e.g. Hugging Face) for the demo; agents use the tools via their own runtime
|
|
159
160
|
- **MCP:** [Model Context Protocol](https://modelcontextprotocol.io) + x402 payment flow
|
|
160
161
|
- **Chains:** Aptos (viem-style + @aptos-labs/ts-sdk), EVM (viem) for Base Sepolia/Base
|
|
161
162
|
- **Payments:** x402 facilitator (verify/settle), local wallet storage
|
|
162
163
|
|
|
163
164
|
## Security
|
|
164
165
|
|
|
165
|
-
- **Wallets:** Stored locally (e.g. `~/.aptos-agent-wallets.json`, `~/.evm-wallets.json`); private keys not logged or sent except as signed payloads to the facilitator.
|
|
166
|
+
- **Wallets:** Stored locally (e.g. `~/.aptos-agent-wallets.json`, `~/.evm-wallets.json`) for the agent using the skill; private keys not logged or sent except as signed payloads to the facilitator.
|
|
166
167
|
- **Payments:** Only verify/settle go to the facilitator; no custody of funds by the MCP server.
|
|
167
|
-
- **Whitelist:**
|
|
168
|
+
- **Whitelist:** Addresses used by the agent must be allowlisted at the onboarding flow before paid tools succeed.
|
|
168
169
|
|
|
169
170
|
## Capability + adapters
|
|
170
171
|
|
|
171
|
-
- **Capability:** Core (`src/`) — MCP client, x402 flow,
|
|
172
|
-
- **Adapters:**
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
|
|
178
|
-
##
|
|
179
|
-
|
|
180
|
-
This repo is optimized for **easy skill loading** in MoltBook and OpenClaw (Claude, Anthropic, OpenAI, and other providers work via the same agent; the skill tells the assistant how to run it).
|
|
181
|
-
|
|
182
|
-
- **Skill layout:** The skill lives in `skills/autonomous-agent/SKILL.md` (AgentSkills-compatible, single-line frontmatter, `metadata.openclaw` gating). OpenClaw/MoltBook loads skills from `skills/` subfolders.
|
|
183
|
-
- **Load options:**
|
|
184
|
-
1. **extraDirs:** Add this repo path to `~/.openclaw/openclaw.json` under `skills.load.extraDirs`. OpenClaw will scan `skills/` and load `autonomous-agent`.
|
|
185
|
-
2. **Workspace:** Clone the repo and use it as your OpenClaw workspace; workspace skills are loaded from `<workspace>/skills`.
|
|
186
|
-
3. **Managed skills:** Copy `skills/autonomous-agent` to `~/.openclaw/skills/` for all agents on the machine.
|
|
187
|
-
4. **ClawHub:** When published, install with `clawhub install autonomous-agent` (installs into `./skills` by default).
|
|
188
|
-
- **Config:** In `skills.entries["autonomous-agent"]` you can set `enabled`, `env`, or `apiKey` (maps to `primaryEnv`). Ensure `MCP_SERVER_URL`, x402 facilitator URLs, and LLM/env are set for the agent run.
|
|
189
|
-
- **Run:** From the **repository root** (parent of `skills/`), run `npx cornerstone-agent "your message"` or `npm run agent -- "your message"`.
|
|
190
|
-
|
|
191
|
-
Example `~/.openclaw/openclaw.json` to load this repo’s skills:
|
|
192
|
-
|
|
193
|
-
```json
|
|
194
|
-
{
|
|
195
|
-
"skills": {
|
|
196
|
-
"load": {
|
|
197
|
-
"extraDirs": ["/path/to/autonomous-agent"]
|
|
198
|
-
},
|
|
199
|
-
"entries": {
|
|
200
|
-
"autonomous-agent": {
|
|
201
|
-
"enabled": true,
|
|
202
|
-
"env": { "MCP_SERVER_URL": "https://borrower.replit.app" }
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
```
|
|
172
|
+
- **Capability:** Core (`src/`) — MCP client, x402 flow, tools for agents. No OpenAI/Claw/Anthropic logic in code.
|
|
173
|
+
- **Adapters:** `adapters/` — how each platform or marketplace loads the skill:
|
|
174
|
+
- [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) — OpenClaw / Moltbot
|
|
175
|
+
- [adapters/openai/openapi.yaml](adapters/openai/openapi.yaml) — Custom GPTs / Assistants
|
|
176
|
+
- [adapters/anthropic/tools.json](adapters/anthropic/tools.json) — Claude tools
|
|
177
|
+
- [adapters/local/README.md](adapters/local/README.md) — LM Studio, AutoGen, CrewAI
|
|
178
|
+
|
|
179
|
+
## Deployment order
|
|
208
180
|
|
|
181
|
+
1. **x402 facilitator** — Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo; or run local and set X402_EVM_FACILITATOR_URL to public for link_bank_account.
|
|
182
|
+
2. **MCP server** — x402-enabled.
|
|
183
|
+
3. **Skill runner (demo)** — `node src/run-agent.js` or PM2 (`pm2 start ecosystem.config.cjs --only agent-autonomous` from repo root).
|
|
209
184
|
|
|
210
185
|
## References
|
|
211
186
|
|
|
212
|
-
- **Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)
|
|
213
|
-
- **MCP integration:** [MCP_INTEGRATION_REFERENCE.md](MCP_INTEGRATION_REFERENCE.md) — endpoints, tools, resources, x402 flow, facilitator
|
|
214
187
|
- [Canteen App – Aptos x402](https://canteenapp-aptos-x402.notion.site/) — wallet hydration and crediting
|
|
215
188
|
- [LangChain.js MCP](https://js.langchain.com/docs/integrations/toolkits/mcp_toolbox)
|
|
216
189
|
- [Hugging Face Inference – OpenAI-compatible](https://huggingface.co/docs/api-inference/en/index)
|
|
190
|
+
- [evm-wallet-skill](https://github.com/surfer77/evm-wallet-skill) — self-sovereign EVM wallet pattern for agents
|
|
191
|
+
|
|
217
192
|
## License
|
|
218
193
|
|
|
219
|
-
GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
|
|
194
|
+
GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](../LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
|
package/adapters/local/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Local / OSS agents
|
|
2
2
|
|
|
3
|
-
Use the
|
|
3
|
+
Use the CornerStone MCP x402 capability from local or OSS agents (e.g. LM Studio, AutoGen, CrewAI).
|
|
4
4
|
|
|
5
5
|
1. **Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent).
|
|
6
6
|
2. **Install:** `npm install` in `autonomous/`.
|
|
7
|
-
3. **Config:** Set
|
|
7
|
+
3. **Config:** Set x402 facilitator URL and LLM/env as needed.
|
|
8
8
|
4. **Run:** `node src/run-agent.js "your message"` or wire MCP client to your agent framework.
|
|
9
9
|
5. **x402:** On 402 responses, call facilitator verify → settle, then retry the request with `PAYMENT-SIGNATURE` header.
|
|
10
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
openapi: 3.0.3
|
|
2
2
|
info:
|
|
3
|
-
title:
|
|
3
|
+
title: CornerStone MCP x402 Tools
|
|
4
4
|
description: Payment-protected tools (run_prediction, run_backtest, open_bank_account, scores). Use x402 flow (402 → pay → retry with PAYMENT-SIGNATURE).
|
|
5
5
|
version: 1.0.0
|
|
6
6
|
servers:
|
|
7
|
-
- url:
|
|
8
|
-
description: MCP server
|
|
7
|
+
- url: https://arnstein.ch/mcp
|
|
8
|
+
description: MCP server
|
|
9
9
|
paths:
|
|
10
10
|
/mcp/prediction/{symbol}:
|
|
11
11
|
get:
|
|
@@ -1,62 +1,73 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autonomous-agent
|
|
3
|
-
description:
|
|
3
|
+
description: CornerStone MCP x402 skill for agents. Tools for stock predictions, backtests, bank linking, and agent/borrower scores. Payment-protected MCP tools with x402 flow (Aptos + Base). Skill handles 402 → pay → retry. Wallet attestation for onboarding. For marketplaces where agents download and use skills autonomously.
|
|
4
4
|
metadata: {"openclaw":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]},"primaryEnv":"MCP_SERVER_URL","skillKey":"autonomous-agent"},"clawdbot":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]}}}
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# CornerStone MCP x402 Skill (for Agents)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Skill that gives **agents** tools to call x402-protected MCP endpoints: stock prediction, backtest, bank linking, and agent/borrower scores. **Payment is automatic** — the skill handles 402 → sign → verify → settle → retry transparently. Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
Clone or copy the repo. When loaded from OpenClaw/MoltBook, the skill folder is `{baseDir}`; run commands from the **repo root** (parent of `adapters/openclaw` or of `skills/autonomous-agent`).
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
# From repository root
|
|
17
16
|
git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-agent
|
|
18
17
|
npm install
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
Copy `.env.example` to `.env` and set:
|
|
22
21
|
|
|
23
|
-
- `MCP_SERVER_URL` – MCP server base URL (MCP protocol at `/mcp`)
|
|
24
22
|
- `X402_FACILITATOR_URL` – x402 facilitator (verify/settle)
|
|
25
23
|
- `LLM_BASE_URL`, `HUGGINGFACE_API_KEY` or `HF_TOKEN`, `LLM_MODEL` – for inference
|
|
26
24
|
- `APTOS_WALLET_PATH`, `EVM_WALLET_PATH` (or `EVM_PRIVATE_KEY`) – for payments
|
|
27
25
|
|
|
28
|
-
##
|
|
26
|
+
## Quick-start workflow
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
1. `get_wallet_addresses()` – check what wallets exist.
|
|
29
|
+
2. If empty: `create_aptos_wallet()` + `create_evm_wallet()`.
|
|
30
|
+
3. Fund: `credit_aptos_wallet()` + `fund_evm_wallet()`.
|
|
31
|
+
4. Whitelist addresses at https://arnstein.ch/flow.html.
|
|
32
|
+
5. Check balances: `balance_aptos()`, `balance_evm({ chain: "baseSepolia" })`.
|
|
33
|
+
6. Call paid tools: `run_prediction`, `run_backtest`, `link_bank_account`, or score tools.
|
|
34
|
+
|
|
35
|
+
## Run the skill (demo)
|
|
31
36
|
|
|
32
37
|
```bash
|
|
33
38
|
npx cornerstone-agent "Run a 30-day prediction for AAPL"
|
|
34
|
-
# Or interactive
|
|
35
39
|
npx cornerstone-agent
|
|
36
|
-
|
|
40
|
+
npm run agent -- "..."
|
|
41
|
+
node src/run-agent.js "..."
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
**x402 flow:** Agent calls tool without `payment_payload` → server returns 402 + `paymentRequirements` → agent signs, facilitator verify/settle → agent retries with `payment_payload` → receives result + `paymentReceipt`.
|
|
40
|
-
|
|
41
44
|
## Wallet attestation (signing)
|
|
42
45
|
|
|
43
|
-
To prove wallet ownership during onboarding, run from repo root:
|
|
44
|
-
|
|
45
46
|
- Aptos: `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — output to POST /attest/aptos
|
|
46
47
|
- EVM: `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — output to POST /attest/evm
|
|
47
48
|
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
## Tool reference
|
|
50
|
+
|
|
51
|
+
### Wallet tools (local)
|
|
52
|
+
| Tool | Args | Returns |
|
|
53
|
+
|------|------|---------|
|
|
54
|
+
| `get_wallet_addresses` | none | `{ aptos: [{ address, network }], evm: [...] }` |
|
|
55
|
+
| `create_aptos_wallet` | `{ force?, network? }` | `{ success, address, network }` |
|
|
56
|
+
| `create_evm_wallet` | `{ force?, network? }` | `{ success, address, network }` |
|
|
57
|
+
| `credit_aptos_wallet` | `{ amount_octas? }` | devnet: funds directly; testnet: `{ faucet_url, address }` |
|
|
58
|
+
| `fund_evm_wallet` | none | `{ faucet_url, address, message }` |
|
|
59
|
+
| `balance_aptos` | none | `{ address, balances: { usdc, apt } }` |
|
|
60
|
+
| `balance_evm` | `{ chain? }` | `{ address, chain, balance, symbol }` |
|
|
61
|
+
|
|
62
|
+
### Paid MCP tools (x402 — payment automatic)
|
|
63
|
+
| Tool | Args | Returns | Cost |
|
|
64
|
+
|------|------|---------|------|
|
|
65
|
+
| `run_prediction` | `{ symbol, horizon? }` | Forecast data | ~6¢ |
|
|
66
|
+
| `run_backtest` | `{ symbol, startDate?, endDate?, strategy? }` | Performance metrics | ~6¢ |
|
|
67
|
+
| `link_bank_account` | none | `{ link_token }` | ~5¢ |
|
|
68
|
+
| `get_agent_reputation_score` | `{ agent_address?, payer_wallet? }` | `{ reputation_score }` | ~6¢ or credits |
|
|
69
|
+
| `get_borrower_score` | `{ agent_address?, payer_wallet? }` | `{ score }` | ~6¢ or credits |
|
|
70
|
+
| `get_agent_reputation_score_by_email` | `{ email, payer_wallet? }` | `{ reputation_score }` | higher |
|
|
71
|
+
| `get_borrower_score_by_email` | `{ email, payer_wallet? }` | `{ score }` | higher |
|
|
72
|
+
|
|
73
|
+
Whitelist the addresses the agent uses at https://arnstein.ch/flow.html so the server allows those wallets.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cornerstone-autonomous-agent",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "CornerStone
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "CornerStone MCP x402 skill for agents: tools to predict tickers, backtest strategies, link bank accounts, and query agent/borrower scores. Agents pay via Aptos/EVM (x402). Handles 402 → pay → retry. Publishable in marketplaces for autonomous download and use. Includes LangChain.js demo runner (Hugging Face / OpenAI-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/run-agent.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"
|
|
9
|
-
"cornerstone-agent
|
|
10
|
-
"cornerstone-agent
|
|
8
|
+
"autonomous": "src/cli.js",
|
|
9
|
+
"cornerstone-autonomous-agent": "src/cli.js",
|
|
10
|
+
"cornerstone-agent": "src/run-agent.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"src",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@aptos-labs/ts-sdk": "^1.0.0"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
|
-
"
|
|
54
|
+
"cornerstone-mcp",
|
|
55
55
|
"demo",
|
|
56
56
|
"autonomous-agent",
|
|
57
57
|
"x402",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"evm",
|
|
68
68
|
"crypto"
|
|
69
69
|
],
|
|
70
|
-
"author": "
|
|
70
|
+
"author": "CornerStone MCP",
|
|
71
71
|
"license": "GPL-2.0-only",
|
|
72
72
|
"repository": {
|
|
73
73
|
"type": "git",
|
package/skills/README.md
CHANGED
|
@@ -4,6 +4,6 @@ This folder follows the **AgentSkills** layout expected by MoltBook and OpenClaw
|
|
|
4
4
|
|
|
5
5
|
| Skill | Description |
|
|
6
6
|
|-------|-------------|
|
|
7
|
-
| [autonomous-agent](autonomous-agent/SKILL.md) | x402 MCP
|
|
7
|
+
| [autonomous-agent](autonomous-agent/SKILL.md) | x402 MCP skill for agents: stock prediction, backtest, link_bank_account, agent/borrower scores (Aptos + Base). Wallet attestation for onboarding. |
|
|
8
8
|
|
|
9
9
|
**Loading:** Add this repo path to `skills.load.extraDirs` in `~/.openclaw/openclaw.json` (MoltBook/OpenClaw will load `autonomous-agent` from `skills/autonomous-agent/`), or copy `autonomous-agent` into `~/.openclaw/skills/`, or use the repo as your OpenClaw workspace. See the main [README](../README.md#moltbook--openclaw).
|
|
@@ -1,62 +1,73 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autonomous-agent
|
|
3
|
-
description:
|
|
3
|
+
description: CornerStone MCP x402 skill for agents. Tools for stock predictions, backtests, bank linking, and agent/borrower scores. Payment-protected MCP tools with x402 flow (Aptos + Base). Skill handles 402 → pay → retry. Wallet attestation for onboarding. For marketplaces where agents download and use skills autonomously.
|
|
4
4
|
metadata: {"openclaw":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]},"primaryEnv":"MCP_SERVER_URL","skillKey":"autonomous-agent"},"clawdbot":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]}}}
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# CornerStone MCP x402 Skill (for Agents)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Skill that gives **agents** tools to call x402-protected MCP endpoints: stock prediction, backtest, bank linking, and agent/borrower scores. **Payment is automatic** — the skill handles 402 → sign → verify → settle → retry transparently. Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
When this skill is loaded from the **autonomous-agent** repo, the repo root is the parent of the skill folder `{baseDir}`. Clone and install from the repo root:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
# From repository root (parent of {baseDir} when using this repo)
|
|
17
16
|
git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-agent
|
|
18
17
|
npm install
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
Copy `.env.example` to `.env` and set:
|
|
22
21
|
|
|
23
|
-
- `
|
|
24
|
-
- `X402_FACILITATOR_URL` – x402 facilitator (verify/settle)
|
|
22
|
+
- set `X402_FACILITATOR_URL` too
|
|
25
23
|
- `LLM_BASE_URL`, `HUGGINGFACE_API_KEY` or `HF_TOKEN`, `LLM_MODEL` – for inference
|
|
26
24
|
- `APTOS_WALLET_PATH`, `EVM_WALLET_PATH` (or `EVM_PRIVATE_KEY`) – for payments
|
|
27
25
|
|
|
28
|
-
##
|
|
26
|
+
## Quick-start workflow
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
1. `get_wallet_addresses()` – check what wallets exist.
|
|
29
|
+
2. If empty: `create_aptos_wallet()` + `create_evm_wallet()`.
|
|
30
|
+
3. Fund: `credit_aptos_wallet()` + `fund_evm_wallet()`.
|
|
31
|
+
4. Whitelist addresses at https://arnstein.ch/sse/flow.html.
|
|
32
|
+
5. Check balances: `balance_aptos()`, `balance_evm({ chain: "baseSepolia" })`.
|
|
33
|
+
6. Call paid tools: `run_prediction`, `run_backtest`, `link_bank_account`, or score tools.
|
|
34
|
+
|
|
35
|
+
## Run the skill (demo)
|
|
31
36
|
|
|
32
37
|
```bash
|
|
33
38
|
npx cornerstone-agent "Run a 30-day prediction for AAPL"
|
|
34
|
-
# Or interactive
|
|
35
39
|
npx cornerstone-agent
|
|
36
|
-
|
|
40
|
+
npm run agent -- "..."
|
|
41
|
+
node src/run-agent.js "..."
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
**x402 flow:** Agent calls tool without `payment_payload` → server returns 402 + `paymentRequirements` → agent signs, facilitator verify/settle → agent retries with `payment_payload` → receives result + `paymentReceipt`.
|
|
40
|
-
|
|
41
44
|
## Wallet attestation (signing)
|
|
42
45
|
|
|
43
|
-
To prove wallet ownership during onboarding, run from repo root:
|
|
44
|
-
|
|
45
46
|
- Aptos: `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — output to POST /attest/aptos
|
|
46
47
|
- EVM: `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — output to POST /attest/evm
|
|
47
48
|
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
## Tool reference
|
|
50
|
+
|
|
51
|
+
### Wallet tools (local)
|
|
52
|
+
| Tool | Args | Returns |
|
|
53
|
+
|------|------|---------|
|
|
54
|
+
| `get_wallet_addresses` | none | `{ aptos: [{ address, network }], evm: [...] }` |
|
|
55
|
+
| `create_aptos_wallet` | `{ force?, network? }` | `{ success, address, network }` |
|
|
56
|
+
| `create_evm_wallet` | `{ force?, network? }` | `{ success, address, network }` |
|
|
57
|
+
| `credit_aptos_wallet` | `{ amount_octas? }` | devnet: funds directly; testnet: `{ faucet_url, address }` |
|
|
58
|
+
| `fund_evm_wallet` | none | `{ faucet_url, address, message }` |
|
|
59
|
+
| `balance_aptos` | none | `{ address, balances: { usdc, apt } }` |
|
|
60
|
+
| `balance_evm` | `{ chain? }` | `{ address, chain, balance, symbol }` |
|
|
61
|
+
|
|
62
|
+
### Paid MCP tools (x402 — payment automatic)
|
|
63
|
+
| Tool | Args | Returns | Cost |
|
|
64
|
+
|------|------|---------|------|
|
|
65
|
+
| `run_prediction` | `{ symbol, horizon? }` | Forecast data | ~6¢ |
|
|
66
|
+
| `run_backtest` | `{ symbol, startDate?, endDate?, strategy? }` | Performance metrics | ~6¢ |
|
|
67
|
+
| `link_bank_account` | none | `{ link_token }` | ~5¢ |
|
|
68
|
+
| `get_agent_reputation_score` | `{ agent_address?, payer_wallet? }` | `{ reputation_score }` | ~6¢ or credits |
|
|
69
|
+
| `get_borrower_score` | `{ agent_address?, payer_wallet? }` | `{ score }` | ~6¢ or credits |
|
|
70
|
+
| `get_agent_reputation_score_by_email` | `{ email, payer_wallet? }` | `{ reputation_score }` | higher |
|
|
71
|
+
| `get_borrower_score_by_email` | `{ email, payer_wallet? }` | `{ score }` | higher |
|
|
72
|
+
|
|
73
|
+
Whitelist the addresses the agent uses at https://arnstein.ch/sse/flow.html so the server allows those wallets.
|