@cargo-ai/cli 1.0.65 → 1.0.67
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/build/commands/mcp.d.ts +3 -1
- package/build/commands/mcp.d.ts.map +1 -1
- package/build/commands/mcp.js +16 -28
- package/build/commands/orchestration/action.d.ts.map +1 -1
- package/build/commands/orchestration/action.js +60 -12
- package/build/commands/revenueOrganization/member.d.ts.map +1 -1
- package/build/commands/revenueOrganization/member.js +7 -0
- package/package.json +4 -4
package/build/commands/mcp.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { Api } from "../api.js";
|
|
3
|
-
export declare function registerMcpCommand(parent: Command,
|
|
3
|
+
export declare function registerMcpCommand(parent: Command, _getApi: () => Api): void;
|
|
4
|
+
export declare const resolveServerUuid: (explicit: string | undefined) => string | undefined;
|
|
5
|
+
export declare const resolveMcpEndpoint: (baseUrl: string, uuid: string | undefined) => string;
|
|
4
6
|
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAerC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAerC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,IAAI,CAuD5E;AAED,eAAO,MAAM,iBAAiB,aAClB,MAAM,GAAG,SAAS,KAC3B,MAAM,GAAG,SAOX,CAAC;AAEF,eAAO,MAAM,kBAAkB,YACpB,MAAM,QACT,MAAM,GAAG,SAAS,KACvB,MAaF,CAAC"}
|
package/build/commands/mcp.js
CHANGED
|
@@ -4,7 +4,7 @@ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/
|
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
5
|
import { getConfig } from "../config.js";
|
|
6
6
|
import { getProxyFetch } from "../proxy.js";
|
|
7
|
-
import { ExitCodes, failWith,
|
|
7
|
+
import { ExitCodes, failWith, info } from "./runHandler.js";
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
9
9
|
const { version } = require("../../package.json");
|
|
10
10
|
// The prod REST API and the prod MCP server are the same backend image behind
|
|
@@ -13,18 +13,21 @@ const { version } = require("../../package.json");
|
|
|
13
13
|
// base URL (staging, localhost) untouched — that same host serves the MCP routes.
|
|
14
14
|
const PROD_API_HOST = "api.getcargo.io";
|
|
15
15
|
const PROD_MCP_HOST = "mcp.getcargo.io";
|
|
16
|
-
export function registerMcpCommand(parent,
|
|
16
|
+
export function registerMcpCommand(parent, _getApi) {
|
|
17
17
|
parent
|
|
18
18
|
.command("mcp")
|
|
19
19
|
.description("Run a local MCP server that bridges to a Cargo MCP server over stdio")
|
|
20
|
-
.option("--server <uuid>", "MCP server UUID
|
|
20
|
+
.option("--server <uuid>", "Curated MCP server UUID (default: CARGO_MCP_SERVER_UUID, or the platform Cargo MCP)")
|
|
21
21
|
.addHelpText("after", `
|
|
22
22
|
Exposes a Cargo-hosted MCP server as a local stdio MCP server, so any stdio MCP
|
|
23
23
|
client (Claude Code, Claude Desktop, Cursor, ...) can use it with the CLI's own
|
|
24
24
|
credentials — no token to copy into client config.
|
|
25
25
|
|
|
26
|
+
With no --server, bridges to the platform Cargo MCP (find/execute actions).
|
|
27
|
+
Pass --server <uuid> to bridge a curated server instead.
|
|
28
|
+
|
|
26
29
|
Register it with a client, e.g. Claude Code:
|
|
27
|
-
$ claude mcp add cargo -- cargo-ai mcp
|
|
30
|
+
$ claude mcp add cargo -- cargo-ai mcp
|
|
28
31
|
|
|
29
32
|
Environment:
|
|
30
33
|
CARGO_MCP_SERVER_UUID default --server value
|
|
@@ -37,7 +40,7 @@ credentials file). stdout carries the MCP protocol; all logs go to stderr.`)
|
|
|
37
40
|
if (getAccessToken === undefined) {
|
|
38
41
|
failWith('Not authenticated. Run "cargo-ai login --email <email>" (no browser needed) or "cargo-ai login --oauth".', { code: ExitCodes.NotAuthenticated });
|
|
39
42
|
}
|
|
40
|
-
const serverUuid =
|
|
43
|
+
const serverUuid = resolveServerUuid(opts.server);
|
|
41
44
|
const endpoint = resolveMcpEndpoint(baseUrl, serverUuid);
|
|
42
45
|
const headers = {
|
|
43
46
|
"x-cargo-origin": "cli",
|
|
@@ -50,39 +53,24 @@ credentials file). stdout carries the MCP protocol; all logs go to stderr.`)
|
|
|
50
53
|
await runBridge(endpoint, headers, getAccessToken);
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
|
-
const resolveServerUuid =
|
|
56
|
+
export const resolveServerUuid = (explicit) => {
|
|
54
57
|
if (explicit !== undefined)
|
|
55
58
|
return explicit;
|
|
56
59
|
const fromEnv = process.env["CARGO_MCP_SERVER_UUID"];
|
|
57
60
|
if (fromEnv !== undefined && fromEnv.length > 0)
|
|
58
61
|
return fromEnv;
|
|
59
|
-
|
|
60
|
-
const { mcpServers } = await handleApiCall(() => api.ai.mcpServer.all(), {
|
|
61
|
-
spinner: false,
|
|
62
|
-
});
|
|
63
|
-
if (mcpServers.length === 0) {
|
|
64
|
-
failWith("No MCP server in this workspace. Create one with 'cargo-ai ai mcp-server create --name ...', then pass --server <uuid>.", { code: ExitCodes.InvalidUsage });
|
|
65
|
-
}
|
|
66
|
-
const only = mcpServers[0];
|
|
67
|
-
if (mcpServers.length > 1 || only === undefined) {
|
|
68
|
-
failWith("Multiple MCP servers found; pass --server <uuid>.", {
|
|
69
|
-
code: ExitCodes.InvalidUsage,
|
|
70
|
-
extra: {
|
|
71
|
-
servers: mcpServers.map((server) => ({
|
|
72
|
-
uuid: server.uuid,
|
|
73
|
-
name: server.name,
|
|
74
|
-
})),
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return only.uuid;
|
|
62
|
+
return undefined;
|
|
79
63
|
};
|
|
80
|
-
const resolveMcpEndpoint = (baseUrl, uuid) => {
|
|
64
|
+
export const resolveMcpEndpoint = (baseUrl, uuid) => {
|
|
81
65
|
const override = process.env["CARGO_MCP_BASE_URL"];
|
|
82
66
|
const origin = override !== undefined && override.length > 0
|
|
83
67
|
? override
|
|
84
68
|
: mapApiHostToMcp(baseUrl);
|
|
85
|
-
|
|
69
|
+
const normalized = origin.replace(/\/+$/, "");
|
|
70
|
+
if (uuid === undefined) {
|
|
71
|
+
return `${normalized}/mcp`;
|
|
72
|
+
}
|
|
73
|
+
return `${normalized}/v1/ai/mcpServers/${uuid}/mcp`;
|
|
86
74
|
};
|
|
87
75
|
const mapApiHostToMcp = (baseUrl) => {
|
|
88
76
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAcxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAcxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAuRN"}
|
|
@@ -3,21 +3,59 @@ import { applyRecordsLimit, ExitCodes, failWith, handleApiCall, outputJson, pars
|
|
|
3
3
|
export function registerActionCommands(parent, getApi) {
|
|
4
4
|
const action = parent
|
|
5
5
|
.command("action")
|
|
6
|
-
.description("
|
|
6
|
+
.description("List and execute actions (single run or batch)")
|
|
7
7
|
.addHelpText("after", `
|
|
8
8
|
The default way to run a tool or connector action: no workflow, release, or node
|
|
9
9
|
graph needed. Creates a run and consumes credits.
|
|
10
10
|
|
|
11
|
-
- '
|
|
11
|
+
- List first: 'cargo-ai orchestration action list enrich'
|
|
12
|
+
Each result includes an 'action' object for execute / execute-batch /
|
|
13
|
+
get-output-schema.
|
|
14
|
+
- Inputs go in --data, not in the action. 'config' is optional; omit it.
|
|
12
15
|
- The run is asynchronous: pass --wait-until-finished, or poll it with
|
|
13
16
|
'cargo-ai orchestration run get <uuid>'.
|
|
14
17
|
|
|
15
18
|
To debug a node inside an existing workflow instead, use
|
|
16
19
|
'cargo-ai orchestration node'.`);
|
|
20
|
+
const listableKinds = ["connector", "native", "tool", "agent"];
|
|
21
|
+
action
|
|
22
|
+
.command("list")
|
|
23
|
+
.description("List actions")
|
|
24
|
+
.argument("[query...]", "Keywords to match (space-separated, optional)")
|
|
25
|
+
.option("--kind <kind>", "Restrict to one kind: connector, native, tool, or agent (enum)")
|
|
26
|
+
.option("--integration-slug <slug>", "Restrict connector actions to this integration (string)")
|
|
27
|
+
.option("--limit <n>", "Maximum results to return (integer, default: 20, max: 50)", "20")
|
|
28
|
+
.addHelpText("after", `
|
|
29
|
+
Each result includes an 'action' object you can pass to execute, execute-batch,
|
|
30
|
+
or get-output-schema. All query terms must match (AND). Matches on the action
|
|
31
|
+
slug or name rank above integration matches, which rank above description.
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
$ cargo-ai orchestration action list enrich
|
|
35
|
+
$ cargo-ai orchestration action list --kind tool
|
|
36
|
+
$ cargo-ai orchestration action list send --kind connector --integration-slug slack`)
|
|
37
|
+
.action(async (queryTerms, opts) => {
|
|
38
|
+
let kind;
|
|
39
|
+
if (opts.kind !== undefined) {
|
|
40
|
+
kind = listableKinds.find((value) => value === opts.kind);
|
|
41
|
+
if (kind === undefined) {
|
|
42
|
+
failWith('--kind must be "connector", "native", "tool", or "agent".', { code: ExitCodes.InvalidUsage });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const limit = parsePositiveInt(opts.limit, "--limit");
|
|
46
|
+
const query = queryTerms.length === 0 ? undefined : queryTerms.join(" ");
|
|
47
|
+
const result = await handleApiCall(() => getApi().orchestration.action.list({
|
|
48
|
+
query,
|
|
49
|
+
kind,
|
|
50
|
+
integrationSlug: opts.integrationSlug,
|
|
51
|
+
limit,
|
|
52
|
+
}));
|
|
53
|
+
outputJson(result);
|
|
54
|
+
});
|
|
17
55
|
action
|
|
18
56
|
.command("execute")
|
|
19
57
|
.description("Execute a single action")
|
|
20
|
-
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."
|
|
58
|
+
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."}\'')
|
|
21
59
|
.requiredOption("--data <json>", "Input data for the run (JSON object, required)")
|
|
22
60
|
.option("--wait-until-finished [value]", "Poll the run until it reaches a terminal status before returning (true/false, defaults to true when passed bare)", parseBooleanOption)
|
|
23
61
|
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
@@ -25,8 +63,8 @@ To debug a node inside an existing workflow instead, use
|
|
|
25
63
|
.option("--webhook-secret <secret>", "Secret used to sign webhook deliveries")
|
|
26
64
|
.addHelpText("after", `
|
|
27
65
|
Examples:
|
|
28
|
-
$ cargo-ai orchestration action execute --action '{"kind":"tool","toolUuid":"550e8400-..."
|
|
29
|
-
$ cargo-ai orchestration action execute --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message"
|
|
66
|
+
$ cargo-ai orchestration action execute --action '{"kind":"tool","toolUuid":"550e8400-..."}' --data '{"email":"user@example.com"}'
|
|
67
|
+
$ cargo-ai orchestration action execute --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message"}' --data '{"channel":"#general","text":"hello"}' --wait-until-finished`)
|
|
30
68
|
.action(async (opts) => {
|
|
31
69
|
const actionPayload = parseJson(opts.action, "--action");
|
|
32
70
|
const data = parseJson(opts.data, "--data");
|
|
@@ -48,7 +86,7 @@ Examples:
|
|
|
48
86
|
action
|
|
49
87
|
.command("execute-batch")
|
|
50
88
|
.description("Execute an action as a batch over multiple records")
|
|
51
|
-
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."
|
|
89
|
+
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."}\'')
|
|
52
90
|
.requiredOption("--records <json>", 'Records to process (JSON array, required). Example: \'[{"email":"a@b.com"},{"email":"c@d.com"}]\'')
|
|
53
91
|
.option("--webhook-url <url>", "URL to call when the batch completes")
|
|
54
92
|
.option("--webhook-secret <secret>", "Secret used to sign webhook deliveries")
|
|
@@ -57,9 +95,9 @@ Examples:
|
|
|
57
95
|
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
58
96
|
.addHelpText("after", `
|
|
59
97
|
Examples:
|
|
60
|
-
$ cargo-ai orchestration action execute-batch --action '{"kind":"tool","toolUuid":"550e8400-..."
|
|
61
|
-
$ cargo-ai orchestration action execute-batch --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message"
|
|
62
|
-
$ cargo-ai orchestration action execute-batch --action '{"kind":"connector","integrationSlug":"waterfall","actionSlug":"findEmail"
|
|
98
|
+
$ cargo-ai orchestration action execute-batch --action '{"kind":"tool","toolUuid":"550e8400-..."}' --records '[{"email":"a@b.com"},{"email":"c@d.com"}]'
|
|
99
|
+
$ cargo-ai orchestration action execute-batch --action '{"kind":"connector","integrationSlug":"slack","actionSlug":"send-message"}' --records '[{"channel":"#general"}]' --wait-until-finished
|
|
100
|
+
$ cargo-ai orchestration action execute-batch --action '{"kind":"connector","integrationSlug":"waterfall","actionSlug":"findEmail"}' --records "$(cat records.json)" --limit 1 --wait-until-finished`)
|
|
63
101
|
.action(async (opts) => {
|
|
64
102
|
const actionPayload = parseJson(opts.action, "--action");
|
|
65
103
|
let records = parseJson(opts.records, "--records");
|
|
@@ -90,16 +128,26 @@ Examples:
|
|
|
90
128
|
action
|
|
91
129
|
.command("get-output-schema")
|
|
92
130
|
.description("Resolve the JSON schema of an action's data output without executing it")
|
|
93
|
-
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."
|
|
131
|
+
.requiredOption("--action <json>", 'Action definition (JSON object, required). Example: \'{"kind":"tool","toolUuid":"550e8400-..."}\'')
|
|
132
|
+
.option("--data <json>", 'Inputs the action would run with (JSON object, optional). Only needed when the output schema depends on them. Example: \'{"objectType":"contacts"}\'')
|
|
94
133
|
.addHelpText("after", `
|
|
134
|
+
Nothing is executed and no credits are consumed. Pass the 'action' object from
|
|
135
|
+
'cargo-ai orchestration action list' as-is.
|
|
136
|
+
|
|
137
|
+
Some actions shape their output from their inputs — a HubSpot object type, a
|
|
138
|
+
Google Sheet. Pass those in --data, exactly as you would to 'action execute'.
|
|
139
|
+
|
|
95
140
|
Examples:
|
|
96
|
-
$ cargo-ai orchestration action get-output-schema --action '{"kind":"tool","toolUuid":"550e8400-..."
|
|
97
|
-
$ cargo-ai orchestration action get-output-schema --action '{"kind":"connector","integrationSlug":"clearbit","actionSlug":"company_enrich"
|
|
141
|
+
$ cargo-ai orchestration action get-output-schema --action '{"kind":"tool","toolUuid":"550e8400-..."}'
|
|
142
|
+
$ cargo-ai orchestration action get-output-schema --action '{"kind":"connector","integrationSlug":"clearbit","actionSlug":"company_enrich"}'
|
|
143
|
+
$ cargo-ai orchestration action get-output-schema --action '{"kind":"connector","integrationSlug":"hubspot","actionSlug":"findRecords"}' --data '{"objectType":"contacts"}'`)
|
|
98
144
|
.action(async (opts) => {
|
|
99
145
|
const actionPayload = parseJson(opts.action, "--action");
|
|
146
|
+
const dataPayload = opts.data === undefined ? undefined : parseJson(opts.data, "--data");
|
|
100
147
|
const api = getApi();
|
|
101
148
|
const result = await handleApiCall(() => api.orchestration.action.getOutputSchema({
|
|
102
149
|
action: actionPayload,
|
|
150
|
+
data: dataPayload,
|
|
103
151
|
}));
|
|
104
152
|
outputJson(result);
|
|
105
153
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../src/commands/revenueOrganization/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../src/commands/revenueOrganization/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA2FN"}
|
|
@@ -49,6 +49,7 @@ export function registerMemberCommands(parent, getApi) {
|
|
|
49
49
|
.description("Update a member")
|
|
50
50
|
.requiredOption("--uuid <uuid>", "Member UUID")
|
|
51
51
|
.option("--meta <json>", 'Member metadata (JSON object, e.g. {"key":"value"})')
|
|
52
|
+
.option("--mailbox-uuids <uuids>", "Mailbox UUIDs to attach (comma-separated; empty to detach all)")
|
|
52
53
|
.action(async (opts) => {
|
|
53
54
|
const api = getApi();
|
|
54
55
|
const result = await handleApiCall(() => api.revenueOrganization.member.update({
|
|
@@ -56,6 +57,12 @@ export function registerMemberCommands(parent, getApi) {
|
|
|
56
57
|
meta: opts.meta !== undefined
|
|
57
58
|
? parseJson(opts.meta, "--meta")
|
|
58
59
|
: undefined,
|
|
60
|
+
mailboxUuids: opts.mailboxUuids === undefined
|
|
61
|
+
? undefined
|
|
62
|
+
: opts.mailboxUuids
|
|
63
|
+
.split(",")
|
|
64
|
+
.map((uuid) => uuid.trim())
|
|
65
|
+
.filter((uuid) => uuid.length > 0),
|
|
59
66
|
}));
|
|
60
67
|
outputJson(result);
|
|
61
68
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.67",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://getcargo.ai",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"format:check": "prettier --check ."
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@cargo-ai/api": "^1.0.
|
|
67
|
+
"@cargo-ai/api": "^1.0.69",
|
|
68
68
|
"@cargo-ai/app-sdk": "^1.0.9",
|
|
69
|
-
"@cargo-ai/cdk": "^1.0.
|
|
70
|
-
"@cargo-ai/types": "^1.0.
|
|
69
|
+
"@cargo-ai/cdk": "^1.0.53",
|
|
70
|
+
"@cargo-ai/types": "^1.0.66",
|
|
71
71
|
"@cargo-ai/worker-sdk": "^1.0.17",
|
|
72
72
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
73
73
|
"commander": "^12.1.0",
|