@sly_ai/mcp-server 0.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/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # @sly/mcp-server
2
+
3
+ Model Context Protocol (MCP) server for Sly, enabling Claude Desktop integration.
4
+
5
+ ## What is MCP?
6
+
7
+ [Model Context Protocol](https://modelcontextprotocol.io/) is Anthropic's open protocol for connecting AI assistants like Claude to external tools and data sources. This server exposes Sly payment operations as MCP tools that Claude can use.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ # From npm (when published)
13
+ npm install -g @sly/mcp-server
14
+
15
+ # From source
16
+ cd packages/mcp-server
17
+ pnpm build
18
+ pnpm link --global
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ ### Claude Desktop Setup
24
+
25
+ Add to your Claude Desktop configuration file:
26
+
27
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
28
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "sly": {
34
+ "command": "npx",
35
+ "args": ["@sly/mcp-server"],
36
+ "env": {
37
+ "SLY_API_KEY": "pk_test_...",
38
+ "SLY_ENVIRONMENT": "sandbox"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Environment Variables
46
+
47
+ - `SLY_API_KEY` (required): Your Sly API key
48
+ - `SLY_ENVIRONMENT` (optional): Environment to use
49
+ - `sandbox` (default): Local development, no real transactions
50
+ - `testnet`: Testnet with real blockchain transactions
51
+ - `production`: Production environment
52
+
53
+ ## Available Tools
54
+
55
+ Once configured, Claude Desktop will have access to 22 tools across 5 categories:
56
+
57
+ ### Settlement Tools
58
+
59
+ #### `get_settlement_quote`
60
+ Get a settlement quote for cross-border payment.
61
+
62
+ **Parameters:**
63
+ - `fromCurrency`: Source currency (USD, BRL, MXN, USDC)
64
+ - `toCurrency`: Destination currency (USD, BRL, MXN, USDC)
65
+ - `amount`: Amount to convert
66
+ - `rail` (optional): Settlement rail (pix, spei, wire, usdc)
67
+
68
+ #### `create_settlement`
69
+ Execute a settlement using a quote.
70
+
71
+ **Parameters:**
72
+ - `quoteId`: Quote ID from get_settlement_quote
73
+ - `destinationAccountId`: Destination account ID
74
+ - `metadata` (optional): Additional metadata
75
+
76
+ #### `get_settlement_status`
77
+ Check the status of a settlement.
78
+
79
+ **Parameters:**
80
+ - `settlementId`: Settlement ID
81
+
82
+ ### UCP (Universal Commerce Protocol) Tools
83
+
84
+ #### `ucp_discover`
85
+ Discover a merchant's UCP capabilities.
86
+
87
+ #### `ucp_get_quote`
88
+ Get an FX quote for settlement to Brazil (Pix) or Mexico (SPEI).
89
+
90
+ #### `ucp_acquire_token`
91
+ Acquire a settlement token that locks in an FX rate for 15 minutes.
92
+
93
+ #### `ucp_settle`
94
+ Complete a settlement using a previously acquired token.
95
+
96
+ #### `ucp_get_settlement`
97
+ Check the status of a UCP settlement.
98
+
99
+ #### `ucp_list_corridors`
100
+ List available settlement corridors.
101
+
102
+ ### Agent Management Tools
103
+
104
+ #### `list_accounts`
105
+ List accounts for the current tenant. Use to find a business account for agent creation.
106
+
107
+ #### `create_agent`
108
+ Register a new AI agent under a business account.
109
+
110
+ **Parameters:**
111
+ - `accountId`: UUID of the parent business account
112
+ - `name`: Name for the agent
113
+ - `description` (optional): What the agent does
114
+
115
+ #### `verify_agent`
116
+ Verify an agent at a KYA tier (1-3). Higher tiers unlock higher spending limits.
117
+
118
+ #### `get_agent`
119
+ Get agent details including KYA tier, status, and permissions.
120
+
121
+ #### `get_agent_limits`
122
+ Get spending limits and current usage for an agent.
123
+
124
+ ### AP2 (Agent-to-Agent Protocol) Mandate Tools
125
+
126
+ #### `ap2_create_mandate`
127
+ Create a spending mandate that authorizes an agent to spend up to a budget.
128
+
129
+ **Parameters:**
130
+ - `mandate_id`: Unique mandate identifier
131
+ - `agent_id`: Agent UUID
132
+ - `account_id`: Funding account UUID
133
+ - `authorized_amount`: Maximum spend amount
134
+ - `currency` (optional): Currency (default: USD)
135
+ - `mandate_type` (optional): intent | cart | payment
136
+
137
+ #### `ap2_get_mandate`
138
+ Get mandate details including execution history and remaining budget.
139
+
140
+ #### `ap2_execute_mandate`
141
+ Execute a payment against a mandate. Deducts from the budget and creates a transfer.
142
+
143
+ #### `ap2_list_mandates`
144
+ List mandates with optional filtering by status, agent, or account.
145
+
146
+ ### ACP (Agentic Commerce Protocol) Checkout Tools
147
+
148
+ #### `acp_create_checkout`
149
+ Create a checkout session with items for an agent to purchase.
150
+
151
+ **Parameters:**
152
+ - `checkout_id`: Unique checkout identifier
153
+ - `agent_id`: Agent UUID
154
+ - `merchant_id`: Merchant identifier
155
+ - `items`: Array of items (name, quantity, unit_price, total_price)
156
+ - `tax_amount`, `shipping_amount` (optional): Additional charges
157
+
158
+ #### `acp_get_checkout`
159
+ Get checkout details including items, totals, and status.
160
+
161
+ #### `acp_complete_checkout`
162
+ Complete and pay for a checkout.
163
+
164
+ #### `acp_list_checkouts`
165
+ List checkouts with optional filtering.
166
+
167
+ ## Shopping Demo Flow
168
+
169
+ With all tools available, Claude can run the full shopping demo:
170
+
171
+ ```
172
+ User: List my accounts and find a business account
173
+
174
+ Claude: [Uses list_accounts] Found "TechCorp Trading" (acct_xxx)
175
+
176
+ User: Create a Shopping Agent under that account
177
+
178
+ Claude: [Uses create_agent] Created "Shopping Agent" (agent_xxx)
179
+
180
+ User: Verify the agent at KYA Tier 1
181
+
182
+ Claude: [Uses verify_agent] Agent verified at Tier 1
183
+
184
+ User: Create a $500 spending mandate for the agent
185
+
186
+ Claude: [Uses ap2_create_mandate] Mandate created with $500 budget
187
+
188
+ User: Create a checkout with sneakers ($199) and a backpack ($89)
189
+
190
+ Claude: [Uses acp_create_checkout] Checkout created, total: $288
191
+
192
+ User: Complete the checkout and record the payment
193
+
194
+ Claude: [Uses acp_complete_checkout, ap2_execute_mandate]
195
+ Checkout completed! $288 deducted from mandate.
196
+ Remaining budget: $212
197
+ ```
198
+
199
+ ## Development
200
+
201
+ ```bash
202
+ # Install dependencies
203
+ pnpm install
204
+
205
+ # Build
206
+ pnpm build
207
+
208
+ # Run locally
209
+ SLY_API_KEY=pk_test_xxx pnpm start
210
+
211
+ # Run tests
212
+ pnpm test
213
+
214
+ # Watch mode
215
+ pnpm dev
216
+ ```
217
+
218
+ ## Testing with MCP Inspector
219
+
220
+ The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) is a tool for debugging MCP servers:
221
+
222
+ ```bash
223
+ # Install inspector
224
+ npm install -g @modelcontextprotocol/inspector
225
+
226
+ # Run server in inspector
227
+ SLY_API_KEY=pk_test_xxx mcp-inspector npx @sly/mcp-server
228
+ ```
229
+
230
+ ## Architecture
231
+
232
+ ```
233
+ ┌─────────────────┐
234
+ │ Claude Desktop │
235
+ └────────┬────────┘
236
+ │ MCP Protocol (stdio)
237
+ ┌────────┴────────┐
238
+ │ MCP Server │
239
+ │ (This package) │
240
+ └────────┬────────┘
241
+ │ HTTP
242
+ ┌────────┴────────┐
243
+ │ Sly API │
244
+ │ (api.sly.dev) │
245
+ └─────────────────┘
246
+ ```
247
+
248
+ ## License
249
+
250
+ MIT