@mcpcloud/cli 0.1.0
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 +213 -0
- package/dist/index.js +2850 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
mcpsh login
|
|
8
|
+
mcpsh whoami
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package installs two equivalent binaries: `mcpsh` (short) and `mcpcloud` (full). Use whichever you prefer.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Node.js 18 or newer
|
|
16
|
+
- An MCPCloud account and API key (create one at https://mcpcloud.sh)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
# global install
|
|
22
|
+
npm install -g @mcpcloud/cli
|
|
23
|
+
bun add -g @mcpcloud/cli
|
|
24
|
+
|
|
25
|
+
# one-off invocation (no install)
|
|
26
|
+
npx -y @mcpcloud/cli whoami
|
|
27
|
+
bunx --bun @mcpcloud/cli whoami
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Authentication
|
|
31
|
+
|
|
32
|
+
You can authenticate two ways. The CLI prefers the environment variable when both are set.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
# 1. Save a key to ~/.mcpcloud/config.json (mode 0600)
|
|
36
|
+
mcpsh login # interactive prompt (recommended)
|
|
37
|
+
mcpsh login --key mck_xxx # non-interactive (avoid: writes to shell history)
|
|
38
|
+
|
|
39
|
+
# 2. Use an environment variable (recommended for CI)
|
|
40
|
+
export MCPCLOUD_API_KEY=mck_xxx
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`mcpsh logout` removes the saved key.
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
mcpsh whoami # show current key + organizations
|
|
49
|
+
mcpsh projects list # list projects in your default org
|
|
50
|
+
mcpsh servers list # list MCP servers
|
|
51
|
+
mcpsh servers get srv_123 # detail view
|
|
52
|
+
mcpsh servers logs srv_123 # recent deployment events
|
|
53
|
+
mcpsh tools list srv_123 # tools exposed by a server
|
|
54
|
+
mcpsh skills list # list skills
|
|
55
|
+
mcpsh skills connect skl_123 --agent claude-code --apply
|
|
56
|
+
# auto-register a skill with Claude Code
|
|
57
|
+
mcpsh api-keys list # personal API keys
|
|
58
|
+
mcpsh api-keys create --name CI # mint a new key (secret shown once)
|
|
59
|
+
mcpsh api-keys revoke key_456
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Run `mcpsh <command> --help` on any command for the full option list.
|
|
63
|
+
|
|
64
|
+
## Global flags
|
|
65
|
+
|
|
66
|
+
| Flag | Description |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `--json` | Emit raw JSON on stdout. Errors come back as `{ "error": { "code", "message", ... } }`. |
|
|
69
|
+
| `--base-url <url>` | Override the API base URL for one invocation (useful for staging). |
|
|
70
|
+
| `-v, --version` | Print the CLI version. |
|
|
71
|
+
| `-h, --help` | Show help for any command. |
|
|
72
|
+
|
|
73
|
+
## Environment variables
|
|
74
|
+
|
|
75
|
+
| Variable | Description |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `MCPCLOUD_API_KEY` | API key used for authentication (overrides the saved config). |
|
|
78
|
+
| `MCPCLOUD_BASE_URL` | Override the API base URL. Default: `https://mcpcloud.sh`. |
|
|
79
|
+
| `MCPCLOUD_ORG_ID` | Default organization ID for commands that require one. |
|
|
80
|
+
|
|
81
|
+
The organization for each command is resolved in this order:
|
|
82
|
+
|
|
83
|
+
1. The `--org` flag (when supported).
|
|
84
|
+
2. `MCPCLOUD_ORG_ID`.
|
|
85
|
+
3. `defaultOrganizationId` saved in `~/.mcpcloud/config.json`.
|
|
86
|
+
4. The server-side default returned from `/api/v1/organizations`.
|
|
87
|
+
|
|
88
|
+
## Commands
|
|
89
|
+
|
|
90
|
+
### Authentication
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
mcpsh login [--key <secret>] # save an API key locally
|
|
94
|
+
mcpsh logout # remove the saved key
|
|
95
|
+
mcpsh whoami # show current key, base URL, and accessible orgs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Projects
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
mcpsh projects list [--org <id>] [--limit <n>]
|
|
102
|
+
mcpsh projects get <projectId> [--org <id>]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Servers
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
mcpsh servers list [--org <id>] [--project <id>] [--limit <n>]
|
|
109
|
+
mcpsh servers get <serverId> [--org <id>]
|
|
110
|
+
mcpsh servers logs <serverId> [--org <id>] [--limit <n>]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Tools
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
mcpsh tools list <serverId> [--org <id>]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Skills
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
mcpsh skills list [--org <id>] [--project <id>] [--limit <n>]
|
|
123
|
+
mcpsh skills get <skillId> [--org <id>]
|
|
124
|
+
|
|
125
|
+
# Print or apply the MCP configuration that wires a skill into your coding agent.
|
|
126
|
+
mcpsh skills connect <skillId>
|
|
127
|
+
[--org <id>]
|
|
128
|
+
[--agent claude-code|codex|claude-desktop|vscode|cursor|windsurf|antigravity]
|
|
129
|
+
[--name <connection-name>]
|
|
130
|
+
[--apply] # for claude-code only: runs `claude mcp add`
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### API keys
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
mcpsh api-keys list
|
|
137
|
+
mcpsh api-keys create --name <displayName>
|
|
138
|
+
mcpsh api-keys revoke <apiKeyId>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The secret returned by `api-keys create` is shown **once**. Save it immediately — you cannot retrieve it again.
|
|
142
|
+
|
|
143
|
+
## JSON mode
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
mcpsh --json projects list | jq '.projects[].slug'
|
|
149
|
+
|
|
150
|
+
mcpsh --json skills connect skl_123 --agent cursor \
|
|
151
|
+
| jq '.snippet'
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Exit codes
|
|
155
|
+
|
|
156
|
+
| Code | Meaning |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `0` | Success. |
|
|
159
|
+
| `1` | Generic failure (API error, validation error, network error). |
|
|
160
|
+
| `2` | No API key configured. Run `mcpsh login` or set `MCPCLOUD_API_KEY`. |
|
|
161
|
+
|
|
162
|
+
When an API call fails, the CLI prints the response code, status, and request id (when present) to make debugging easier:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Error: Server not found (code: not_found) (status: 404)
|
|
166
|
+
request id: api_018f...
|
|
167
|
+
docs: https://mcpcloud.sh/docs/errors#not_found
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Configuration file
|
|
171
|
+
|
|
172
|
+
The CLI stores its config at `~/.mcpcloud/config.json` with mode `0600`. Recognised fields:
|
|
173
|
+
|
|
174
|
+
```jsonc
|
|
175
|
+
{
|
|
176
|
+
"apiKey": "mck_...", // saved by `mcpsh login`
|
|
177
|
+
"baseUrl": "https://staging.mcpcloud.sh", // overrides the default
|
|
178
|
+
"defaultOrganizationId": "org_..." // used when --org is omitted
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
You can edit the file directly or replace it. Environment variables take precedence over its contents.
|
|
183
|
+
|
|
184
|
+
## Reliability
|
|
185
|
+
|
|
186
|
+
- **Timeout:** every request is bounded by a 30-second `AbortController`.
|
|
187
|
+
- **Retry:** transient failures (network errors, HTTP 502/503/504) are retried once with jittered backoff. 4xx responses are never retried.
|
|
188
|
+
- **Error envelope:** server errors are surfaced with their `code`, `message`, `requestId`, and `docsUrl` so you can correlate with backend logs.
|
|
189
|
+
|
|
190
|
+
## Development
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
git clone https://github.com/your-org/mcp-hub
|
|
194
|
+
cd mcp-hub/packages/cli
|
|
195
|
+
|
|
196
|
+
bun install
|
|
197
|
+
bun run dev -- --help # run from source
|
|
198
|
+
bun run typecheck # tsc --noEmit
|
|
199
|
+
bun run test # vitest
|
|
200
|
+
bun run build # bundle to dist/index.js
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
The bundled output is a single Node-compatible ESM file with a `#!/usr/bin/env node` shebang.
|
|
204
|
+
|
|
205
|
+
## Support
|
|
206
|
+
|
|
207
|
+
- Documentation: https://mcpcloud.sh/docs
|
|
208
|
+
- Issues: https://github.com/your-org/mcp-hub/issues
|
|
209
|
+
- Email: support@mcpcloud.sh
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT © MCPCloud
|