@xlmtools/cli 0.1.2 → 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 (67) hide show
  1. package/README.md +120 -67
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +0 -0
  4. package/{src/lib/api-fetch.ts → dist/lib/api-fetch.d.ts} +3 -14
  5. package/dist/lib/budget.d.ts +14 -0
  6. package/dist/lib/cache.d.ts +7 -0
  7. package/dist/lib/config.d.ts +2 -0
  8. package/dist/lib/format.d.ts +15 -0
  9. package/dist/lib/logger.d.ts +2 -0
  10. package/dist/lib/wallet.d.ts +9 -0
  11. package/dist/server.d.ts +22 -0
  12. package/dist/server.js +89 -0
  13. package/dist/tools/budget.d.ts +2 -0
  14. package/dist/tools/crypto.d.ts +2 -0
  15. package/dist/tools/dex-candles.d.ts +2 -0
  16. package/dist/tools/dex-orderbook.d.ts +2 -0
  17. package/dist/tools/dex-trades.d.ts +2 -0
  18. package/dist/tools/domain.d.ts +2 -0
  19. package/dist/tools/image.d.ts +2 -0
  20. package/dist/tools/oracle-price.d.ts +2 -0
  21. package/dist/tools/research.d.ts +2 -0
  22. package/dist/tools/scrape.d.ts +2 -0
  23. package/dist/tools/screenshot.d.ts +2 -0
  24. package/dist/tools/search.d.ts +2 -0
  25. package/dist/tools/stellar-account.d.ts +2 -0
  26. package/dist/tools/stellar-asset.d.ts +2 -0
  27. package/dist/tools/stellar-pools.d.ts +2 -0
  28. package/dist/tools/stocks.d.ts +2 -0
  29. package/dist/tools/swap-quote.d.ts +2 -0
  30. package/dist/tools/tools-list.d.ts +2 -0
  31. package/dist/tools/wallet-tool.d.ts +2 -0
  32. package/dist/tools/weather.d.ts +2 -0
  33. package/dist/tools/youtube.d.ts +2 -0
  34. package/package.json +32 -8
  35. package/dist/index.js +0 -77
  36. package/dist/tools/card.js +0 -51
  37. package/dist/tools/reddit.js +0 -40
  38. package/src/cli.ts +0 -245
  39. package/src/index.ts +0 -90
  40. package/src/lib/budget.ts +0 -78
  41. package/src/lib/cache.ts +0 -66
  42. package/src/lib/config.ts +0 -18
  43. package/src/lib/format.ts +0 -51
  44. package/src/lib/logger.ts +0 -6
  45. package/src/lib/wallet.ts +0 -143
  46. package/src/tools/budget.ts +0 -67
  47. package/src/tools/crypto.ts +0 -26
  48. package/src/tools/dex-candles.ts +0 -53
  49. package/src/tools/dex-orderbook.ts +0 -47
  50. package/src/tools/dex-trades.ts +0 -52
  51. package/src/tools/domain.ts +0 -25
  52. package/src/tools/image.ts +0 -50
  53. package/src/tools/oracle-price.ts +0 -43
  54. package/src/tools/research.ts +0 -49
  55. package/src/tools/scrape.ts +0 -43
  56. package/src/tools/screenshot.ts +0 -48
  57. package/src/tools/search.ts +0 -49
  58. package/src/tools/stellar-account.ts +0 -40
  59. package/src/tools/stellar-asset.ts +0 -41
  60. package/src/tools/stellar-pools.ts +0 -46
  61. package/src/tools/stocks.ts +0 -45
  62. package/src/tools/swap-quote.ts +0 -44
  63. package/src/tools/tools-list.ts +0 -22
  64. package/src/tools/wallet-tool.ts +0 -51
  65. package/src/tools/weather.ts +0 -25
  66. package/src/tools/youtube.ts +0 -51
  67. package/tsconfig.json +0 -13
package/README.md CHANGED
@@ -1,99 +1,152 @@
1
1
  # @xlmtools/cli
2
2
 
3
- XLMTools CLI — the MCP server that runs locally on the user's machine. 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 is an MCP stdio server. It's started automatically by Claude, Cursor, or any MCP-compatible host when a user calls a XLMTools tool.
7
+ ```bash
8
+ npm install -g @xlmtools/cli
9
+ ```
10
+
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.
12
+
13
+ ## Usage
8
14
 
15
+ ```bash
16
+ xlm <tool> [args] [--flag value]
9
17
  ```
10
- MCP Host (Claude, Cursor, Windsurf)
11
- | stdio
12
- v
13
- @xlmtools/cli (this package)
14
- | - 21 tools registered via @modelcontextprotocol/sdk
15
- | - mppx polyfills fetch to auto-handle 402 payments
16
- | - budget enforcement (withBudget)
17
- | - response caching (withCache, 5-min TTL)
18
- |
19
- | HTTPS
20
- v
21
- @xlmtools/api (hosted API server)
18
+
19
+ ### Quick examples
20
+
21
+ ```bash
22
+ # Free tools no 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
22
41
  ```
23
42
 
24
- ## Install (for users)
43
+ Output is JSON. Pipe to `jq` for filtering:
25
44
 
26
45
  ```bash
27
- claude mcp add xlmtools npx @xlmtools/cli
46
+ xlm crypto bitcoin | jq '.bitcoin.usd'
28
47
  ```
29
48
 
30
- On first run, the CLI:
31
- 1. Generates a Stellar keypair at `~/.xlmtools/config.json`
32
- 2. Funds the wallet with testnet XLM via friendbot (testnet only)
33
- 3. Adds a USDC trustline so the wallet can receive payments
49
+ ### All commands
34
50
 
35
- ## Development
51
+ **Paid** ($0.001–$0.04 USDC per call, settled on Stellar testnet):
36
52
 
37
- ```bash
38
- # From the monorepo root
39
- 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:
40
85
 
41
- # Or directly
42
- cd packages/cli
43
- pnpm dev
44
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).
45
91
 
46
- The dev script uses `tsx watch` for hot-reload during development.
92
+ ## Wallet
47
93
 
48
- ## Build
94
+ Your wallet is at `~/.xlmtools/config.json`. The private key never leaves your machine. Check your balance:
49
95
 
50
96
  ```bash
51
- pnpm build
97
+ xlm wallet
52
98
  ```
53
99
 
54
- 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.
55
101
 
56
- ## Architecture
102
+ ## Also available as
57
103
 
58
- ### 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.
59
106
 
60
- **Paid** (7) — wrapped with `withCache` + `withBudget`:
61
- search, research, youtube, screenshot, scrape, image, stocks
107
+ ## Links
62
108
 
63
- **Free** (14):
64
- 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
65
114
 
66
- ### Key modules
115
+ ---
67
116
 
68
- | File | Purpose |
69
- | --- | --- |
70
- | `src/index.ts` | Entry point, registers all 21 tools |
71
- | `src/lib/wallet.ts` | Wallet creation, auto-funding on testnet |
72
- | `src/lib/budget.ts` | Session budget state, `withBudget()` wrapper |
73
- | `src/lib/cache.ts` | Response cache, `withCache()` wrapper |
74
- | `src/lib/format.ts` | `ok()`, `okPaid()`, `err()` response formatters |
75
- | `src/lib/config.ts` | Tool prices and free tool list |
76
- | `src/lib/logger.ts` | pino logger (stderr) |
77
- | `src/tools/*.ts` | One file per tool |
78
-
79
- ### Payment flow
80
-
81
- 1. Tool handler calls `fetch(apiUrl/toolname)` with params
82
- 2. API returns `402 Payment Required`
83
- 3. mppx (global fetch polyfill) intercepts the 402
84
- 4. Builds a Soroban SAC USDC transfer using the local Stellar keypair
85
- 5. Signs and retries the request with payment proof
86
- 6. API verifies, executes the tool, returns result with receipt
87
- 7. `okPaid()` strips the receipt and appends a human-readable payment footer
88
-
89
- ### Budget flow
117
+ ## For contributors
118
+
119
+ This package provides two things:
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
90
123
 
124
+ ### Development
125
+
126
+ ```bash
127
+ pnpm dev:cli # from monorepo root
128
+ # or
129
+ cd packages/cli && pnpm dev
91
130
  ```
92
- withCache(tool, params, () =>
93
- withBudget(tool, async () => {
94
- // API call
95
- })
96
- )
131
+
132
+ ### Build
133
+
134
+ ```bash
135
+ pnpm build
97
136
  ```
98
137
 
99
- 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.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js CHANGED
File without changes
@@ -12,19 +12,8 @@
12
12
  * const config = loadOrCreateWallet();
13
13
  * const res = await apiFetch(config, `/crypto?ids=${ids}`);
14
14
  */
15
-
16
15
  export interface ClientConfig {
17
- apiUrl: string;
18
- stellarPublicKey: string;
19
- }
20
-
21
- export async function apiFetch(
22
- config: ClientConfig,
23
- path: string,
24
- init?: RequestInit,
25
- ): Promise<Response> {
26
- const url = path.startsWith("http") ? path : `${config.apiUrl}${path}`;
27
- const headers = new Headers(init?.headers);
28
- headers.set("X-XLMTools-Client", config.stellarPublicKey);
29
- return fetch(url, { ...init, headers });
16
+ apiUrl: string;
17
+ stellarPublicKey: string;
30
18
  }
19
+ export declare function apiFetch(config: ClientConfig, path: string, init?: RequestInit): Promise<Response>;
@@ -0,0 +1,14 @@
1
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ export declare function setBudget(max: number): void;
3
+ export declare function clearBudget(): void;
4
+ export declare function getStatus(): {
5
+ max: number | null;
6
+ spent: number;
7
+ remaining: number | null;
8
+ };
9
+ /**
10
+ * Wrap a paid tool call with budget checking.
11
+ * If budget would be exceeded, returns an error without calling the API.
12
+ * On success, records the spend.
13
+ */
14
+ export declare function withBudget(toolName: string, fn: () => Promise<CallToolResult>): Promise<CallToolResult>;
@@ -0,0 +1,7 @@
1
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ /**
3
+ * Wrap a tool call with response caching.
4
+ * Identical tool+params within the TTL return the cached result
5
+ * with no API call and no payment.
6
+ */
7
+ export declare function withCache(toolName: string, params: Record<string, unknown>, fn: () => Promise<CallToolResult>): Promise<CallToolResult>;
@@ -0,0 +1,2 @@
1
+ export declare const TOOL_PRICES: Record<string, string>;
2
+ export declare const FREE_TOOLS: Set<string>;
@@ -0,0 +1,15 @@
1
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ export interface ReceiptInfo {
3
+ tx_hash: string;
4
+ amount: string;
5
+ currency: string;
6
+ network: string;
7
+ }
8
+ export declare function ok(data: unknown): CallToolResult;
9
+ /**
10
+ * Format a paid tool response, appending a receipt line if present.
11
+ * Strips the receipt from the data to avoid cluttering the JSON output,
12
+ * then appends a human-readable payment line.
13
+ */
14
+ export declare function okPaid(data: Record<string, unknown>): CallToolResult;
15
+ export declare function err(message: string): CallToolResult;
@@ -0,0 +1,2 @@
1
+ import pino from "pino";
2
+ export declare const logger: pino.Logger<never, boolean>;
@@ -0,0 +1,9 @@
1
+ import { Keypair } from "@stellar/stellar-sdk";
2
+ interface XLMToolsConfig {
3
+ stellarPrivateKey: string;
4
+ stellarPublicKey: string;
5
+ apiUrl: string;
6
+ }
7
+ export declare function loadOrCreateWallet(): XLMToolsConfig;
8
+ export declare function getKeypair(config: XLMToolsConfig): Keypair;
9
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * XLMTools MCP server factory.
3
+ *
4
+ * Builds and returns a fully-registered `McpServer` instance —
5
+ * without connecting any transport. Consumers are responsible for
6
+ * choosing the transport and calling `server.connect(transport)`.
7
+ *
8
+ * Currently used by `@xlmtools/mcp` (stdio transport wrapper).
9
+ * Could also be used to host over HTTP/SSE in the future by wiring
10
+ * a different transport.
11
+ */
12
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
+ /**
14
+ * Build a fully-configured XLMTools MCP server with all 21 tools
15
+ * registered. The caller must connect a transport.
16
+ *
17
+ * Side effects on first call:
18
+ * - Loads or creates the user's Stellar wallet at ~/.xlmtools/config.json
19
+ * - Initializes Mppx with a Stellar charge method (polyfills fetch
20
+ * to auto-handle 402 payment challenges)
21
+ */
22
+ export declare function createMcpServer(): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,89 @@
1
+ /**
2
+ * XLMTools MCP server factory.
3
+ *
4
+ * Builds and returns a fully-registered `McpServer` instance —
5
+ * without connecting any transport. Consumers are responsible for
6
+ * choosing the transport and calling `server.connect(transport)`.
7
+ *
8
+ * Currently used by `@xlmtools/mcp` (stdio transport wrapper).
9
+ * Could also be used to host over HTTP/SSE in the future by wiring
10
+ * a different transport.
11
+ */
12
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
+ import { Mppx } from "mppx/client";
14
+ import { stellar } from "@stellar/mpp/charge/client";
15
+ import { loadOrCreateWallet, getKeypair } from "./lib/wallet.js";
16
+ import { logger } from "./lib/logger.js";
17
+ import { registerCryptoTool } from "./tools/crypto.js";
18
+ import { registerWeatherTool } from "./tools/weather.js";
19
+ import { registerDomainTool } from "./tools/domain.js";
20
+ import { registerToolsListTool } from "./tools/tools-list.js";
21
+ import { registerWalletTool } from "./tools/wallet-tool.js";
22
+ import { registerSearchTool } from "./tools/search.js";
23
+ import { registerResearchTool } from "./tools/research.js";
24
+ import { registerYoutubeTool } from "./tools/youtube.js";
25
+ import { registerScreenshotTool } from "./tools/screenshot.js";
26
+ import { registerScrapeTool } from "./tools/scrape.js";
27
+ import { registerImageTool } from "./tools/image.js";
28
+ import { registerStocksTool } from "./tools/stocks.js";
29
+ import { registerDexOrderbookTool } from "./tools/dex-orderbook.js";
30
+ import { registerDexCandlesTool } from "./tools/dex-candles.js";
31
+ import { registerDexTradesTool } from "./tools/dex-trades.js";
32
+ import { registerSwapQuoteTool } from "./tools/swap-quote.js";
33
+ import { registerStellarAssetTool } from "./tools/stellar-asset.js";
34
+ import { registerStellarAccountTool } from "./tools/stellar-account.js";
35
+ import { registerStellarPoolsTool } from "./tools/stellar-pools.js";
36
+ import { registerOraclePriceTool } from "./tools/oracle-price.js";
37
+ import { registerBudgetTool } from "./tools/budget.js";
38
+ /**
39
+ * Build a fully-configured XLMTools MCP server with all 21 tools
40
+ * registered. The caller must connect a transport.
41
+ *
42
+ * Side effects on first call:
43
+ * - Loads or creates the user's Stellar wallet at ~/.xlmtools/config.json
44
+ * - Initializes Mppx with a Stellar charge method (polyfills fetch
45
+ * to auto-handle 402 payment challenges)
46
+ */
47
+ export function createMcpServer() {
48
+ const config = loadOrCreateWallet();
49
+ const keypair = getKeypair(config);
50
+ // Mppx polyfills global fetch to auto-handle 402 payments
51
+ Mppx.create({
52
+ methods: [
53
+ stellar.charge({
54
+ keypair,
55
+ mode: "pull",
56
+ onProgress(event) {
57
+ logger.debug({ eventType: event.type }, "MPP payment event");
58
+ },
59
+ }),
60
+ ],
61
+ });
62
+ // { logging: {} } enables ctx.mcpReq.log() in tool handlers
63
+ const server = new McpServer({ name: "xlmtools", version: "0.2.0" }, { capabilities: { tools: {}, logging: {} } });
64
+ // Free tools
65
+ registerCryptoTool(server);
66
+ registerWeatherTool(server);
67
+ registerDomainTool(server);
68
+ registerToolsListTool(server);
69
+ registerWalletTool(server);
70
+ registerBudgetTool(server);
71
+ // Paid tools
72
+ registerSearchTool(server);
73
+ registerResearchTool(server);
74
+ registerYoutubeTool(server);
75
+ registerScreenshotTool(server);
76
+ registerScrapeTool(server);
77
+ registerImageTool(server);
78
+ registerStocksTool(server);
79
+ // Stellar-native tools (free)
80
+ registerDexOrderbookTool(server);
81
+ registerDexCandlesTool(server);
82
+ registerDexTradesTool(server);
83
+ registerSwapQuoteTool(server);
84
+ registerStellarAssetTool(server);
85
+ registerStellarAccountTool(server);
86
+ registerStellarPoolsTool(server);
87
+ registerOraclePriceTool(server);
88
+ return server;
89
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerBudgetTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerCryptoTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDexCandlesTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDexOrderbookTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDexTradesTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDomainTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerImageTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerOraclePriceTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerResearchTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerScrapeTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerScreenshotTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerSearchTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerStellarAccountTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerStellarAssetTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerStellarPoolsTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerStocksTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerSwapQuoteTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerToolsListTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerWalletTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerWeatherTool(server: McpServer): void;
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerYoutubeTool(server: McpServer): void;
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@xlmtools/cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
+ "description": "XLMTools standalone CLI — the `xlm` command plus the `createMcpServer` factory used by the @xlmtools/mcp wrapper package.",
4
5
  "type": "module",
5
6
  "bin": {
6
- "xlmtools": "dist/index.js",
7
7
  "xlm": "dist/cli.js"
8
8
  },
9
- "scripts": {
10
- "dev": "tsx watch src/index.ts",
11
- "build": "tsc",
12
- "test": "vitest run"
13
- },
9
+ "main": "./dist/server.js",
10
+ "types": "./dist/server.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
14
15
  "dependencies": {
15
16
  "@modelcontextprotocol/sdk": "^1.29.0",
16
17
  "@stellar/mpp": "^0.4.0",
@@ -24,5 +25,28 @@
24
25
  "tsx": "^4.21.0",
25
26
  "typescript": "^6.0.2",
26
27
  "vitest": "^4.1.2"
28
+ },
29
+ "keywords": [
30
+ "stellar",
31
+ "xlm",
32
+ "cli",
33
+ "soroban",
34
+ "mpp",
35
+ "x402",
36
+ "agent-tools"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/Blockchain-Oracle/xlmtools.git",
41
+ "directory": "packages/cli"
42
+ },
43
+ "license": "MIT",
44
+ "engines": {
45
+ "node": ">=22"
46
+ },
47
+ "scripts": {
48
+ "dev": "tsx watch src/cli.ts",
49
+ "build": "tsc",
50
+ "test": "vitest run"
27
51
  }
28
- }
52
+ }
package/dist/index.js DELETED
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { Mppx } from "mppx/client";
5
- import { stellar } from "@stellar/mpp/charge/client";
6
- import { loadOrCreateWallet, getKeypair } from "./lib/wallet.js";
7
- import { logger } from "./lib/logger.js";
8
- import { registerCryptoTool } from "./tools/crypto.js";
9
- import { registerWeatherTool } from "./tools/weather.js";
10
- import { registerDomainTool } from "./tools/domain.js";
11
- import { registerToolsListTool } from "./tools/tools-list.js";
12
- import { registerWalletTool } from "./tools/wallet-tool.js";
13
- import { registerSearchTool } from "./tools/search.js";
14
- import { registerResearchTool } from "./tools/research.js";
15
- import { registerYoutubeTool } from "./tools/youtube.js";
16
- import { registerScreenshotTool } from "./tools/screenshot.js";
17
- import { registerScrapeTool } from "./tools/scrape.js";
18
- import { registerImageTool } from "./tools/image.js";
19
- import { registerStocksTool } from "./tools/stocks.js";
20
- import { registerDexOrderbookTool } from "./tools/dex-orderbook.js";
21
- import { registerDexCandlesTool } from "./tools/dex-candles.js";
22
- import { registerDexTradesTool } from "./tools/dex-trades.js";
23
- import { registerSwapQuoteTool } from "./tools/swap-quote.js";
24
- import { registerStellarAssetTool } from "./tools/stellar-asset.js";
25
- import { registerStellarAccountTool } from "./tools/stellar-account.js";
26
- import { registerStellarPoolsTool } from "./tools/stellar-pools.js";
27
- import { registerOraclePriceTool } from "./tools/oracle-price.js";
28
- import { registerBudgetTool } from "./tools/budget.js";
29
- const config = loadOrCreateWallet();
30
- const keypair = getKeypair(config);
31
- // Mppx polyfills global fetch to auto-handle 402 payments
32
- Mppx.create({
33
- methods: [
34
- stellar.charge({
35
- keypair,
36
- mode: "pull",
37
- onProgress(event) {
38
- logger.debug({ eventType: event.type }, "MPP payment event");
39
- },
40
- }),
41
- ],
42
- });
43
- // { logging: {} } enables ctx.mcpReq.log() in tool handlers
44
- const server = new McpServer({ name: "xlmtools", version: "0.1.0" }, { capabilities: { tools: {}, logging: {} } });
45
- // Free tools
46
- registerCryptoTool(server);
47
- registerWeatherTool(server);
48
- registerDomainTool(server);
49
- registerToolsListTool(server);
50
- registerWalletTool(server);
51
- registerBudgetTool(server);
52
- // Paid tools
53
- registerSearchTool(server);
54
- registerResearchTool(server);
55
- registerYoutubeTool(server);
56
- registerScreenshotTool(server);
57
- registerScrapeTool(server);
58
- registerImageTool(server);
59
- registerStocksTool(server);
60
- // Stellar-native tools (free)
61
- registerDexOrderbookTool(server);
62
- registerDexCandlesTool(server);
63
- registerDexTradesTool(server);
64
- registerSwapQuoteTool(server);
65
- registerStellarAssetTool(server);
66
- registerStellarAccountTool(server);
67
- registerStellarPoolsTool(server);
68
- registerOraclePriceTool(server);
69
- async function main() {
70
- const transport = new StdioServerTransport();
71
- await server.connect(transport);
72
- logger.info("XLMTools MCP server running");
73
- }
74
- main().catch((error) => {
75
- logger.error({ err: error }, "Fatal error");
76
- process.exit(1);
77
- });