@rcs-campaigns/agent-toolkit 0.1.5 → 0.1.8
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 +5 -0
- package/dist/client.d.ts +18 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -11
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +8 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -79,6 +79,11 @@ A healthy response lists `grantedScopes` and the tool catalog. If you get
|
|
|
79
79
|
|
|
80
80
|
## Add to an MCP host
|
|
81
81
|
|
|
82
|
+
Listed in the official **MCP Registry** as `com.rcs-campaigns/campaigns`, so
|
|
83
|
+
hosts that browse the registry can install it without being told the package
|
|
84
|
+
name.
|
|
85
|
+
|
|
86
|
+
|
|
82
87
|
### Claude Code
|
|
83
88
|
|
|
84
89
|
```bash
|
package/dist/client.d.ts
CHANGED
|
@@ -42,12 +42,25 @@ export interface GatewayConfig {
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function detectSkin(argv?: readonly string[]): 'wa' | 'rcs';
|
|
44
44
|
/**
|
|
45
|
-
* The package
|
|
46
|
-
* constant. A hardcoded copy silently goes stale the first
|
|
47
|
-
* for a release, and both skins show this string to a user
|
|
48
|
-
*
|
|
45
|
+
* The version of the package the user actually installed, read at runtime rather
|
|
46
|
+
* than restated in a constant. A hardcoded copy silently goes stale the first
|
|
47
|
+
* time anyone bumps for a release, and both skins show this string to a user —
|
|
48
|
+
* as `serverInfo.version` over MCP and in the CLI's usage banner.
|
|
49
|
+
*
|
|
50
|
+
* It resolves from the INVOKED BIN, not from `__dirname`, because the two skins
|
|
51
|
+
* are two npm packages: `wa-mcp` lives in @wa-campaigns/agent-toolkit, which
|
|
52
|
+
* delegates to this file inside @rcs-campaigns/agent-toolkit. `__dirname` alone
|
|
53
|
+
* therefore always reports the CORE's number, so a user who installed
|
|
54
|
+
* @wa-campaigns/agent-toolkit\@0.1.7 was told 0.1.6 — true of the code, but not
|
|
55
|
+
* of the thing they installed, and not a version they could go and fetch.
|
|
56
|
+
*
|
|
57
|
+
* Only the bin names we ship are trusted to locate a package (a test runner or a
|
|
58
|
+
* bundler entry would otherwise point at ITS package.json); everything else, and
|
|
59
|
+
* every library import, falls back to this package — the previous behaviour. For
|
|
60
|
+
* both layouts the package root is one level up from the bin: `bin/wa-mcp.js`
|
|
61
|
+
* and `dist/mcp.js` alike.
|
|
49
62
|
*/
|
|
50
|
-
export declare function readVersion(): string;
|
|
63
|
+
export declare function readVersion(argv?: readonly string[]): string;
|
|
51
64
|
/** Human-readable product + channel names for the running skin. */
|
|
52
65
|
export declare function skinLabels(skin?: 'wa' | 'rcs'): {
|
|
53
66
|
product: string;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,UAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,GAAG,IAAI,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,UAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,MAAM,E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AAG,aAAa;IAI/D,+EAA+E;IACzE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAmCvD"}
|
package/dist/client.js
CHANGED
|
@@ -18,28 +18,68 @@ const node_path_1 = require("node:path");
|
|
|
18
18
|
* argv, a bundler-rewritten path, or a direct import all fall through to 'rcs'.
|
|
19
19
|
*/
|
|
20
20
|
function detectSkin(argv = process.argv) {
|
|
21
|
+
const name = invokedBinName(argv);
|
|
22
|
+
return name === 'wa' || name === 'wa-mcp' ? 'wa' : 'rcs';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The bin basename this process was launched as — "wa-mcp", "mcp", "cli" — or
|
|
26
|
+
* '' when argv carries no usable path (a library import, a bundler-rewritten
|
|
27
|
+
* entry, a test runner). Shared by {@link detectSkin} and {@link readVersion} so
|
|
28
|
+
* the two can never disagree about which skin is running.
|
|
29
|
+
*/
|
|
30
|
+
function invokedBinName(argv) {
|
|
21
31
|
const invoked = argv[1];
|
|
22
32
|
if (typeof invoked !== 'string')
|
|
23
|
-
return '
|
|
33
|
+
return '';
|
|
24
34
|
// basename without extension, so ".../bin/wa-mcp.js" → "wa-mcp".
|
|
25
35
|
const base = invoked.split(/[\\/]/).pop() ?? '';
|
|
26
|
-
|
|
27
|
-
return name === 'wa' || name === 'wa-mcp' ? 'wa' : 'rcs';
|
|
36
|
+
return base.replace(/\.(js|cjs|mjs|ts)$/, '');
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
39
|
+
* Every bin basename the two skins ship, as it appears in argv[1]. The WhatsApp
|
|
40
|
+
* skin's bins are named files (`bin/wa-mcp.js`); the RCS skin's are this
|
|
41
|
+
* package's own build outputs, which npm resolves to `dist/mcp.js` / `dist/cli.js`
|
|
42
|
+
* — hence "mcp" and "cli" rather than "rcs-mcp" and "rcs". Anything not in this
|
|
43
|
+
* set is not one of ours, and is never trusted to locate a package.
|
|
34
44
|
*/
|
|
35
|
-
|
|
45
|
+
const OWN_BINS = new Set(['wa', 'wa-mcp', 'rcs', 'rcs-mcp', 'mcp', 'cli']);
|
|
46
|
+
/** The `version` of the package.json in `dir`, or undefined if unreadable. */
|
|
47
|
+
function packageVersionAt(dir) {
|
|
36
48
|
try {
|
|
37
|
-
const pkg = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(
|
|
38
|
-
return typeof pkg.version === 'string' ? pkg.version :
|
|
49
|
+
const pkg = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, 'package.json'), 'utf8'));
|
|
50
|
+
return typeof pkg.version === 'string' ? pkg.version : undefined;
|
|
39
51
|
}
|
|
40
52
|
catch {
|
|
41
|
-
return
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The version of the package the user actually installed, read at runtime rather
|
|
58
|
+
* than restated in a constant. A hardcoded copy silently goes stale the first
|
|
59
|
+
* time anyone bumps for a release, and both skins show this string to a user —
|
|
60
|
+
* as `serverInfo.version` over MCP and in the CLI's usage banner.
|
|
61
|
+
*
|
|
62
|
+
* It resolves from the INVOKED BIN, not from `__dirname`, because the two skins
|
|
63
|
+
* are two npm packages: `wa-mcp` lives in @wa-campaigns/agent-toolkit, which
|
|
64
|
+
* delegates to this file inside @rcs-campaigns/agent-toolkit. `__dirname` alone
|
|
65
|
+
* therefore always reports the CORE's number, so a user who installed
|
|
66
|
+
* @wa-campaigns/agent-toolkit\@0.1.7 was told 0.1.6 — true of the code, but not
|
|
67
|
+
* of the thing they installed, and not a version they could go and fetch.
|
|
68
|
+
*
|
|
69
|
+
* Only the bin names we ship are trusted to locate a package (a test runner or a
|
|
70
|
+
* bundler entry would otherwise point at ITS package.json); everything else, and
|
|
71
|
+
* every library import, falls back to this package — the previous behaviour. For
|
|
72
|
+
* both layouts the package root is one level up from the bin: `bin/wa-mcp.js`
|
|
73
|
+
* and `dist/mcp.js` alike.
|
|
74
|
+
*/
|
|
75
|
+
function readVersion(argv = process.argv) {
|
|
76
|
+
const invoked = argv[1];
|
|
77
|
+
if (typeof invoked === 'string' && OWN_BINS.has(invokedBinName(argv))) {
|
|
78
|
+
const own = packageVersionAt((0, node_path_1.join)((0, node_path_1.dirname)(invoked), '..'));
|
|
79
|
+
if (own)
|
|
80
|
+
return own;
|
|
42
81
|
}
|
|
82
|
+
return packageVersionAt((0, node_path_1.join)(__dirname, '..')) ?? '0.0.0';
|
|
43
83
|
}
|
|
44
84
|
/** Human-readable product + channel names for the running skin. */
|
|
45
85
|
function skinLabels(skin = detectSkin()) {
|
package/dist/openapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,yEAAyE;AACzE,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAMhC,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,yEAAyE;AACzE,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAMhC,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD;AA2fD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EAAE,EACxB,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAmFN"}
|
package/dist/openapi.js
CHANGED
|
@@ -69,8 +69,11 @@ function tagFor(tool) {
|
|
|
69
69
|
return 'Templates';
|
|
70
70
|
case 'surveys':
|
|
71
71
|
return 'Surveys';
|
|
72
|
+
// The ROUTE stays `/messages/send` and the scope stays `messages:send` —
|
|
73
|
+
// both are published contracts. Only the docs tag follows the product,
|
|
74
|
+
// which calls this surface Campaigns (MSG-1867).
|
|
72
75
|
case 'messages':
|
|
73
|
-
return '
|
|
76
|
+
return 'Campaigns';
|
|
74
77
|
case 'media':
|
|
75
78
|
return 'Media';
|
|
76
79
|
case 'audiences':
|
|
@@ -546,7 +549,7 @@ function buildOpenApiDocument(servers, options = {}) {
|
|
|
546
549
|
{ name: 'Discovery', description: 'What this key may do, and this document.' },
|
|
547
550
|
{ name: 'Templates', description: 'Author, render, submit and clone templates.' },
|
|
548
551
|
{ name: 'Surveys', description: 'Author, submit, send and read conversational surveys.' },
|
|
549
|
-
{ name: '
|
|
552
|
+
{ name: 'Campaigns', description: 'Send an approved template to a list of numbers.' },
|
|
550
553
|
{ name: 'Conversations', description: 'Read threads, reply into them, hand them over.' },
|
|
551
554
|
{ name: 'Contacts', description: 'The org-level person record behind every audience.' },
|
|
552
555
|
{ name: 'Audiences', description: 'Saved contact lists.' },
|
|
@@ -568,9 +571,9 @@ function buildOpenApiDocument(servers, options = {}) {
|
|
|
568
571
|
description: 'The remote MCP server is an OAuth 2.1 authorization server with PKCE and Dynamic Client Registration. Access tokens look like `rcso_at_…` and resolve to the same org + scopes as a key.',
|
|
569
572
|
flows: {
|
|
570
573
|
authorizationCode: {
|
|
571
|
-
authorizationUrl: 'https://mcp.rcs-
|
|
572
|
-
tokenUrl: 'https://mcp.rcs-
|
|
573
|
-
refreshUrl: 'https://mcp.rcs-
|
|
574
|
+
authorizationUrl: 'https://mcp.rcs-campaigns.com/oauth/authorize',
|
|
575
|
+
tokenUrl: 'https://mcp.rcs-campaigns.com/oauth/token',
|
|
576
|
+
refreshUrl: 'https://mcp.rcs-campaigns.com/oauth/token',
|
|
574
577
|
scopes: Object.fromEntries([...new Set(tools_1.TOOLS.map((t) => t.scope))]
|
|
575
578
|
.filter((scope) => scope !== '(none)')
|
|
576
579
|
.sort()
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcs-campaigns/agent-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"mcpName": "com.rcs-campaigns/campaigns",
|
|
4
5
|
"description": "Agent skins for the RCS Campaigns gateway: an MCP server (rcs-mcp / wa-mcp) and a CLI (rcs / wa) over one shared client.",
|
|
5
6
|
"license": "UNLICENSED",
|
|
6
7
|
"author": "Rethink AI",
|