@xlmtools/cli 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +119 -72
  2. package/dist/cli.js +0 -0
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -1,105 +1,152 @@
1
1
  # @xlmtools/cli
2
2
 
3
- XLMTools CLI the universal standalone CLI that runs on the user's machine. Provides the `xlm` binary for direct terminal use and exports the `createMcpServer()` factory that powers the `@xlmtools/mcp` stdio server. Handles tool registration, payment signing, budget tracking, and response caching.
3
+ Standalone CLI for XLMTools 21 pay-per-call tools for AI agents on Stellar. Install it, type `xlm`, and go.
4
4
 
5
- ## How it works
5
+ ## Install
6
6
 
7
- This package ships two things:
7
+ ```bash
8
+ npm install -g @xlmtools/cli
9
+ ```
8
10
 
9
- 1. A standalone `xlm` binary the universal path. Any agent host with a Bash tool can invoke XLMTools by shelling out to `xlm <tool> <args>`.
10
- 2. A `createMcpServer()` factory exported from `main`/`types` — consumed by the sibling `@xlmtools/mcp` package, which wraps it in a thin stdio adapter for MCP-capable hosts.
11
+ On first run, XLMTools auto-generates a Stellar testnet wallet, funds it with XLM via friendbot, and adds a USDC trustline. The only manual step is grabbing testnet USDC from [faucet.circle.com](https://faucet.circle.com) to use paid tools.
11
12
 
12
- ```
13
- Agent host
14
- |
15
- |-- Bash tool --> xlm (this package's bin)
16
- |
17
- |-- MCP stdio --> @xlmtools/mcp ──> imports createMcpServer() from @xlmtools/cli
18
- v
19
- @xlmtools/api (hosted API server)
20
- - 21 tools registered via @modelcontextprotocol/sdk
21
- - mppx polyfills fetch to auto-handle 402 payments
22
- - budget enforcement (withBudget)
23
- - response caching (withCache, 5-min TTL)
13
+ ## Usage
14
+
15
+ ```bash
16
+ xlm <tool> [args] [--flag value]
24
17
  ```
25
18
 
26
- ## Install (for users)
19
+ ### Quick examples
27
20
 
28
21
  ```bash
29
- # Standalone CLI (universal works with any agent host that has Bash)
30
- npm install -g @xlmtools/cli
22
+ # Free toolsno cost
23
+ xlm crypto bitcoin,ethereum,stellar
24
+ xlm weather Lagos
25
+ xlm wallet
26
+ xlm oracle-price BTC
27
+ xlm dex-orderbook XLM/USDC --limit 5
28
+ xlm swap-quote XLM USDC 100
29
+ xlm stellar-asset USDC
30
+ xlm domain xlmtools.com
31
+ xlm tools
32
+
33
+ # Paid tools — USDC charged per call via Stellar MPP
34
+ xlm search "Stellar x402 micropayments" --count 5
35
+ xlm stocks AAPL
36
+ xlm research "Soroban smart contracts" --num-results 3
37
+ xlm youtube "Stellar blockchain"
38
+ xlm scrape https://stellar.org
39
+ xlm screenshot https://xlmtools.com --format png
40
+ xlm image "a stingray gliding over a coral reef at dusk" --size 1024x1024
41
+ ```
31
42
 
32
- # MCP server (optional fast-path install the sibling package)
33
- claude mcp add xlmtools npx @xlmtools/mcp
43
+ Output is JSON. Pipe to `jq` for filtering:
44
+
45
+ ```bash
46
+ xlm crypto bitcoin | jq '.bitcoin.usd'
34
47
  ```
35
48
 
36
- On first run, the CLI:
37
- 1. Generates a Stellar keypair at `~/.xlmtools/config.json`
38
- 2. Funds the wallet with testnet XLM via friendbot (testnet only)
39
- 3. Adds a USDC trustline so the wallet can receive payments
49
+ ### All commands
40
50
 
41
- ## Development
51
+ **Paid** ($0.001–$0.04 USDC per call, settled on Stellar testnet):
42
52
 
43
- ```bash
44
- # From the monorepo root
45
- pnpm dev:cli
53
+ | Command | Price | What it does |
54
+ | --- | --- | --- |
55
+ | `xlm search <query> [--count N]` | $0.003 | Web + news search |
56
+ | `xlm research <query> [--num-results N]` | $0.010 | Multi-source deep research |
57
+ | `xlm youtube <query>` or `--id <id>` | $0.002 | Video search or lookup |
58
+ | `xlm screenshot <url> [--format png]` | $0.010 | Capture a URL screenshot |
59
+ | `xlm scrape <url>` | $0.002 | Extract clean text from a URL |
60
+ | `xlm image <prompt> [--size 1024x1024]` | $0.040 | AI image generation |
61
+ | `xlm stocks <symbol>` | $0.001 | Real-time stock quotes |
62
+
63
+ **Free** (no cost):
64
+
65
+ | Command | What it does |
66
+ | --- | --- |
67
+ | `xlm crypto <ids> [--vs-currency usd]` | Crypto prices from CoinGecko |
68
+ | `xlm weather <location>` | Current weather for any city |
69
+ | `xlm domain <name>` | Domain availability check |
70
+ | `xlm dex-orderbook <pair> [--limit N]` | Stellar DEX orderbook |
71
+ | `xlm dex-candles <pair> [--resolution 1h] [--limit N]` | OHLCV candlesticks |
72
+ | `xlm dex-trades <pair> [--limit N]` | Recent DEX trades |
73
+ | `xlm swap-quote <from> <to> <amount>` | Best swap path between assets |
74
+ | `xlm stellar-asset <asset>` | Asset info, supply, trustlines |
75
+ | `xlm stellar-account <address>` | Account balances and signers |
76
+ | `xlm stellar-pools [--asset X] [--limit N]` | Liquidity pool data |
77
+ | `xlm oracle-price <asset> [--feed crypto]` | Reflector oracle prices |
78
+ | `xlm wallet` | Your Stellar wallet address + balance |
79
+ | `xlm tools` | List all 21 tools and prices |
80
+ | `xlm --help` | Full help text |
81
+
82
+ ## Payment
83
+
84
+ Every paid tool call produces a real Stellar testnet transaction. The receipt shows at the bottom of the output:
46
85
 
47
- # Or directly
48
- cd packages/cli
49
- pnpm dev
50
86
  ```
87
+ Payment: $0.003 USDC · tx/a3f9c28d71e0... · stellar testnet
88
+ ```
89
+
90
+ Verify any payment at [stellar.expert/explorer/testnet](https://stellar.expert/explorer/testnet).
51
91
 
52
- The dev script uses `tsx watch` for hot-reload during development.
92
+ ## Wallet
53
93
 
54
- ## Build
94
+ Your wallet is at `~/.xlmtools/config.json`. The private key never leaves your machine. Check your balance:
55
95
 
56
96
  ```bash
57
- pnpm build
97
+ xlm wallet
58
98
  ```
59
99
 
60
- Compiles TypeScript to `dist/`. The compiled entry point is `dist/index.js`.
100
+ Fund with testnet USDC: visit [faucet.circle.com](https://faucet.circle.com), select Stellar, paste your wallet address.
61
101
 
62
- ## Architecture
102
+ ## Also available as
63
103
 
64
- ### Tools (21 total)
104
+ - **MCP server**: `claude mcp add xlmtools npx @xlmtools/mcp` — for Claude Code, Cursor, Cline, VS Code Copilot, Windsurf, and 7+ other MCP hosts. Same wallet, same tools.
105
+ - **Agent Skill**: `pnpm dlx skills add github:Blockchain-Oracle/xlmtools --skill xlmtools` — teaches agents when and how to use each tool.
65
106
 
66
- **Paid** (7) — wrapped with `withCache` + `withBudget`:
67
- search, research, youtube, screenshot, scrape, image, stocks
107
+ ## Links
68
108
 
69
- **Free** (14):
70
- crypto, weather, domain, wallet, tools, budget, dex-orderbook, dex-candles, dex-trades, swap-quote, stellar-asset, stellar-account, stellar-pools, oracle-price
109
+ - [xlmtools.com](https://xlmtools.com) — website
110
+ - [docs.xlmtools.com](https://docs.xlmtools.com) full documentation
111
+ - [api.xlmtools.com](https://api.xlmtools.com) — hosted API
112
+ - [GitHub](https://github.com/Blockchain-Oracle/xlmtools) — source code
113
+ - [`@xlmtools/mcp`](https://www.npmjs.com/package/@xlmtools/mcp) — MCP server package
71
114
 
72
- ### Key modules
115
+ ---
73
116
 
74
- | File | Purpose |
75
- | --- | --- |
76
- | `src/index.ts` | Entry point, registers all 21 tools |
77
- | `src/lib/wallet.ts` | Wallet creation, auto-funding on testnet |
78
- | `src/lib/budget.ts` | Session budget state, `withBudget()` wrapper |
79
- | `src/lib/cache.ts` | Response cache, `withCache()` wrapper |
80
- | `src/lib/format.ts` | `ok()`, `okPaid()`, `err()` response formatters |
81
- | `src/lib/config.ts` | Tool prices and free tool list |
82
- | `src/lib/logger.ts` | pino logger (stderr) |
83
- | `src/tools/*.ts` | One file per tool |
84
-
85
- ### Payment flow
86
-
87
- 1. Tool handler calls `fetch(apiUrl/toolname)` with params
88
- 2. API returns `402 Payment Required`
89
- 3. mppx (global fetch polyfill) intercepts the 402
90
- 4. Builds a Soroban SAC USDC transfer using the local Stellar keypair
91
- 5. Signs and retries the request with payment proof
92
- 6. API verifies, executes the tool, returns result with receipt
93
- 7. `okPaid()` strips the receipt and appends a human-readable payment footer
94
-
95
- ### Budget flow
117
+ ## For contributors
118
+
119
+ This package provides two things:
96
120
 
121
+ 1. The `xlm` binary (standalone CLI) at `dist/cli.js`
122
+ 2. A `createMcpServer()` factory at `dist/server.js` — imported by [`@xlmtools/mcp`](https://www.npmjs.com/package/@xlmtools/mcp) to power the MCP stdio server
123
+
124
+ ### Development
125
+
126
+ ```bash
127
+ pnpm dev:cli # from monorepo root
128
+ # or
129
+ cd packages/cli && pnpm dev
97
130
  ```
98
- withCache(tool, params, () =>
99
- withBudget(tool, async () => {
100
- // API call
101
- })
102
- )
131
+
132
+ ### Build
133
+
134
+ ```bash
135
+ pnpm build
103
136
  ```
104
137
 
105
- Cache is checked first (hit = free). Budget is checked second (over limit = blocked). API call happens last. Only successful calls are charged and cached.
138
+ ### Key files
139
+
140
+ | File | Purpose |
141
+ | --- | --- |
142
+ | `src/cli.ts` | Standalone `xlm` binary — arg parsing, URL building, response printing |
143
+ | `src/server.ts` | `createMcpServer()` factory — registers all 21 tools on a fresh McpServer |
144
+ | `src/lib/wallet.ts` | Wallet creation, testnet auto-funding |
145
+ | `src/lib/api-fetch.ts` | Shared fetch with `X-XLMTools-Client` header for stats attribution |
146
+ | `src/lib/budget.ts` | Session budget cap (`withBudget()` wrapper) |
147
+ | `src/lib/cache.ts` | 5-min response cache (`withCache()` wrapper) |
148
+ | `src/tools/*.ts` | One file per tool — each calls `server.registerTool(...)` |
149
+
150
+ ## License
151
+
152
+ MIT
package/dist/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xlmtools/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "XLMTools standalone CLI — the `xlm` command plus the `createMcpServer` factory used by the @xlmtools/mcp wrapper package.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,11 +12,6 @@
12
12
  "dist",
13
13
  "README.md"
14
14
  ],
15
- "scripts": {
16
- "dev": "tsx watch src/cli.ts",
17
- "build": "tsc",
18
- "test": "vitest run"
19
- },
20
15
  "dependencies": {
21
16
  "@modelcontextprotocol/sdk": "^1.29.0",
22
17
  "@stellar/mpp": "^0.4.0",
@@ -48,5 +43,10 @@
48
43
  "license": "MIT",
49
44
  "engines": {
50
45
  "node": ">=22"
46
+ },
47
+ "scripts": {
48
+ "dev": "tsx watch src/cli.ts",
49
+ "build": "tsc",
50
+ "test": "vitest run"
51
51
  }
52
- }
52
+ }