paybot-mcp 0.3.3 → 0.3.4
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 +22 -1
- package/dist/config-warnings.d.ts +34 -0
- package/dist/config-warnings.d.ts.map +1 -0
- package/dist/config-warnings.js +45 -0
- package/dist/config-warnings.js.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,25 @@ MCP server for [PayBot](https://paybotcore.com) — payment tools for AI agents
|
|
|
8
8
|
npm install paybot-mcp paybot-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Get your API key
|
|
12
|
+
|
|
13
|
+
`PAYBOT_API_KEY` is required — without it every tool call fails with a 401. The fastest way to get a key is one `PayBotClient.signup()` call (from `paybot-sdk`) against the hosted facilitator at `https://api.paybotcore.com`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
node -e "import('paybot-sdk').then(async ({ PayBotClient }) => {
|
|
17
|
+
const a = await PayBotClient.signup('you@example.com', 'a-strong-password', { botId: 'my-agent' });
|
|
18
|
+
console.log(a.apiKey); // pb_live_... — printed ONLY once, save it now
|
|
19
|
+
})"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This single call registers your operator account, creates the API key, **and registers the bot** (`botId`). Put the printed key into `PAYBOT_API_KEY` in the MCP config below, and reuse the same bot id as `PAYBOT_BOT_ID`.
|
|
23
|
+
|
|
24
|
+
Notes:
|
|
25
|
+
|
|
26
|
+
- The key is printed **only once** — store it securely; it cannot be retrieved later.
|
|
27
|
+
- Because `signup()` already registered your bot, calling the `paybot_register` tool with the same bot id returns `409 ALREADY_EXISTS`. Use `paybot_register` only for **additional** bots.
|
|
28
|
+
- Full auth flow (login, extra API keys, self-hosted facilitators): see the [paybot-sdk README → Get your API key](https://github.com/RBKunnela/paybot-sdk#get-your-api-key).
|
|
29
|
+
|
|
11
30
|
## Usage with Claude Desktop
|
|
12
31
|
|
|
13
32
|
Add to `claude_desktop_config.json`:
|
|
@@ -49,11 +68,13 @@ Add to `claude_desktop_config.json`:
|
|
|
49
68
|
|
|
50
69
|
| Variable | Description | Default |
|
|
51
70
|
|----------|-------------|---------|
|
|
52
|
-
| `PAYBOT_API_KEY` | PayBot API key | (required) |
|
|
71
|
+
| `PAYBOT_API_KEY` | PayBot API key (see [Get your API key](#get-your-api-key)) | (required) |
|
|
53
72
|
| `PAYBOT_FACILITATOR_URL` | Facilitator server URL | `https://api.paybotcore.com` |
|
|
54
73
|
| `PAYBOT_BOT_ID` | Default bot identifier | `mcp-agent` |
|
|
55
74
|
| `PAYBOT_WALLET_KEY` | Wallet private key for real payments | (optional) |
|
|
56
75
|
|
|
76
|
+
If `PAYBOT_API_KEY` is unset or empty, the server still boots (so the MCP handshake succeeds) but prints a warning to stderr at startup, and every tool call will fail with an authentication error until a key is configured. Omitting `PAYBOT_WALLET_KEY` keeps the underlying SDK in mock mode (no on-chain settlement).
|
|
77
|
+
|
|
57
78
|
## Available Tools
|
|
58
79
|
|
|
59
80
|
| Tool | Description |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config-warnings
|
|
3
|
+
*
|
|
4
|
+
* Startup configuration warnings for the PayBot MCP server.
|
|
5
|
+
*
|
|
6
|
+
* The server intentionally boots with zero environment variables (MCP stdio
|
|
7
|
+
* servers must complete the protocol handshake even when misconfigured), which
|
|
8
|
+
* means a missing API key only surfaces as a 401 at the FIRST tool call. This
|
|
9
|
+
* module makes that failure visible at boot instead, by emitting a one-line
|
|
10
|
+
* warning to stderr — stdout is reserved for the MCP protocol stream.
|
|
11
|
+
*
|
|
12
|
+
* Dependencies: none (pure function over an env snapshot)
|
|
13
|
+
* Used by: src/index.ts (stdio entry point, before transport connect)
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Warn once at boot when no usable PayBot API key is configured.
|
|
17
|
+
*
|
|
18
|
+
* Mirrors the env resolution used by `getClient()` in server.ts — the
|
|
19
|
+
* effective key is `PAYBOT_API_KEY ?? API_KEY` — so the warning fires exactly
|
|
20
|
+
* when a later tool call would fail with an authentication error. It never
|
|
21
|
+
* throws and never exits: booting must always succeed so the MCP client can
|
|
22
|
+
* connect and read tool descriptions.
|
|
23
|
+
*
|
|
24
|
+
* @param env - Environment snapshot to inspect (defaults to `process.env`).
|
|
25
|
+
* @param warn - Sink for the warning line (defaults to `console.error`, i.e.
|
|
26
|
+
* stderr — never stdout, which carries MCP protocol frames).
|
|
27
|
+
* @returns `true` when a warning was emitted, `false` when a key is present.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* warnIfApiKeyMissing();
|
|
31
|
+
* // stderr: [paybot-mcp] PAYBOT_API_KEY is not set — tool calls will fail with 401. ...
|
|
32
|
+
*/
|
|
33
|
+
export declare function warnIfApiKeyMissing(env?: NodeJS.ProcessEnv, warn?: (message: string) => void): boolean;
|
|
34
|
+
//# sourceMappingURL=config-warnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-warnings.d.ts","sourceRoot":"","sources":["../src/config-warnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAoB,GAC9C,OAAO,CAaT"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config-warnings
|
|
3
|
+
*
|
|
4
|
+
* Startup configuration warnings for the PayBot MCP server.
|
|
5
|
+
*
|
|
6
|
+
* The server intentionally boots with zero environment variables (MCP stdio
|
|
7
|
+
* servers must complete the protocol handshake even when misconfigured), which
|
|
8
|
+
* means a missing API key only surfaces as a 401 at the FIRST tool call. This
|
|
9
|
+
* module makes that failure visible at boot instead, by emitting a one-line
|
|
10
|
+
* warning to stderr — stdout is reserved for the MCP protocol stream.
|
|
11
|
+
*
|
|
12
|
+
* Dependencies: none (pure function over an env snapshot)
|
|
13
|
+
* Used by: src/index.ts (stdio entry point, before transport connect)
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Warn once at boot when no usable PayBot API key is configured.
|
|
17
|
+
*
|
|
18
|
+
* Mirrors the env resolution used by `getClient()` in server.ts — the
|
|
19
|
+
* effective key is `PAYBOT_API_KEY ?? API_KEY` — so the warning fires exactly
|
|
20
|
+
* when a later tool call would fail with an authentication error. It never
|
|
21
|
+
* throws and never exits: booting must always succeed so the MCP client can
|
|
22
|
+
* connect and read tool descriptions.
|
|
23
|
+
*
|
|
24
|
+
* @param env - Environment snapshot to inspect (defaults to `process.env`).
|
|
25
|
+
* @param warn - Sink for the warning line (defaults to `console.error`, i.e.
|
|
26
|
+
* stderr — never stdout, which carries MCP protocol frames).
|
|
27
|
+
* @returns `true` when a warning was emitted, `false` when a key is present.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* warnIfApiKeyMissing();
|
|
31
|
+
* // stderr: [paybot-mcp] PAYBOT_API_KEY is not set — tool calls will fail with 401. ...
|
|
32
|
+
*/
|
|
33
|
+
export function warnIfApiKeyMissing(env = process.env, warn = console.error) {
|
|
34
|
+
// Same precedence as server.ts getClient(): an empty PAYBOT_API_KEY does
|
|
35
|
+
// NOT fall through to API_KEY (`??` only skips undefined/null), so an
|
|
36
|
+
// empty string here is a real misconfiguration worth warning about.
|
|
37
|
+
const apiKey = env.PAYBOT_API_KEY ?? env.API_KEY;
|
|
38
|
+
if (apiKey === undefined || apiKey.trim() === '') {
|
|
39
|
+
warn('[paybot-mcp] PAYBOT_API_KEY is not set — tool calls will fail with 401. ' +
|
|
40
|
+
'See README → Get your API key.');
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=config-warnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-warnings.js","sourceRoot":"","sources":["../src/config-warnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAyB,OAAO,CAAC,GAAG,EACpC,OAAkC,OAAO,CAAC,KAAK;IAE/C,yEAAyE;IACzE,sEAAsE;IACtE,oEAAoE;IACpE,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,OAAO,CAAC;IACjD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,IAAI,CACF,0EAA0E;YACxE,gCAAgC,CACnC,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
24
24
|
import { createMcpServer } from './server.js';
|
|
25
|
+
import { warnIfApiKeyMissing } from './config-warnings.js';
|
|
26
|
+
// Surface a missing API key at boot (stderr) instead of at the first tool
|
|
27
|
+
// call. Warn-only by design: the server must still boot so the MCP handshake
|
|
28
|
+
// succeeds and the client can read tool descriptions.
|
|
29
|
+
warnIfApiKeyMissing();
|
|
25
30
|
const server = createMcpServer();
|
|
26
31
|
const transport = new StdioServerTransport();
|
|
27
32
|
await server.connect(transport);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,0EAA0E;AAC1E,6EAA6E;AAC7E,sDAAsD;AACtD,mBAAmB,EAAE,CAAC;AAEtB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;AACjC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|