@mcpcloud/cli 0.0.0-next-20260525192206

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 (3) hide show
  1. package/README.md +259 -0
  2. package/dist/index.js +10935 -0
  3. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # @mcpcloud/cli
2
+
3
+ The official command-line interface for [MCPCloud](https://mcpcloud.sh) — manage projects, MCP servers, skills, and API keys from your terminal.
4
+
5
+ ```sh
6
+ npm install -g @mcpcloud/cli
7
+ export MCPCLOUD_BASE_URL=https://your-deployment.example.com # ask your admin
8
+ mcp login
9
+ mcp whoami
10
+ ```
11
+
12
+ > **Note**
13
+ > MCPCloud is in private beta. The CLI does **not** ship with a default API base URL — set `MCPCLOUD_BASE_URL` (or `mcp config set-url <url>`) using the URL provided by your MCPCloud admin. A built-in default will be added when the platform launches publicly.
14
+
15
+ The package installs three equivalent binaries: `mcp` (primary), `mcpsh`, and `mcpcloud`. They all point at the same executable — use whichever you prefer.
16
+
17
+ ## Requirements
18
+
19
+ - Node.js 18 or newer
20
+ - An MCPCloud account and API key (create one at https://mcpcloud.sh)
21
+
22
+ ## Installation
23
+
24
+ ```sh
25
+ # global install
26
+ npm install -g @mcpcloud/cli
27
+ bun add -g @mcpcloud/cli
28
+
29
+ # one-off invocation (no install)
30
+ npx -y @mcpcloud/cli whoami
31
+ bunx --bun @mcpcloud/cli whoami
32
+ ```
33
+
34
+ ## Configuration
35
+
36
+ The CLI needs **two** values to talk to your MCPCloud deployment: an API base URL and an API key. Either or both can come from environment variables, the saved config file, or per-invocation flags.
37
+
38
+ ### 1. Set the API base URL
39
+
40
+ The CLI does not assume any default base URL. Use whichever method fits your environment:
41
+
42
+ ```sh
43
+ # environment variable (recommended for CI / scripts)
44
+ export MCPCLOUD_BASE_URL=https://your-deployment.example.com
45
+
46
+ # persist for your user account (writes to ~/.mcpcloud/config.json)
47
+ mcp config set-url https://your-deployment.example.com
48
+
49
+ # one-off override
50
+ mcp --base-url https://your-deployment.example.com whoami
51
+ ```
52
+
53
+ The lookup order is: `--base-url` flag → `MCPCLOUD_BASE_URL` env var → saved `baseUrl` in `~/.mcpcloud/config.json`. If none are set the CLI exits with code `3` and a clear message.
54
+
55
+ ### 2. Authenticate
56
+
57
+ ```sh
58
+ # Save a key to ~/.mcpcloud/config.json (mode 0600)
59
+ mcp login # interactive prompt (recommended)
60
+ mcp login --key mck_xxx # non-interactive (avoid: writes to shell history)
61
+
62
+ # Or use an environment variable (recommended for CI)
63
+ export MCPCLOUD_API_KEY=mck_xxx
64
+ ```
65
+
66
+ `mcp logout` removes the saved key. `mcp config show` prints the current resolved config (with the API key redacted).
67
+
68
+ ## Quick start
69
+
70
+ ```sh
71
+ mcp whoami # show current key + organizations
72
+ mcp projects list # list projects in your default org
73
+ mcp servers list # list MCP servers
74
+ mcp servers get srv_123 # detail view
75
+ mcp servers logs srv_123 # recent deployment events
76
+ mcp tools list srv_123 # tools exposed by a server
77
+ mcp skills list # list skills
78
+ mcp skills connect skl_123 --agent claude-code --apply
79
+ # auto-register a skill with Claude Code
80
+ mcp api-keys list # personal API keys
81
+ mcp api-keys create --name CI # mint a new key (secret shown once)
82
+ mcp api-keys revoke key_456
83
+ ```
84
+
85
+ Run `mcp <command> --help` on any command for the full option list.
86
+
87
+ ## Global flags
88
+
89
+ | Flag | Description |
90
+ | ------------------ | --------------------------------------------------------------------------------------- |
91
+ | `--json` | Emit raw JSON on stdout. Errors come back as `{ "error": { "code", "message", ... } }`. |
92
+ | `--base-url <url>` | Override the API base URL for one invocation (useful for staging). |
93
+ | `-v, --version` | Print the CLI version. |
94
+ | `-h, --help` | Show help for any command. |
95
+
96
+ ## Environment variables
97
+
98
+ | Variable | Description |
99
+ | ------------------- | ------------------------------------------------------------- |
100
+ | `MCPCLOUD_API_KEY` | API key used for authentication (overrides the saved config). |
101
+ | `MCPCLOUD_BASE_URL` | API base URL. **Required** — there is no built-in default. |
102
+ | `MCPCLOUD_ORG_ID` | Default organization ID for commands that require one. |
103
+
104
+ The organization for each command is resolved in this order:
105
+
106
+ 1. The `--org` flag (when supported).
107
+ 2. `MCPCLOUD_ORG_ID`.
108
+ 3. `defaultOrganizationId` saved in `~/.mcpcloud/config.json`.
109
+ 4. The server-side default returned from `/api/v1/organizations`.
110
+
111
+ ## Commands
112
+
113
+ ### Authentication & config
114
+
115
+ ```sh
116
+ mcp login [--key <secret>] # save an API key locally
117
+ mcp logout # remove the saved key
118
+ mcp whoami # show current key, base URL, and accessible orgs
119
+
120
+ mcp config show # print resolved config (key redacted)
121
+ mcp config set-url <url> # persist the API base URL
122
+ mcp config clear-url # remove the saved base URL
123
+ mcp config set-org <orgId> # persist a default organization
124
+ mcp config clear-org # remove the saved default organization
125
+ ```
126
+
127
+ ### Projects
128
+
129
+ ```sh
130
+ mcp projects list [--org <id>] [--limit <n>]
131
+ mcp projects get <projectId> [--org <id>]
132
+ ```
133
+
134
+ ### Servers
135
+
136
+ ```sh
137
+ mcp servers list [--org <id>] [--project <id>] [--limit <n>]
138
+ mcp servers get <serverId> [--org <id>]
139
+ mcp servers logs <serverId> [--org <id>] [--limit <n>]
140
+ ```
141
+
142
+ ### Tools
143
+
144
+ ```sh
145
+ mcp tools list --project <projectId> [--org <id>]
146
+ mcp tools list --server <serverId> [--org <id>] # looks up the project for you
147
+ ```
148
+
149
+ ### Skills
150
+
151
+ ```sh
152
+ mcp skills list [--org <id>] [--project <id>] [--limit <n>]
153
+ mcp skills get <skillId> [--org <id>]
154
+
155
+ # Print or apply the MCP configuration that wires a skill into your coding agent.
156
+ mcp skills connect <skillId>
157
+ [--org <id>]
158
+ [--agent claude-code|codex|claude-desktop|vscode|cursor|windsurf|antigravity]
159
+ [--name <connection-name>]
160
+ [--apply] # for claude-code only: runs `claude mcp add`
161
+ ```
162
+
163
+ ### API keys
164
+
165
+ ```sh
166
+ mcp api-keys list
167
+ mcp api-keys create --name <displayName>
168
+ mcp api-keys revoke <apiKeyId>
169
+ ```
170
+
171
+ The secret returned by `api-keys create` is shown **once**. Save it immediately — you cannot retrieve it again.
172
+
173
+ ## JSON mode
174
+
175
+ Every command supports `--json` for piping into another tool. In JSON mode the CLI emits a single JSON document on success and a `{ "error": { ... } }` envelope on failure. No human-readable text is mixed in.
176
+
177
+ ```sh
178
+ mcp --json projects list | jq '.projects[].slug'
179
+
180
+ mcp --json skills connect skl_123 --agent cursor \
181
+ | jq '.snippet'
182
+ ```
183
+
184
+ ## Exit codes
185
+
186
+ | Code | Meaning |
187
+ | ---- | ---------------------------------------------------------------------------------------- |
188
+ | `0` | Success. |
189
+ | `1` | Generic failure (API error, validation error, network error). |
190
+ | `2` | No API key configured. Run `mcp login` or set `MCPCLOUD_API_KEY`. |
191
+ | `3` | No API base URL configured. Set `MCPCLOUD_BASE_URL` or run `mcp config set-url <url>`. |
192
+
193
+ When an API call fails, the CLI prints the response code, status, and request id (when present) to make debugging easier:
194
+
195
+ ```
196
+ Error: Server not found (code: not_found) (status: 404)
197
+ request id: api_018f...
198
+ docs: https://mcpcloud.sh/docs/errors#not_found
199
+ ```
200
+
201
+ ## Configuration file
202
+
203
+ The CLI stores its config at `~/.mcpcloud/config.json` with mode `0600`. Recognised fields:
204
+
205
+ ```jsonc
206
+ {
207
+ "apiKey": "mck_...", // saved by `mcp login`
208
+ "baseUrl": "https://your-deployment...", // saved by `mcp config set-url`
209
+ "defaultOrganizationId": "org_...", // saved by `mcp config set-org`
210
+ }
211
+ ```
212
+
213
+ You can edit the file directly or replace it. Environment variables take precedence over its contents.
214
+
215
+ ## Reliability
216
+
217
+ - **Timeout:** every request is bounded by a 30-second `AbortController`.
218
+ - **Retry:** transient failures (network errors, HTTP 502/503/504) are retried once with jittered backoff. 4xx responses are never retried.
219
+ - **Error envelope:** server errors are surfaced with their `code`, `message`, `requestId`, and `docsUrl` so you can correlate with backend logs.
220
+
221
+ ## Development
222
+
223
+ ```sh
224
+ git clone https://github.com/MCPCloud-sh/mcp-hub
225
+ cd mcp-hub/packages/cli
226
+
227
+ bun install
228
+ bun run dev -- --help # run from source
229
+ bun run typecheck # tsc --noEmit
230
+ bun run test # vitest
231
+ bun run build # bundle to dist/index.js
232
+ ```
233
+
234
+ The bundled output is a single Node-compatible ESM file with a `#!/usr/bin/env node` shebang.
235
+
236
+ ## Releasing
237
+
238
+ The CLI is released independently of the dashboard via [Changesets](https://github.com/changesets/changesets). When you land a PR that changes anything under `packages/cli/src/`, the workflow's `pr-checks` job requires a changeset describing the bump:
239
+
240
+ ```sh
241
+ # From the repo root, after staging your CLI changes:
242
+ bunx changeset
243
+ # → pick @mcpcloud/cli, choose patch | minor | major, write a one-line summary.
244
+ # Commit the generated .changeset/<name>.md alongside your code change.
245
+ ```
246
+
247
+ On merge to `main`, [`.github/workflows/cli-release.yml`](../../.github/workflows/cli-release.yml) opens (or updates) a "chore(cli): version packages" PR that bumps `packages/cli/package.json`, writes `CHANGELOG.md`, and consumes the pending changesets. Merging that PR publishes to npm (`prepublishOnly` re-runs typecheck + test + build as a gate) and creates a `@mcpcloud/cli@<version>` GitHub Release.
248
+
249
+ A Homebrew distribution (`brew install mcpcloud` via a custom tap with standalone bottles) is tracked separately — see issue tracker.
250
+
251
+ ## Support
252
+
253
+ - Documentation: https://mcpcloud.sh/docs
254
+ - Issues: https://github.com/MCPCloud-sh/mcp-hub/issues
255
+ - Email: support@mcpcloud.sh
256
+
257
+ ## License
258
+
259
+ MIT © MCPCloud