@sardis/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.
Files changed (70) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/CLAUDE_DESKTOP_CONFIG.md +180 -0
  3. package/LICENSE +21 -0
  4. package/README.md +375 -0
  5. package/dist/api.d.ts +25 -0
  6. package/dist/api.d.ts.map +1 -0
  7. package/dist/api.js +70 -0
  8. package/dist/api.js.map +1 -0
  9. package/dist/cli.d.ts +12 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +274 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/config.d.ts +47 -0
  14. package/dist/config.d.ts.map +1 -0
  15. package/dist/config.js +82 -0
  16. package/dist/config.js.map +1 -0
  17. package/dist/index.d.ts +61 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +255 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/tools/agents.d.ts +7 -0
  22. package/dist/tools/agents.d.ts.map +1 -0
  23. package/dist/tools/agents.js +219 -0
  24. package/dist/tools/agents.js.map +1 -0
  25. package/dist/tools/approvals.d.ts +9 -0
  26. package/dist/tools/approvals.d.ts.map +1 -0
  27. package/dist/tools/approvals.js +308 -0
  28. package/dist/tools/approvals.js.map +1 -0
  29. package/dist/tools/cards.d.ts +9 -0
  30. package/dist/tools/cards.d.ts.map +1 -0
  31. package/dist/tools/cards.js +415 -0
  32. package/dist/tools/cards.js.map +1 -0
  33. package/dist/tools/fiat.d.ts +9 -0
  34. package/dist/tools/fiat.d.ts.map +1 -0
  35. package/dist/tools/fiat.js +394 -0
  36. package/dist/tools/fiat.js.map +1 -0
  37. package/dist/tools/holds.d.ts +7 -0
  38. package/dist/tools/holds.d.ts.map +1 -0
  39. package/dist/tools/holds.js +403 -0
  40. package/dist/tools/holds.js.map +1 -0
  41. package/dist/tools/index.d.ts +70 -0
  42. package/dist/tools/index.d.ts.map +1 -0
  43. package/dist/tools/index.js +152 -0
  44. package/dist/tools/index.js.map +1 -0
  45. package/dist/tools/payments.d.ts +47 -0
  46. package/dist/tools/payments.d.ts.map +1 -0
  47. package/dist/tools/payments.js +447 -0
  48. package/dist/tools/payments.js.map +1 -0
  49. package/dist/tools/policy.d.ts +41 -0
  50. package/dist/tools/policy.d.ts.map +1 -0
  51. package/dist/tools/policy.js +450 -0
  52. package/dist/tools/policy.js.map +1 -0
  53. package/dist/tools/spending.d.ts +9 -0
  54. package/dist/tools/spending.d.ts.map +1 -0
  55. package/dist/tools/spending.js +324 -0
  56. package/dist/tools/spending.js.map +1 -0
  57. package/dist/tools/types.d.ts +247 -0
  58. package/dist/tools/types.d.ts.map +1 -0
  59. package/dist/tools/types.js +71 -0
  60. package/dist/tools/types.js.map +1 -0
  61. package/dist/tools/wallet-management.d.ts +9 -0
  62. package/dist/tools/wallet-management.d.ts.map +1 -0
  63. package/dist/tools/wallet-management.js +222 -0
  64. package/dist/tools/wallet-management.js.map +1 -0
  65. package/dist/tools/wallets.d.ts +15 -0
  66. package/dist/tools/wallets.d.ts.map +1 -0
  67. package/dist/tools/wallets.js +112 -0
  68. package/dist/tools/wallets.js.map +1 -0
  69. package/mcp.json +283 -0
  70. package/package.json +145 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,69 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-01-27
9
+
10
+ ### Added
11
+
12
+ - Initial release of the Sardis MCP Server
13
+ - 36 MCP tools for AI agent payment operations
14
+ - **Wallet Tools (5)**:
15
+ - `sardis_get_wallet` - Get wallet details and configuration
16
+ - `sardis_get_balance` - Get current wallet balance and spending limits
17
+ - `sardis_create_wallet` - Create a new MPC wallet with optional spending policy
18
+ - `sardis_update_wallet_policy` - Update the spending policy for a wallet
19
+ - `sardis_list_wallets` - List all wallets
20
+ - **Payment Tools (3)**:
21
+ - `sardis_pay` - Execute a secure payment with policy validation
22
+ - `sardis_get_transaction` - Get transaction status and details
23
+ - `sardis_list_transactions` - List recent transactions
24
+ - **Policy Tools (3)**:
25
+ - `sardis_check_policy` - Check if a payment would be allowed
26
+ - `sardis_validate_limits` - Validate spending against limits
27
+ - `sardis_check_compliance` - Check vendor against compliance rules
28
+ - **Hold Tools (6)**:
29
+ - `sardis_create_hold` - Create a pre-authorization hold
30
+ - `sardis_capture_hold` - Capture a previously created hold
31
+ - `sardis_void_hold` - Void/cancel a hold
32
+ - `sardis_get_hold` - Get hold status and details
33
+ - `sardis_list_holds` - List active holds
34
+ - `sardis_extend_hold` - Extend the expiration of a hold
35
+ - **Agent Tools (4)**:
36
+ - `sardis_create_agent` - Create a new AI agent
37
+ - `sardis_get_agent` - Get agent details
38
+ - `sardis_list_agents` - List all agents
39
+ - `sardis_update_agent` - Update agent configuration
40
+ - **Card Tools (6)**:
41
+ - `sardis_issue_card` - Issue a virtual card
42
+ - `sardis_get_card` - Get virtual card details
43
+ - `sardis_list_cards` - List all virtual cards
44
+ - `sardis_freeze_card` - Temporarily freeze a card
45
+ - `sardis_unfreeze_card` - Unfreeze a card
46
+ - `sardis_cancel_card` - Permanently cancel a card
47
+ - **Fiat Tools (4)**:
48
+ - `sardis_fund_wallet` - Fund from bank account
49
+ - `sardis_withdraw_to_bank` - Withdraw to bank account
50
+ - `sardis_get_funding_status` - Check funding status
51
+ - `sardis_get_withdrawal_status` - Check withdrawal status
52
+ - **Approval Tools (2)**:
53
+ - `sardis_request_approval` - Request human approval
54
+ - `sardis_get_approval_status` - Check approval status
55
+ - **Spending Analytics Tools (3)**:
56
+ - `sardis_get_spending_summary` - Get spending summary
57
+ - `sardis_get_spending_by_vendor` - Get spending by vendor
58
+ - `sardis_get_spending_by_category` - Get spending by category
59
+
60
+ ### Features
61
+
62
+ - Financial Hallucination Prevention through policy validation
63
+ - Simulated mode for testing without API key
64
+ - Claude Desktop and Cursor integration support
65
+ - Natural language spending policies
66
+ - Risk scoring for each payment request
67
+ - Human-in-the-loop approval workflows
68
+
69
+ [0.1.0]: https://github.com/sardis-network/sardis/releases/tag/mcp-server-v0.1.0
@@ -0,0 +1,180 @@
1
+ # Claude Desktop Configuration for Sardis
2
+
3
+ Copy-paste configurations for Claude Desktop.
4
+
5
+ ## Configuration File Location
6
+
7
+ | OS | Path |
8
+ |----|------|
9
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
10
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
11
+ | Linux | `~/.config/Claude/claude_desktop_config.json` |
12
+
13
+ ## Quick Start (Simulated Mode)
14
+
15
+ Use this configuration to get started immediately without an API key:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "sardis": {
21
+ "command": "npx",
22
+ "args": ["@sardis/mcp-server", "start"]
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Production Configuration
29
+
30
+ For live transactions with your Sardis account:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "sardis": {
36
+ "command": "npx",
37
+ "args": ["@sardis/mcp-server", "start"],
38
+ "env": {
39
+ "SARDIS_API_KEY": "sk_live_YOUR_API_KEY_HERE",
40
+ "SARDIS_WALLET_ID": "wal_YOUR_WALLET_ID",
41
+ "SARDIS_MODE": "live"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## Full Configuration (All Options)
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "sardis": {
54
+ "command": "npx",
55
+ "args": ["@sardis/mcp-server", "start"],
56
+ "env": {
57
+ "SARDIS_API_KEY": "sk_live_YOUR_API_KEY_HERE",
58
+ "SARDIS_WALLET_ID": "wal_YOUR_WALLET_ID",
59
+ "SARDIS_AGENT_ID": "agt_YOUR_AGENT_ID",
60
+ "SARDIS_MODE": "live"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ## Using with Global Install
68
+
69
+ If you installed globally with `npm install -g @sardis/mcp-server`:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "sardis": {
75
+ "command": "sardis-mcp",
76
+ "args": ["start"]
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Using with Local Project
83
+
84
+ If the package is installed in your project's node_modules:
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "sardis": {
90
+ "command": "node",
91
+ "args": ["./node_modules/@sardis/mcp-server/dist/cli.js", "start"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ## Adding to Existing Configuration
98
+
99
+ If you already have other MCP servers configured:
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "your-existing-server": {
105
+ "command": "...",
106
+ "args": ["..."]
107
+ },
108
+ "sardis": {
109
+ "command": "npx",
110
+ "args": ["@sardis/mcp-server", "start"]
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## Environment Variables Reference
117
+
118
+ | Variable | Description | Example |
119
+ |----------|-------------|---------|
120
+ | `SARDIS_API_KEY` | Your API key from sardis.network | `sk_live_abc123...` |
121
+ | `SARDIS_WALLET_ID` | Default wallet for operations | `wal_xyz789...` |
122
+ | `SARDIS_AGENT_ID` | Agent ID for this connection | `agt_def456...` |
123
+ | `SARDIS_MODE` | `live` or `simulated` | `simulated` |
124
+
125
+ ## Verifying Installation
126
+
127
+ After configuration, restart Claude Desktop. You should see Sardis tools available:
128
+
129
+ 1. Open Claude Desktop
130
+ 2. Start a new conversation
131
+ 3. Ask: "What Sardis tools do you have access to?"
132
+ 4. Claude should list the 36 Sardis payment tools
133
+
134
+ ## Troubleshooting
135
+
136
+ ### Tools not appearing
137
+
138
+ 1. Verify the JSON syntax is valid
139
+ 2. Restart Claude Desktop completely
140
+ 3. Check the config file path for your OS
141
+
142
+ ### "Command not found" error
143
+
144
+ 1. Ensure Node.js 18+ is installed: `node --version`
145
+ 2. Try using the full path to npx: `/usr/local/bin/npx` (macOS/Linux)
146
+ 3. Or install globally: `npm install -g @sardis/mcp-server`
147
+
148
+ ### API errors in live mode
149
+
150
+ 1. Verify your API key is correct
151
+ 2. Check your wallet ID exists
152
+ 3. Ensure sufficient balance for operations
153
+
154
+ ## Available Tools (36)
155
+
156
+ After configuration, Claude will have access to:
157
+
158
+ **Wallet**: sardis_get_wallet, sardis_get_balance, sardis_create_wallet, sardis_update_wallet_policy, sardis_list_wallets
159
+
160
+ **Payment**: sardis_pay, sardis_get_transaction, sardis_list_transactions
161
+
162
+ **Policy**: sardis_check_policy, sardis_validate_limits, sardis_check_compliance
163
+
164
+ **Hold**: sardis_create_hold, sardis_capture_hold, sardis_void_hold, sardis_get_hold, sardis_list_holds, sardis_extend_hold
165
+
166
+ **Agent**: sardis_create_agent, sardis_get_agent, sardis_list_agents, sardis_update_agent
167
+
168
+ **Card**: sardis_issue_card, sardis_get_card, sardis_list_cards, sardis_freeze_card, sardis_unfreeze_card, sardis_cancel_card
169
+
170
+ **Fiat**: sardis_fund_wallet, sardis_withdraw_to_bank, sardis_get_funding_status, sardis_get_withdrawal_status
171
+
172
+ **Approval**: sardis_request_approval, sardis_get_approval_status
173
+
174
+ **Analytics**: sardis_get_spending_summary, sardis_get_spending_by_vendor, sardis_get_spending_by_category
175
+
176
+ ## Support
177
+
178
+ - Documentation: https://docs.sardis.network
179
+ - GitHub Issues: https://github.com/sardis-network/sardis/issues
180
+ - Email: support@sardis.network
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sardis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,375 @@
1
+ # @sardis/mcp-server
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@sardis/mcp-server.svg)](https://www.npmjs.com/package/@sardis/mcp-server)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@sardis/mcp-server.svg)](https://www.npmjs.com/package/@sardis/mcp-server)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ > Model Context Protocol (MCP) server for Sardis - Enable AI agents to execute secure payments with Financial Hallucination Prevention
8
+
9
+ ## Table of Contents
10
+
11
+ - [Quick Start](#quick-start)
12
+ - [What is this?](#what-is-this)
13
+ - [Installation](#installation)
14
+ - [Available Tools](#available-tools-36-total)
15
+ - [Policy Engine](#policy-engine)
16
+ - [Example Session](#example-session)
17
+ - [Environment Variables](#environment-variables)
18
+ - [Simulated Mode](#simulated-mode)
19
+ - [API Reference](#api-reference)
20
+ - [License](#license)
21
+
22
+ ## Quick Start
23
+
24
+ ```bash
25
+ npx @sardis/mcp-server start
26
+ ```
27
+
28
+ ## What is this?
29
+
30
+ Sardis MCP Server allows AI agents (Claude, Cursor, etc.) to execute payments through your Sardis wallet using the Model Context Protocol. It provides **Financial Hallucination Prevention** through natural language spending policies.
31
+
32
+ ## Installation
33
+
34
+ ### Option 1: npx (Recommended)
35
+
36
+ No installation required - run directly:
37
+
38
+ ```bash
39
+ npx @sardis/mcp-server start
40
+ ```
41
+
42
+ ### Option 2: Global Install
43
+
44
+ ```bash
45
+ npm install -g @sardis/mcp-server
46
+ sardis-mcp start
47
+ ```
48
+
49
+ ### Option 3: Local Install
50
+
51
+ ```bash
52
+ npm install @sardis/mcp-server
53
+ npx sardis-mcp start
54
+ ```
55
+
56
+ ## Configuration
57
+
58
+ ### Claude Desktop
59
+
60
+ Add to your Claude Desktop configuration file:
61
+
62
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
63
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
64
+ **Linux**: `~/.config/Claude/claude_desktop_config.json`
65
+
66
+ #### Minimal Configuration (Simulated Mode)
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "sardis": {
72
+ "command": "npx",
73
+ "args": ["@sardis/mcp-server", "start"]
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ #### Production Configuration
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "sardis": {
85
+ "command": "npx",
86
+ "args": ["@sardis/mcp-server", "start"],
87
+ "env": {
88
+ "SARDIS_API_KEY": "sk_live_your_api_key_here",
89
+ "SARDIS_WALLET_ID": "wal_your_wallet_id",
90
+ "SARDIS_MODE": "live"
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ### Cursor
98
+
99
+ Add to your Cursor MCP settings (`.cursor/mcp.json` or Cursor settings):
100
+
101
+ #### Minimal Configuration
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "sardis": {
107
+ "command": "npx",
108
+ "args": ["@sardis/mcp-server", "start"]
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ #### Production Configuration
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "sardis": {
120
+ "command": "npx",
121
+ "args": ["@sardis/mcp-server", "start"],
122
+ "env": {
123
+ "SARDIS_API_KEY": "sk_live_your_api_key_here",
124
+ "SARDIS_WALLET_ID": "wal_your_wallet_id",
125
+ "SARDIS_MODE": "live"
126
+ }
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ ### Other MCP Clients
133
+
134
+ For any MCP-compatible client, use:
135
+
136
+ - **Command**: `npx`
137
+ - **Arguments**: `["@sardis/mcp-server", "start"]`
138
+ - **Transport**: `stdio`
139
+
140
+ ## Available Tools (36 total)
141
+
142
+ ### Wallet Tools (5)
143
+
144
+ | Tool | Description |
145
+ |------|-------------|
146
+ | `sardis_get_wallet` | Get wallet details and configuration |
147
+ | `sardis_get_balance` | Get current wallet balance and spending limits |
148
+ | `sardis_create_wallet` | Create a new MPC wallet with optional spending policy |
149
+ | `sardis_update_wallet_policy` | Update the spending policy for a wallet |
150
+ | `sardis_list_wallets` | List all wallets, optionally filtered by agent or status |
151
+
152
+ ### Payment Tools (3)
153
+
154
+ | Tool | Description |
155
+ |------|-------------|
156
+ | `sardis_pay` | Execute a secure payment with policy validation |
157
+ | `sardis_get_transaction` | Get transaction status and details |
158
+ | `sardis_list_transactions` | List recent transactions for a wallet |
159
+
160
+ ### Policy Tools (3)
161
+
162
+ | Tool | Description |
163
+ |------|-------------|
164
+ | `sardis_check_policy` | Check if a payment would be allowed before executing |
165
+ | `sardis_validate_limits` | Validate spending against daily/monthly limits |
166
+ | `sardis_check_compliance` | Check vendor against compliance rules |
167
+
168
+ ### Hold Tools (6)
169
+
170
+ | Tool | Description |
171
+ |------|-------------|
172
+ | `sardis_create_hold` | Create a pre-authorization hold on funds |
173
+ | `sardis_capture_hold` | Capture a previously created hold |
174
+ | `sardis_void_hold` | Void/cancel a hold without capturing |
175
+ | `sardis_get_hold` | Get hold status and details |
176
+ | `sardis_list_holds` | List active holds for a wallet |
177
+ | `sardis_extend_hold` | Extend the expiration of a hold |
178
+
179
+ ### Agent Tools (4)
180
+
181
+ | Tool | Description |
182
+ |------|-------------|
183
+ | `sardis_create_agent` | Create a new AI agent with identity |
184
+ | `sardis_get_agent` | Get agent details and capabilities |
185
+ | `sardis_list_agents` | List all agents in the organization |
186
+ | `sardis_update_agent` | Update agent configuration |
187
+
188
+ ### Card Tools (6)
189
+
190
+ | Tool | Description |
191
+ |------|-------------|
192
+ | `sardis_issue_card` | Issue a virtual card linked to a wallet |
193
+ | `sardis_get_card` | Get virtual card details (masked) |
194
+ | `sardis_list_cards` | List all virtual cards for a wallet |
195
+ | `sardis_freeze_card` | Temporarily freeze a virtual card |
196
+ | `sardis_unfreeze_card` | Unfreeze a previously frozen card |
197
+ | `sardis_cancel_card` | Permanently cancel a virtual card |
198
+
199
+ ### Fiat Tools (4)
200
+
201
+ | Tool | Description |
202
+ |------|-------------|
203
+ | `sardis_fund_wallet` | Fund a wallet from bank account, wire, or card |
204
+ | `sardis_withdraw_to_bank` | Withdraw funds to a bank account |
205
+ | `sardis_get_funding_status` | Check status of a funding transfer |
206
+ | `sardis_get_withdrawal_status` | Check status of a withdrawal |
207
+
208
+ ### Approval Tools (2)
209
+
210
+ | Tool | Description |
211
+ |------|-------------|
212
+ | `sardis_request_approval` | Request human approval for payments exceeding limits |
213
+ | `sardis_get_approval_status` | Check status of a pending approval request |
214
+
215
+ ### Spending Analytics Tools (3)
216
+
217
+ | Tool | Description |
218
+ |------|-------------|
219
+ | `sardis_get_spending_summary` | Get spending summary with totals and limits |
220
+ | `sardis_get_spending_by_vendor` | Get spending breakdown by vendor |
221
+ | `sardis_get_spending_by_category` | Get spending breakdown by category |
222
+
223
+ ## Policy Engine
224
+
225
+ The server validates all payments against your configured spending policy:
226
+
227
+ - **Allowed Categories**: SaaS, DevTools, Cloud, API
228
+ - **Blocked Merchants**: Configurable blocklist
229
+ - **Transaction Limits**: Max per transaction and daily limits
230
+ - **Risk Scoring**: Each request gets a risk score
231
+ - **Approval Workflows**: Human-in-the-loop for high-value transactions
232
+
233
+ ## Example Session
234
+
235
+ ```
236
+ Agent: I need to pay $20 for OpenAI API credits
237
+
238
+ [sardis_pay] vendor="OpenAI", amount=20, purpose="API Credits"
239
+
240
+ Result: {
241
+ "success": true,
242
+ "status": "APPROVED",
243
+ "card": {
244
+ "number": "4242 **** **** 9999",
245
+ "cvv": "847",
246
+ "expiry": "12/26"
247
+ }
248
+ }
249
+
250
+ Agent: Can I buy a $500 Amazon gift card?
251
+
252
+ [sardis_pay] vendor="Amazon", amount=500
253
+
254
+ Result: {
255
+ "success": false,
256
+ "status": "BLOCKED",
257
+ "error": "POLICY_VIOLATION",
258
+ "message": "Merchant \"Amazon\" is not in the approved vendor list",
259
+ "prevention": "Financial Hallucination PREVENTED"
260
+ }
261
+
262
+ Agent: What's my spending this month?
263
+
264
+ [sardis_get_spending_summary] period="month"
265
+
266
+ Result: {
267
+ "total_spent": "450.00",
268
+ "transaction_count": 12,
269
+ "remaining_daily_limit": "50.00",
270
+ "remaining_monthly_limit": "550.00",
271
+ "top_vendor": "OpenAI"
272
+ }
273
+ ```
274
+
275
+ ## Environment Variables
276
+
277
+ | Variable | Required | Default | Description |
278
+ |----------|----------|---------|-------------|
279
+ | `SARDIS_API_KEY` | No | - | Your Sardis API key. Get one at [sardis.network](https://sardis.network) |
280
+ | `SARDIS_WALLET_ID` | No | - | Default wallet ID for operations |
281
+ | `SARDIS_AGENT_ID` | No | - | Agent ID for this MCP connection |
282
+ | `SARDIS_MODE` | No | `simulated` | `live` for real transactions, `simulated` for testing |
283
+ | `SARDIS_API_URL` | No | `https://api.sardis.network` | API endpoint (for enterprise/self-hosted) |
284
+
285
+ ### Getting Your API Key
286
+
287
+ 1. Sign up at [sardis.network](https://sardis.network)
288
+ 2. Go to Settings > API Keys
289
+ 3. Create a new API key with appropriate permissions
290
+ 4. Add it to your MCP configuration
291
+
292
+ ## Simulated Mode
293
+
294
+ When running without an API key, the server operates in simulated mode with:
295
+ - Mock wallet with $1000 balance
296
+ - Simulated transactions that don't execute on-chain
297
+ - Full policy validation to test your rules
298
+ - Realistic response formats
299
+
300
+ ## API Reference
301
+
302
+ ### Tools Schema
303
+
304
+ Each tool follows the MCP tool specification:
305
+
306
+ ```typescript
307
+ interface Tool {
308
+ name: string;
309
+ description: string;
310
+ inputSchema: JSONSchema;
311
+ }
312
+ ```
313
+
314
+ ### Common Parameters
315
+
316
+ | Parameter | Type | Description |
317
+ |-----------|------|-------------|
318
+ | `wallet_id` | `string` | The wallet ID to operate on |
319
+ | `amount` | `string` | Amount in USD (e.g., "100.00") |
320
+ | `vendor` | `string` | Merchant/vendor name |
321
+ | `purpose` | `string` | Description of the payment purpose |
322
+
323
+ ### Response Format
324
+
325
+ All tools return responses in this format:
326
+
327
+ ```typescript
328
+ interface ToolResponse {
329
+ success: boolean;
330
+ status: 'APPROVED' | 'BLOCKED' | 'PENDING' | 'ERROR';
331
+ data?: Record<string, unknown>;
332
+ error?: string;
333
+ message?: string;
334
+ }
335
+ ```
336
+
337
+ ## Requirements
338
+
339
+ - Node.js 18.0.0 or higher
340
+ - Claude Desktop, Cursor, or any MCP-compatible client
341
+
342
+ ## Troubleshooting
343
+
344
+ ### Server not starting
345
+
346
+ 1. Ensure Node.js 18+ is installed: `node --version`
347
+ 2. Clear npx cache: `npx clear-npx-cache`
348
+ 3. Try global install: `npm install -g @sardis/mcp-server`
349
+
350
+ ### Tools not appearing in Claude
351
+
352
+ 1. Restart Claude Desktop after configuration changes
353
+ 2. Check the configuration file path is correct for your OS
354
+ 3. Verify JSON syntax is valid
355
+
356
+ ### API errors
357
+
358
+ 1. Check your API key is valid
359
+ 2. Ensure `SARDIS_MODE` is set to `live` for production
360
+ 3. Verify wallet ID exists in your account
361
+
362
+ ## Support
363
+
364
+ - [Documentation](https://docs.sardis.network)
365
+ - [GitHub Issues](https://github.com/sardis-network/sardis/issues)
366
+ - [Discord Community](https://discord.gg/sardis)
367
+ - Email: support@sardis.network
368
+
369
+ ## Contributing
370
+
371
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
372
+
373
+ ## License
374
+
375
+ MIT - see [LICENSE](./LICENSE) for details.
package/dist/api.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Sardis API Client for MCP Server
3
+ *
4
+ * Handles all API communication with the Sardis backend.
5
+ */
6
+ /**
7
+ * Make an API request to Sardis
8
+ */
9
+ export declare function apiRequest<T>(method: string, path: string, body?: unknown): Promise<T>;
10
+ /**
11
+ * Generate unique mandate ID
12
+ *
13
+ * SECURITY: Uses crypto.randomUUID() for cryptographically secure IDs.
14
+ * Math.random() is not suitable for security-relevant identifiers.
15
+ */
16
+ export declare function generateMandateId(): string;
17
+ /**
18
+ * Create SHA-256 hash for audit
19
+ *
20
+ * SECURITY: The fallback now uses Node.js crypto module instead of a
21
+ * predictable timestamp string. Audit hashes must provide collision
22
+ * resistance for financial integrity.
23
+ */
24
+ export declare function createAuditHash(data: string): Promise<string>;
25
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAS1C;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBnE"}