shabaaspay-mcp-server 1.0.1 → 1.0.2

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.
@@ -22,8 +22,8 @@ const ConfigSchema = zod_1.z.object({
22
22
  // ShaBaas API authentication
23
23
  shabaasAuthUuid: zod_1.z.string().min(1, 'ShaBaas auth UUID is required'),
24
24
  // Base URLs (override via env; defaults are placeholders only)
25
- sandboxUrl: zod_1.z.string().url().default('https://sandbox.example.com'),
26
- productionUrl: zod_1.z.string().url().default('https://api.example.com'),
25
+ sandboxUrl: zod_1.z.string().url().default('https://mcp-staging.shabaas.com'),
26
+ productionUrl: zod_1.z.string().url().default('https://mcp.shabaas.com'),
27
27
  // HTTP mode configuration (optional)
28
28
  httpPort: zod_1.z.coerce.number().default(3000),
29
29
  httpHost: zod_1.z.string().default('0.0.0.0'),
@@ -229,7 +229,19 @@ class HttpMcpServer {
229
229
  },
230
230
  };
231
231
  }
232
- const policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
232
+ let policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
233
+ // POLICY BYPASS: Owner/Admin fallback for local dev
234
+ if (!policyResult.policy && this.config.shabaasAuthUuid && token === this.config.shabaasAuthUuid) {
235
+ policyResult = {
236
+ policy: {
237
+ client_id: 'owner-admin',
238
+ status: 'active',
239
+ allowed_tools: ['*'],
240
+ environment: this.config.environment,
241
+ admin: true
242
+ }
243
+ };
244
+ }
233
245
  if (!policyResult.policy) {
234
246
  return {
235
247
  success: false,
@@ -273,7 +285,19 @@ class HttpMcpServer {
273
285
  },
274
286
  };
275
287
  }
276
- const policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
288
+ let policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
289
+ // POLICY BYPASS: Owner/Admin fallback for local dev
290
+ if (!policyResult.policy && this.config.shabaasAuthUuid && token === this.config.shabaasAuthUuid) {
291
+ policyResult = {
292
+ policy: {
293
+ client_id: 'owner-admin',
294
+ status: 'active',
295
+ allowed_tools: ['*'],
296
+ environment: this.config.environment,
297
+ admin: true
298
+ }
299
+ };
300
+ }
277
301
  if (!policyResult.policy) {
278
302
  return {
279
303
  success: false,
@@ -358,7 +382,19 @@ class HttpMcpServer {
358
382
  },
359
383
  };
360
384
  }
361
- const policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
385
+ let policyResult = (0, policy_js_1.lookupClientPolicy)(token, this.config.environment);
386
+ // POLICY BYPASS: Owner/Admin fallback for local dev
387
+ if (!policyResult.policy && this.config.shabaasAuthUuid && token === this.config.shabaasAuthUuid) {
388
+ policyResult = {
389
+ policy: {
390
+ client_id: 'owner-admin',
391
+ status: 'active',
392
+ allowed_tools: ['*'],
393
+ environment: this.config.environment,
394
+ admin: true
395
+ }
396
+ };
397
+ }
362
398
  if (!policyResult.policy || !(0, policy_js_1.isToolAllowed)(policyResult.policy, toolName)) {
363
399
  return {
364
400
  statusCode: 403,
@@ -54,19 +54,39 @@ class StdioMcpServer {
54
54
  this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
55
55
  const { name, arguments: args } = request.params;
56
56
  console.error(`[STDIO] Executing tool: ${name}`);
57
- console.error(`[STDIO] Arguments:`, JSON.stringify(args, null, 2));
58
- // Auth guard: require authorization field in args (UUID or configured key)
59
- const authToken = args?.authorization;
57
+ // console.error(`[STDIO] Arguments:`, JSON.stringify(args, null, 2));
58
+ // Auth guard: check args first, then fallback to env config
59
+ let authToken = args?.authorization;
60
60
  if (!authToken) {
61
- throw new Error('STDIO authorization failed: missing authorization');
61
+ // Fallback for local dev / single tenant mode
62
+ if (self.config.shabaasAuthUuid) {
63
+ authToken = self.config.shabaasAuthUuid;
64
+ }
65
+ else {
66
+ throw new Error('STDIO authorization failed: missing authorization in args and SHABAAS_AUTH_UUID not set');
67
+ }
62
68
  }
69
+ // Optional: Check stdio specific key if configured
63
70
  if (self.config.mcpStdioApiKey && authToken !== self.config.mcpStdioApiKey) {
64
- throw new Error('STDIO authorization failed: invalid authorization');
71
+ // If specific key is set, it MUST match
72
+ throw new Error('STDIO authorization failed: invalid authorization key');
65
73
  }
66
74
  // Tool allowlist via policy
67
- const policyResult = (0, policy_js_1.lookupClientPolicy)(authToken, self.config.environment);
75
+ let policyResult = (0, policy_js_1.lookupClientPolicy)(authToken, self.config.environment);
76
+ // POLICY BYPASS: If no policy found, but token matches the owner UUID, allow it acting as Admin
77
+ if (!policyResult.policy && self.config.shabaasAuthUuid && authToken === self.config.shabaasAuthUuid) {
78
+ policyResult = {
79
+ policy: {
80
+ client_id: 'owner-admin',
81
+ status: 'active',
82
+ allowed_tools: ['*'],
83
+ environment: self.config.environment,
84
+ admin: true
85
+ }
86
+ };
87
+ }
68
88
  if (!policyResult.policy) {
69
- throw new Error('STDIO authorization failed: access denied');
89
+ throw new Error(`STDIO authorization failed: access denied (${policyResult.rejection})`);
70
90
  }
71
91
  if (!(0, policy_js_1.isToolAllowed)(policyResult.policy, name)) {
72
92
  throw new Error('STDIO authorization failed: tool not permitted');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shabaaspay-mcp-server",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "ShaBaas Pay MCP Server - Australian real time payment API for AI applications",
5
5
  "keywords": [
6
6
  "mcp-server",
@@ -48,7 +48,7 @@
48
48
  "inspect": "dotenv -e .env -- npx @modelcontextprotocol/inspector node dist/index.js"
49
49
  },
50
50
  "dependencies": {
51
- "@modelcontextprotocol/sdk": "^1.0.0",
51
+ "@modelcontextprotocol/sdk": "^1.25.3",
52
52
  "axios": "^1.6.0",
53
53
  "dotenv": "^16.3.0",
54
54
  "zod": "^3.22.0",
@@ -59,6 +59,6 @@
59
59
  "dotenv-cli": "^11.0.0",
60
60
  "tsx": "^4.7.0",
61
61
  "typescript": "^5.3.0",
62
- "wrangler": "^4.54.0"
62
+ "wrangler": "^4.59.3"
63
63
  }
64
64
  }
package/readme.md CHANGED
@@ -1,113 +1,81 @@
1
- # ShaBaas Pay MCP Server
2
-
3
- Australian real time payment processing for AI applications.
4
-
5
- Connect AI assistants to ShaBaas Pay to create and retrieve PayTo payment agreements with optional enrichment.
6
-
7
- ## Quick start
8
-
9
- ### Install
10
- npm install -g shabaaspay-mcp-server
11
-
12
- ### Run locally
13
- shabaaspay-mcp
14
-
15
- ### Run HTTP (for VS Code / HTTP MCP clients)
16
- shabaaspay-mcp-http
17
-
18
- The HTTP server exposes:
19
- - `GET /health` for health checks
20
- - `POST /tools/execute` for simple REST execution
21
- - `POST/GET /mcp` for MCP Streamable HTTP (use this endpoint in VS Code / HTTP clients)
22
-
23
- Environment (defaults shown):
24
- - `HTTP_PORT=3000`
25
- - `HTTP_HOST=0.0.0.0`
26
- - `MCP_HTTP_API_KEY=` (if empty, HTTP guard is disabled; set a value to lock down access)
27
- - `API_RATE_LIMIT_PER_MINUTE=60`, `API_RATE_LIMIT_PER_HOUR=1000`
28
- - `Authorization` header for tool calls: **plain ShaBaas-issued client UUID** (no Bearer prefix). Hosted Worker validates UUID against policy/secrets and fetches/caches the bearer internally.
29
-
30
- ## Claude Desktop configuration
31
-
32
- Edit this file:
33
- %APPDATA%\Claude\claude_desktop_config.json
34
-
35
- Example:
36
-
1
+ # ShaBaas Pay MCP Server
2
+
3
+ Australian real time payment processing for AI applications.
4
+
5
+ Connect AI assistants to ShaBaas Pay to create and retrieve PayTo payment agreements with optional enrichment.
6
+
7
+ ## Configuration
8
+
9
+ ### Environment Variables
10
+ | Variable | Description | Required | Default |
11
+ |----------|-------------|----------|---------|
12
+ | `SHABAAS_AUTH_UUID` | Your ShaBaas Pay Client Secret UUID | Yes | - |
13
+ | `SHABAAS_ENVIRONMENT` | `sandbox` or `production` | No | `sandbox` |
14
+ | `HTTP_PORT` | Port for HTTP server | No | `3000` |
15
+
16
+ ### Claude Desktop
17
+ Add this to `%APPDATA%\Claude\claude_desktop_config.json`:
18
+
19
+ ```json
37
20
  {
38
21
  "mcpServers": {
39
22
  "shabaaspay": {
40
- "command": "shabaaspay-mcp",
23
+ "command": "npx",
24
+ "args": [
25
+ "-y",
26
+ "shabaaspay-mcp-server"
27
+ ],
41
28
  "env": {
42
29
  "SHABAAS_ENVIRONMENT": "sandbox",
43
- "SHABAAS_SANDBOX_URL": "<sandbox_api_base_url>",
44
- "SHABAAS_AUTH_UUID": "your_uuid_here"
30
+ "SHABAAS_AUTH_UUID": "your-uuid-here"
45
31
  }
46
32
  }
47
33
  }
48
34
  }
35
+ ```
49
36
 
50
- ## VS Code / MCP HTTP configuration
37
+ ## Running Locally
51
38
 
52
- Hosted (staging/prod): point to `https://mcp-staging.shabaas.com/mcp` or `https://mcp.shabaas.com/mcp` and send `Authorization: <client_uuid_issued_by_shabaas>` (plain, no Bearer).
53
- Local dev: `http://localhost:3000/mcp` with `Authorization: <uuid>` (from your local env).
39
+ ### Classic Stdio (Node)
40
+ ```bash
41
+ # Install dependencies
42
+ npm install
54
43
 
55
- ## LLM integration quickstart
56
- - **Auth header**: use your ShaBaas-issued client UUID as `Authorization: <uuid>` (plain, no Bearer). Hosted Worker validates it; server manages the bearer internally.
57
- - **Endpoints**: STDIO (`shabaaspay-mcp`) or HTTP MCP (`http://localhost:3000/mcp`), staging (`https://mcp-staging.shabaas.com/mcp`), production (`https://mcp.shabaas.com/mcp`).
58
- - **Common calls (curl)**:
59
- - Get agreement:
60
- ```bash
61
- curl -X POST http://localhost:3000/mcp \
62
- -H "Authorization: <uuid>" \
63
- -H "Content-Type: application/json" \
64
- -d '{"tool":"get_payment_agreement","arguments":{"payment_agreement_id":"2882PA20251227045450257","enrich":true}}'
65
- ```
66
- - Create agreement:
44
+ # Build
45
+ npm run build
46
+
47
+ # Run
48
+ export SHABAAS_AUTH_UUID=your-uuid
49
+ node dist/index.js
50
+ ```
51
+
52
+ ### Docker
53
+ ```bash
54
+ # Build
55
+ docker build -t shabaaspay-mcp .
56
+
57
+ # Run (Stdio)
58
+ docker run -i --rm -e SHABAAS_AUTH_UUID=your-uuid shabaaspay-mcp
59
+
60
+ # Run (HTTP)
61
+ docker run --init -p 3000:3000 \
62
+ -e SHABAAS_AUTH_UUID=your-uuid \
63
+ shabaaspay-mcp node dist/server-http.js
64
+ ```
65
+
66
+ ## Publishing Recommendations
67
+
68
+ To make this MCP easily accessible to LLMs, we recommend:
69
+
70
+ 1. **NPM**: Publish the package (already done as `shabaaspay-mcp-server`). Ensure `v1.0.2` includes the latest fixes.
71
+ 2. **Docker Hub**: Publish the image as `shabaaspay/mcp-server`.
67
72
  ```bash
68
- curl -X POST http://localhost:3000/mcp \
69
- -H "Authorization: <uuid>" \
70
- -H "Content-Type: application/json" \
71
- -d '{"tool":"create_payment_agreement","arguments":{"name":"Test","type":"email","maximum_amount":"10.00","frequency":"WEEK","number_of_transactions_permitted":1,"pay_id":"sample@shabaas.com"}}'
73
+ docker tag shabaaspay-mcp shabaaspay/mcp-server:latest
74
+ docker push shabaaspay/mcp-server:latest
72
75
  ```
73
- - **Inspector/VS Code**: set MCP URL to `/mcp` and header `Authorization: <uuid>`; list tools then call by name. Enrichment toggles (`enrich`, `include_raw`) are available on payment tools.
74
-
75
- ## Tool manifest (LLM-friendly)
76
- - Catalog JSON: `docs/tool-catalog.json` (publishable at a stable URL for ingestion).
77
- - Tools:
78
- - `get_auth_token` – fetch bearer (debug; server auto-manages tokens)
79
- - `create_payment_agreement` – create PayTo agreement
80
- - `get_payment_agreement` – retrieve agreement with enrichment toggle
81
- - `initiate_payment` – initiate payment against agreement
82
- - `get_payment_initiation` – retrieve payment initiation
83
- - Auth: `Authorization: <uuid>` (plain). Server fetches/caches ShaBaas bearer.
84
-
85
- ## Auth & rate limits
86
- - Provide your ShaBaas UUID in the `Authorization` header (plain value, no `Bearer`). The MCP server fetches and caches the ShaBaas bearer internally.
87
- - HTTP guard is optional via `MCP_HTTP_API_KEY`; leave empty to avoid 403s in local testing.
88
- - Rate limits: defaults 60/min and 1000/hour; configure with `API_RATE_LIMIT_PER_MINUTE` / `API_RATE_LIMIT_PER_HOUR`.
89
- - CORS: configure `ALLOWED_ORIGINS` (comma separated) for HTTP clients (e.g., Inspector UI).
90
-
91
- ## Enrichment toggle
92
- Tools support `enrich` (default true) and `include_raw` (default false) to control business context and raw payloads. Set `enrich: false` for lean responses.
93
-
94
- ## Available tools
95
-
96
- Payment agreements
97
- 1. create_payment_agreement
98
- 2. get_payment_agreement
99
-
100
- Authentication helper
101
- 1. get_auth_token
102
-
103
- ## Examples
104
-
105
- See examples/basic.md
106
-
107
- ## Documentation
108
- 1. docs/installation.md
109
- 2. docs/authentication.md
110
- 3. docs/api-reference.md
111
-
112
- ## License
113
- MIT, see LICENSE
76
+ 3. **Smithery / Glama**: Register your MCP server on these registries for wider discovery.
77
+ - Add `shabaaspay-mcp-server` to [smithery.ai](https://smithery.ai/docs/publishing)
78
+ - Add to [glama.ai](https://glama.ai)
79
+
80
+ ## License
81
+ MIT, see LICENSE