@apify/mcpc 0.2.6 → 0.3.0-beta.1
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/CHANGELOG.md +34 -0
- package/CONTRIBUTING.md +50 -147
- package/NOTICE +27 -0
- package/README.md +191 -235
- package/_config.yml +30 -0
- package/client-logo.svg +79 -0
- package/client-metadata.json +16 -0
- package/dist/bridge/index.js +25 -0
- package/dist/bridge/index.js.map +1 -1
- package/dist/cli/commands/auth.d.ts +2 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +27 -12
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/grep.js +4 -4
- package/dist/cli/commands/grep.js.map +1 -1
- package/dist/cli/commands/sessions.d.ts +21 -2
- package/dist/cli/commands/sessions.d.ts.map +1 -1
- package/dist/cli/commands/sessions.js +366 -66
- package/dist/cli/commands/sessions.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts.map +1 -1
- package/dist/cli/commands/tasks.js +6 -3
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/tools.d.ts.map +1 -1
- package/dist/cli/commands/tools.js +42 -18
- package/dist/cli/commands/tools.js.map +1 -1
- package/dist/cli/commands/x402.d.ts.map +1 -1
- package/dist/cli/commands/x402.js +6 -6
- package/dist/cli/commands/x402.js.map +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +3 -6
- package/dist/cli/helpers.js.map +1 -1
- package/dist/cli/index.js +110 -73
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +13 -5
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +176 -77
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +19 -9
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/shell.js +19 -19
- package/dist/cli/shell.js.map +1 -1
- package/dist/cli/tool-result.d.ts +1 -1
- package/dist/cli/tool-result.d.ts.map +1 -1
- package/dist/cli/tool-result.js +20 -15
- package/dist/cli/tool-result.js.map +1 -1
- package/dist/core/factory.d.ts +1 -0
- package/dist/core/factory.d.ts.map +1 -1
- package/dist/core/factory.js +3 -0
- package/dist/core/factory.js.map +1 -1
- package/dist/core/transports.d.ts +5 -1
- package/dist/core/transports.d.ts.map +1 -1
- package/dist/core/transports.js +26 -4
- package/dist/core/transports.js.map +1 -1
- package/dist/lib/auth/auth-page.d.ts +13 -0
- package/dist/lib/auth/auth-page.d.ts.map +1 -0
- package/dist/lib/auth/auth-page.js +129 -0
- package/dist/lib/auth/auth-page.js.map +1 -0
- package/dist/lib/auth/oauth-flow.d.ts +1 -1
- package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
- package/dist/lib/auth/oauth-flow.js +50 -67
- package/dist/lib/auth/oauth-flow.js.map +1 -1
- package/dist/lib/auth/oauth-provider.d.ts.map +1 -1
- package/dist/lib/auth/oauth-provider.js +2 -0
- package/dist/lib/auth/oauth-provider.js.map +1 -1
- package/dist/lib/auth/oauth-utils.d.ts +3 -0
- package/dist/lib/auth/oauth-utils.d.ts.map +1 -1
- package/dist/lib/auth/oauth-utils.js +32 -1
- package/dist/lib/auth/oauth-utils.js.map +1 -1
- package/dist/lib/auth/profiles.d.ts.map +1 -1
- package/dist/lib/auth/profiles.js +3 -3
- package/dist/lib/auth/profiles.js.map +1 -1
- package/dist/lib/bridge-manager.d.ts.map +1 -1
- package/dist/lib/bridge-manager.js +21 -9
- package/dist/lib/bridge-manager.js.map +1 -1
- package/dist/lib/config.d.ts +21 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +94 -4
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/errors.d.ts +1 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +3 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/sessions.d.ts.map +1 -1
- package/dist/lib/sessions.js +5 -4
- package/dist/lib/sessions.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +21 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/wallets.js +3 -3
- package/dist/lib/wallets.js.map +1 -1
- package/docs/examples/company-lookup.sh +134 -0
- package/docs/examples/mcp-config.json +28 -0
- package/package.json +39 -33
- package/pnpm-workspace.yaml +10 -0
- package/tsconfig.test.json +2 -1
- package/vitest.config.ts +26 -0
package/README.md
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mcpc — a universal MCP CLI client
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
that maps MCP operations to intuitive commands for interactive shell use, scripts, and AI coding agents.
|
|
3
|
+

|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@apify/mcpc)
|
|
6
|
+
[](https://www.npmjs.com/package/@apify/mcpc)
|
|
7
|
+
[](https://github.com/apify/mcpc/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/apify/mcpc/blob/main/LICENSE)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
`mcpc` is a command-line client for the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
|
|
11
|
+
that maps MCP operations to intuitive commands for interactive shell use, scripting, and AI agents.
|
|
12
|
+
|
|
13
|
+
`mcpc` is your new Swiss Army knife for MCP. It's great for manual inspection and debugging of MCP servers,
|
|
14
|
+
as well as for agents to leverage all modern MCP capabilities through the most universal
|
|
15
|
+
coding interface: the UNIX shell.
|
|
11
16
|
|
|
12
17
|
**Key features:**
|
|
13
18
|
|
|
14
|
-
-
|
|
15
|
-
- 🔄 **Persistent sessions** - Keep multiple
|
|
16
|
-
-
|
|
17
|
-
- 🔌 **Code mode** - JSON output
|
|
18
|
-
-
|
|
19
|
-
-
|
|
19
|
+
- 🔧 **Full MCP support** - HTTP/stdio transports, instructions, tools, async tasks, resources, prompts, ...
|
|
20
|
+
- 🔄 **Persistent sessions** - Keep multiple stateful connections alive simultaneously.
|
|
21
|
+
- 🗺️ **Progressive tool discovery** - Find relevant MCP tools on the fly to save tokens and increase accuracy.
|
|
22
|
+
- 🔌 **Code mode** - JSON output composes with `jq`, `xargs`, and shell pipelines for MCP workflows as shell scripts.
|
|
23
|
+
- 🔒 **Secure** - Full OAuth 2.1 support with CMID and DCR, uses OS keychain for credentials storage.
|
|
24
|
+
- 🤖 **AI sandboxing** - Proxy MCP server connections to protect credentials from AI-generated code.
|
|
20
25
|
- 🪶 **Lightweight** - Minimal dependencies, works on Mac/Win/Linux, doesn't use LLMs on its own.
|
|
21
|
-
- 💸 **
|
|
26
|
+
- 💸 **Agentic payments** - Experimental support for the [x402](https://www.x402.org/) protocol on [Base](https://www.base.org/).
|
|
27
|
+
|
|
28
|
+

|
|
22
29
|
|
|
23
30
|
## Table of contents
|
|
24
31
|
|
|
25
32
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
26
33
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
27
34
|
|
|
35
|
+
- [Motivation](#motivation)
|
|
28
36
|
- [Install](#install)
|
|
29
37
|
- [Quickstart](#quickstart)
|
|
30
38
|
- [Usage](#usage)
|
|
@@ -43,6 +51,33 @@ After all, UNIX-compatible shell script is THE most universal coding language.
|
|
|
43
51
|
|
|
44
52
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
45
53
|
|
|
54
|
+
## Motivation
|
|
55
|
+
|
|
56
|
+
Many AI agents misuse MCP. They treat tools as prompt-time function calls, repeatedly injecting
|
|
57
|
+
tool definitions and results into the context. Tokens get wasted, context rots, the
|
|
58
|
+
agent gets slower and less reliable, and popular conclusion that: _"MCP sucks, CLIs are better"_.
|
|
59
|
+
|
|
60
|
+
`mcpc` challenges that narrative. It maps every MCP operation to an intuitive CLI command that
|
|
61
|
+
agents pick up from `--help` alone. Any agent with shell access gets full MCP support without
|
|
62
|
+
wiring up dozens of MCP functions. Just one `Bash()` tool, and `mcpc` handles the rest:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
┌──────────┐ Bash() ┌──────────┐ MCP ┌────────────┐
|
|
67
|
+
│ AI agent │ ────────────────────► │ mcpc │ ────────────────────► │ MCP server │
|
|
68
|
+
└──────────┘ └──────────┘ Sessions, OAuth, └────────────┘
|
|
69
|
+
Tools, Resources,
|
|
70
|
+
Prompts, Tasks,
|
|
71
|
+
x402, ...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
CLI is the perfect _local_ interface between agents and MCP, while MCP remains the
|
|
75
|
+
standard _remote_ interface for server discovery, authentication, payments, and access control.
|
|
76
|
+
The two aren't exclusive – they're complementary.
|
|
77
|
+
|
|
78
|
+
As a bonus, the same `mcpc` configuration, OAuth profiles, and live sessions can be shared across
|
|
79
|
+
many AI agents on the same machine. Authenticate once, reuse everywhere.
|
|
80
|
+
|
|
46
81
|
## Install
|
|
47
82
|
|
|
48
83
|
```bash
|
|
@@ -52,28 +87,14 @@ npm install -g @apify/mcpc
|
|
|
52
87
|
bun install -g @apify/mcpc
|
|
53
88
|
```
|
|
54
89
|
|
|
55
|
-
**Linux
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
without a keyring daemon, `mcpc` automatically falls back to a file-based credential store
|
|
59
|
-
(`~/.mcpc/credentials`, mode `0600`).
|
|
90
|
+
**Linux:** credentials use the OS keychain via the [Secret Service API](https://specifications.freedesktop.org/secret-service/).
|
|
91
|
+
GNOME/KDE desktops work out of the box. On headless/CI systems, `mcpc` falls back to a
|
|
92
|
+
file-based store (`~/.mcpc/credentials`, mode `0600`).
|
|
60
93
|
|
|
61
|
-
To
|
|
94
|
+
To force the keychain on headless systems, install `libsecret` + `gnome-keyring`
|
|
95
|
+
(via `apt-get`, `dnf`, or `pacman`) and run:
|
|
62
96
|
|
|
63
97
|
```bash
|
|
64
|
-
# Debian/Ubuntu
|
|
65
|
-
sudo apt-get install libsecret-1-0 gnome-keyring
|
|
66
|
-
|
|
67
|
-
# Fedora/RHEL/CentOS
|
|
68
|
-
sudo dnf install libsecret gnome-keyring
|
|
69
|
-
|
|
70
|
-
# Arch Linux
|
|
71
|
-
sudo pacman -S libsecret gnome-keyring
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
And then run `mcpc` as follows:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
98
|
dbus-run-session -- bash -c "echo -n 'password' | gnome-keyring-daemon --unlock && mcpc ..."
|
|
78
99
|
```
|
|
79
100
|
|
|
@@ -106,6 +127,54 @@ mcpc @fs tools-list
|
|
|
106
127
|
<!-- AUTO-GENERATED: mcpc --help -->
|
|
107
128
|
|
|
108
129
|
```
|
|
130
|
+
Usage: mcpc [<@session>] [<command>] [options]
|
|
131
|
+
|
|
132
|
+
Universal command-line client for the Model Context Protocol (MCP).
|
|
133
|
+
|
|
134
|
+
Commands:
|
|
135
|
+
connect <server> [@session] Connect to an MCP server and start a new named @session
|
|
136
|
+
close <@session> Close a session
|
|
137
|
+
restart <@session> Restart a session (losing all state)
|
|
138
|
+
shell <@session> Open interactive shell for a session
|
|
139
|
+
login <server> Interactively login to a server using OAuth and save profile
|
|
140
|
+
logout <server> Delete an OAuth profile for a server
|
|
141
|
+
clean [resources...] Clean up mcpc data (sessions, profiles, logs, all)
|
|
142
|
+
grep <pattern> Search tools and instructions across all active sessions
|
|
143
|
+
x402 [subcommand] [args...] Configure an x402 payment wallet (EXPERIMENTAL)
|
|
144
|
+
help [command] [subcommand] Show help for a specific command
|
|
145
|
+
|
|
146
|
+
Options:
|
|
147
|
+
--json Output in JSON format for scripting
|
|
148
|
+
--verbose Enable debug logging
|
|
149
|
+
--profile <name> OAuth profile for the server ("default" if not provided)
|
|
150
|
+
--timeout <seconds> Request timeout in seconds (default: 300)
|
|
151
|
+
--max-chars <n> Truncate output to n characters (ignored in --json mode)
|
|
152
|
+
--insecure Skip TLS certificate verification (for self-signed certs)
|
|
153
|
+
-v, --version Output the version number
|
|
154
|
+
-h, --help Display help
|
|
155
|
+
|
|
156
|
+
MCP session commands (after connecting):
|
|
157
|
+
<@session> Show MCP server info, capabilities, and tools overview
|
|
158
|
+
<@session> grep <pattern> Search tools and instructions
|
|
159
|
+
<@session> tools-list List all server tools
|
|
160
|
+
<@session> tools-get <name> Get tool details and schema
|
|
161
|
+
<@session> tools-call <name> [arg:=val ... | <json> | <stdin]
|
|
162
|
+
<@session> prompts-list
|
|
163
|
+
<@session> prompts-get <name> [arg:=val ... | <json> | <stdin]
|
|
164
|
+
<@session> resources-list
|
|
165
|
+
<@session> resources-read <uri>
|
|
166
|
+
<@session> resources-subscribe <uri>
|
|
167
|
+
<@session> resources-unsubscribe <uri>
|
|
168
|
+
<@session> resources-templates-list
|
|
169
|
+
<@session> tasks-list
|
|
170
|
+
<@session> tasks-get <taskId>
|
|
171
|
+
<@session> tasks-result <taskId>
|
|
172
|
+
<@session> tasks-cancel <taskId>
|
|
173
|
+
<@session> logging-set-level <level>
|
|
174
|
+
<@session> ping
|
|
175
|
+
|
|
176
|
+
Run "mcpc" without arguments to show active sessions and OAuth profiles.
|
|
177
|
+
Run "mcpc --json" to get the same data as `{ sessions: [...], profiles: [...] }`.
|
|
109
178
|
```
|
|
110
179
|
|
|
111
180
|
### General actions
|
|
@@ -170,44 +239,15 @@ echo '{"greeting":"hello","count":10}' | mcpc @session tools-call <tool-name>
|
|
|
170
239
|
cat args.json | mcpc @session tools-call <tool-name>
|
|
171
240
|
```
|
|
172
241
|
|
|
173
|
-
**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
- `enabled:=true` → boolean `true`
|
|
179
|
-
- `greeting:=hello` → string `"hello"` (not valid JSON, so string)
|
|
180
|
-
- `id:='"123"'` → string `"123"` (JSON string literal)
|
|
181
|
-
- Inline JSON: If first argument starts with `{` or `[`, it's parsed as a JSON object/array
|
|
182
|
-
- Stdin: When no positional args are provided and input is piped, reads JSON from stdin
|
|
242
|
+
**Auto-parsing rules** for `key:=value`: valid JSON keeps its type
|
|
243
|
+
(`count:=10` → number, `enabled:=true` → boolean, `cfg:='{"k":"v"}'` → object); anything
|
|
244
|
+
else is a string (`greeting:=hello` → `"hello"`). Force a string literal with JSON quotes:
|
|
245
|
+
`id:='"123"'`. Inline JSON is detected when the first arg starts with `{` or `[`. Stdin is
|
|
246
|
+
read when no positional args are given and input is piped.
|
|
183
247
|
|
|
184
|
-
**
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# Variable with spaces - use double quotes
|
|
190
|
-
QUERY="hello world"
|
|
191
|
-
mcpc @server tools-call search "query:=${QUERY}"
|
|
192
|
-
|
|
193
|
-
# Multiple variables
|
|
194
|
-
CITY="New York"
|
|
195
|
-
TYPE="restaurants"
|
|
196
|
-
mcpc @server tools-call search "query:=${CITY} ${TYPE}"
|
|
197
|
-
|
|
198
|
-
# For complex inputs, consider using JSON via stdin
|
|
199
|
-
echo "{\"query\": \"${QUERY}\", \"limit\": 10}" | mcpc @server tools-call search
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Common pitfall:** Don't put spaces around `:=` - it won't work:
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# Wrong - spaces around :=
|
|
206
|
-
mcpc @server tools-call search query := "hello world"
|
|
207
|
-
|
|
208
|
-
# Correct - no spaces around :=
|
|
209
|
-
mcpc @server tools-call search "query:=hello world"
|
|
210
|
-
```
|
|
248
|
+
**Pitfalls:** no spaces around `:=` (use `query:=hello world`, not `query := ...`); quote
|
|
249
|
+
the whole argument when it contains shell expansions (`"query:=${VAR}"`). For complex
|
|
250
|
+
inputs, prefer piping JSON via stdin.
|
|
211
251
|
|
|
212
252
|
### Interactive shell
|
|
213
253
|
|
|
@@ -303,59 +343,27 @@ mcpc @apify close # or: mcpc close @apify
|
|
|
303
343
|
|
|
304
344
|
### Session lifecycle
|
|
305
345
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
Still, sessions can fail due to network disconnects, bridge process crash, or server dropping it.
|
|
346
|
+
Session metadata is saved in `~/.mcpc/sessions.json`, [authentication tokens](#authentication)
|
|
347
|
+
in the OS keychain. The bridge process keeps the session alive with periodic [pings](#ping)
|
|
348
|
+
and auto-reconnects on network failures or its own crashes (10s cooldown on failed retries).
|
|
310
349
|
|
|
311
350
|
**Session states:**
|
|
312
351
|
|
|
313
|
-
| State
|
|
314
|
-
|
|
315
|
-
|
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
The bridge will keep trying to reconnect in the background and will return to 🟢 **`live`** once the server responds again.
|
|
329
|
-
- If **server rejects authentication** (HTTP 401 or 403) or token refresh fails,
|
|
330
|
-
the session is marked 🔴 **`unauthorized`**.
|
|
331
|
-
`mcpc` will auto-reconnect in the background if another session sharing the same OAuth profile has refreshed the tokens.
|
|
332
|
-
Otherwise, re-authenticate with `mcpc login <server>` and then `mcpc @my-session restart`.
|
|
333
|
-
- If **server rejects the session ID** (HTTP 404), indicating the MCP session is no longer valid,
|
|
334
|
-
the session is marked 🔴 **`expired`**.
|
|
335
|
-
You need to restart the session with `mcpc @my-session restart` to establish a new connection.
|
|
336
|
-
- If the **bridge process crashes**, `mcpc` will mark the session as 🟡 **`crashed`**
|
|
337
|
-
and auto-reconnect the bridge in the background. You can also trigger reconnection manually
|
|
338
|
-
by running any `mcpc @my-session ...` command.
|
|
339
|
-
- If reconnection **succeeds** and the server resumes the MCP session, the session returns to 🟢 **`live`**.
|
|
340
|
-
- If the server issues a **new session ID** instead of resuming, the session is marked 🔴 **`expired`**.
|
|
341
|
-
- If reconnection **fails**, the session remains 🟡 **`crashed`** and retries after a 10-second cooldown.
|
|
342
|
-
|
|
343
|
-
Note that `mcpc` never automatically removes sessions from the list.
|
|
344
|
-
Instead, it keeps them flagged as 🟡 **`crashed`**, 🔴 **`unauthorized`**, or 🔴 **`expired`**,
|
|
345
|
-
and any future attempts to use them will show the appropriate error with recovery instructions.
|
|
346
|
-
|
|
347
|
-
To **remove the session from the list**, you need to explicitly close it:
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
mcpc @apify close # or: mcpc close @apify
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
You can restart a session anytime, which kills the bridge process
|
|
354
|
-
and opens new connection with new `MCP-Session-Id`, by running:
|
|
355
|
-
|
|
356
|
-
```bash
|
|
357
|
-
mcpc @apify restart # or: mcpc restart @apify
|
|
358
|
-
```
|
|
352
|
+
| State | Meaning |
|
|
353
|
+
|------------------| ----------------------------------------------------------------------------------------------- |
|
|
354
|
+
| 🟢`live` | Bridge process running and server responding |
|
|
355
|
+
| 🟡`connecting` | Initial bridge startup in progress (`mcpc connect`) |
|
|
356
|
+
| 🟡`reconnecting` | Bridge crashed or lost auth; auto-reconnecting in the background |
|
|
357
|
+
| 🟡`disconnected` | Bridge process running but server unreachable; auto-recovers when server responds |
|
|
358
|
+
| 🟡`crashed` | Bridge process crashed or was killed; auto-reconnects in the background |
|
|
359
|
+
| 🔴`unauthorized` | Server rejected authentication (401/403) or token refresh failed; re-run `login` then `restart` |
|
|
360
|
+
| 🔴`expired` | Server rejected session ID (404); requires `restart` |
|
|
361
|
+
|
|
362
|
+
`mcpc` never removes sessions automatically — failed ones stay flagged with a recovery hint
|
|
363
|
+
in the error message. Use `mcpc @apify restart` to kill the bridge and open a fresh
|
|
364
|
+
`MCP-Session-Id`, or `mcpc @apify close` to remove the session entirely.
|
|
365
|
+
You can also remove dead sessions by running `mcpc clean`,
|
|
366
|
+
and all sessions by running `mcpc clean all` (see [Cleanup](#cleanup)).
|
|
359
367
|
|
|
360
368
|
## Authentication
|
|
361
369
|
|
|
@@ -442,23 +450,29 @@ When logging in, `mcpc` supports all three OAuth client registration approaches
|
|
|
442
450
|
[MCP authorization spec](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#client-registration-approaches),
|
|
443
451
|
picking the one the authorization server advertises in its OAuth metadata:
|
|
444
452
|
|
|
445
|
-
| **Approach** | **`mcpc login` flags**
|
|
446
|
-
|
|
447
|
-
| **Pre-registration** | `--client-id` (and optional `--client-secret`)
|
|
448
|
-
| **Client ID Metadata Documents (CIMD)** | `--client-metadata-url <
|
|
449
|
-
| **Dynamic Client Registration (DCR)** |
|
|
453
|
+
| **Approach** | **`mcpc login` flags** |
|
|
454
|
+
| :-------------------------------------- | :-------------------------------------------------- |
|
|
455
|
+
| **Pre-registration** | `--client-id` (and optional `--client-secret`) |
|
|
456
|
+
| **Client ID Metadata Documents (CIMD)** | default (or `--client-metadata-url <url>`) |
|
|
457
|
+
| **Dynamic Client Registration (DCR)** | fallback (or force with `--no-client-metadata-url`) |
|
|
458
|
+
|
|
459
|
+
`mcpc` ships with a hosted [Client ID Metadata Document](https://apify.github.io/mcpc/client-metadata.json)
|
|
460
|
+
so every installation presents the same client identity to CIMD-capable authorization servers.
|
|
461
|
+
When the authorization server advertises `client_id_metadata_document_supported: true`, the CIMD
|
|
462
|
+
URL is used as the `client_id`; otherwise mcpc falls back to Dynamic Client Registration.
|
|
450
463
|
|
|
451
464
|
```bash
|
|
452
|
-
#
|
|
465
|
+
# Default: mcpc's hosted CIMD is used automatically (no flags needed).
|
|
466
|
+
mcpc login mcp.apify.com
|
|
467
|
+
|
|
468
|
+
# Pre-registered OAuth client (public or confidential) — skips CIMD.
|
|
453
469
|
mcpc login mcp.example.com --client-id <id> [--client-secret <secret>]
|
|
454
470
|
|
|
455
|
-
#
|
|
456
|
-
|
|
457
|
-
# otherwise mcpc falls back to Dynamic Client Registration.
|
|
458
|
-
mcpc login mcp.example.com --client-metadata-url https://example.com/mcpc-client.json
|
|
471
|
+
# Custom CIMD: override the default with your own hosted document.
|
|
472
|
+
mcpc login mcp.example.com --client-metadata-url https://example.com/my-client.json
|
|
459
473
|
|
|
460
|
-
# Dynamic Client Registration
|
|
461
|
-
mcpc login mcp.
|
|
474
|
+
# Disable CIMD: force Dynamic Client Registration even if the server supports CIMD.
|
|
475
|
+
mcpc login mcp.example.com --no-client-metadata-url
|
|
462
476
|
```
|
|
463
477
|
|
|
464
478
|
See the [MCP authorization spec](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#client-registration-approaches)
|
|
@@ -466,81 +480,36 @@ for details on each approach and the format of Client ID Metadata Documents.
|
|
|
466
480
|
|
|
467
481
|
### Authentication precedence
|
|
468
482
|
|
|
469
|
-
When
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
3. **Config file headers** - Headers from `--config` file for the server
|
|
474
|
-
4. **No authentication** - Attempts unauthenticated connection
|
|
475
|
-
|
|
476
|
-
**Note:** `--profile` and `--header "Authorization: ..."` cannot be combined — they are mutually
|
|
477
|
-
exclusive. Providing both will result in a clear error. Use one or the other.
|
|
478
|
-
|
|
479
|
-
`mcpc` automatically handles authentication based on what you specify:
|
|
480
|
-
|
|
481
|
-
**When `--header "Authorization: ..."` is provided:**
|
|
482
|
-
|
|
483
|
-
- The explicit header is always used, and OAuth profile auto-detection is skipped entirely
|
|
484
|
-
- This works even if a `default` profile exists for the server
|
|
485
|
-
- Cannot be combined with `--profile` (returns an error)
|
|
486
|
-
|
|
487
|
-
**When `--profile <name>` is specified:**
|
|
488
|
-
|
|
489
|
-
1. **Profile exists for the server**: Use its stored credentials
|
|
490
|
-
- If authentication succeeds → Continue with command/session
|
|
491
|
-
- If authentication fails (expired/invalid) → Fail with an error
|
|
492
|
-
2. **Profile doesn't exist**: Fail with an error
|
|
483
|
+
When connecting, `mcpc` picks one auth source based on the flags you pass — explicit flags
|
|
484
|
+
always win over stored profiles, and credentials are never silently downgraded. If a profile
|
|
485
|
+
is missing, expired, or invalid, `mcpc` fails with an error that includes the right
|
|
486
|
+
`mcpc login` command to recover.
|
|
493
487
|
|
|
494
|
-
|
|
488
|
+
| Flag | Behavior |
|
|
489
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
490
|
+
| `--header "Authorization: ..."` | Use explicit header; skip OAuth auto-detection. Cannot combine with `--profile`. |
|
|
491
|
+
| `--profile <name>` | Require the named profile to exist. |
|
|
492
|
+
| `--no-profile` | Connect anonymously even if a `default` profile exists. |
|
|
493
|
+
| `--x402` | Skip OAuth auto-detection; use x402 payments instead. Combine with `--profile` to use both. |
|
|
494
|
+
| _(none)_ | Use `default` profile if it exists; otherwise connect anonymously. |
|
|
495
495
|
|
|
496
|
-
|
|
497
|
-
- If you also pass `--profile`, the specified profile is still used alongside x402
|
|
498
|
-
|
|
499
|
-
**When `--no-profile` is specified:**
|
|
500
|
-
|
|
501
|
-
- Skip all OAuth profile detection and connect anonymously
|
|
502
|
-
- Useful when a `default` profile exists but you want an unauthenticated session
|
|
503
|
-
- Can be combined with `--header "Authorization: ..."` for explicit bearer token without profile
|
|
504
|
-
|
|
505
|
-
**When no flags are specified (default):**
|
|
506
|
-
|
|
507
|
-
1. **`default` profile exists for the server**: Use its stored credentials
|
|
508
|
-
- If authentication succeeds → Continue with command/session
|
|
509
|
-
- If authentication fails (expired/invalid) → Fail with an error
|
|
510
|
-
2. **`default` profile doesn't exist**: Attempt unauthenticated connection
|
|
511
|
-
- If server accepts (no auth required) → Continue without creating profile
|
|
512
|
-
- If server rejects with 401 + `WWW-Authenticate` → Fail with an error
|
|
513
|
-
|
|
514
|
-
On failure, the error message includes instructions on how to login and save the profile, so you know what to do.
|
|
515
|
-
|
|
516
|
-
This flow ensures:
|
|
517
|
-
|
|
518
|
-
- Explicit CLI flags always take precedence over stored profiles
|
|
519
|
-
- Credentials are never silently mixed up (personal → work) or downgraded (authenticated → unauthenticated)
|
|
520
|
-
- You can mix authenticated sessions (with named profiles) and public access on the same server
|
|
521
|
-
|
|
522
|
-
**Examples:**
|
|
496
|
+
Config file headers (from `--config`) apply to servers loaded from that file.
|
|
523
497
|
|
|
524
498
|
```bash
|
|
525
|
-
#
|
|
526
|
-
# - Uses 'work' if it exists
|
|
527
|
-
# - Fails if it doesn't exist
|
|
528
|
-
mcpc connect mcp.apify.com @apify-work --profile work
|
|
529
|
-
|
|
530
|
-
# Without profile - opportunistic authentication:
|
|
531
|
-
# - Uses 'default' if it exists
|
|
532
|
-
# - Tries unauthenticated if 'default' doesn't exist
|
|
533
|
-
# - Fails if the server requires authentication
|
|
499
|
+
# Default: 'default' profile if it exists, else anonymous
|
|
534
500
|
mcpc connect mcp.apify.com @apify-personal
|
|
535
501
|
|
|
536
|
-
#
|
|
537
|
-
mcpc connect mcp.apify.com @apify --
|
|
502
|
+
# Specific profile (fails if missing)
|
|
503
|
+
mcpc connect mcp.apify.com @apify-work --profile work
|
|
538
504
|
|
|
539
|
-
#
|
|
540
|
-
mcpc connect mcp.apify.com @apify --
|
|
505
|
+
# Explicit bearer token (no profile)
|
|
506
|
+
mcpc connect mcp.apify.com @apify --header "Authorization: Bearer ${APIFY_TOKEN}"
|
|
541
507
|
|
|
542
|
-
#
|
|
508
|
+
# Skip default profile, connect anonymously
|
|
543
509
|
mcpc connect mcp.apify.com @apify-anon --no-profile
|
|
510
|
+
|
|
511
|
+
# x402 micropayments instead of OAuth
|
|
512
|
+
mcpc connect mcp.apify.com @apify --x402
|
|
544
513
|
```
|
|
545
514
|
|
|
546
515
|
## MCP proxy
|
|
@@ -623,22 +592,12 @@ mcpc @server tools-get search
|
|
|
623
592
|
mcpc @server tools-call search query:="hello world"
|
|
624
593
|
```
|
|
625
594
|
|
|
626
|
-
**Code mode** - Once agents understand the server's capabilities, they can write shell
|
|
627
|
-
that compose multiple `mcpc` commands with `--json` output
|
|
628
|
-
[
|
|
629
|
-
and use
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
# AI-generated script using --json for structured data
|
|
633
|
-
mcpc --json @apify tools-call search-actors keywords:="scraper" \
|
|
634
|
-
| jq '.content[0].text | fromjson | .items[0].id' \
|
|
635
|
-
| xargs -I {} mcpc @apify tools-call get-actor actorId:="{}"
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
With [schema validation](#schema-validation), agents can ensure stability of integrations and faster failure recovery.
|
|
639
|
-
Agents, make no harm!
|
|
640
|
-
|
|
641
|
-
See an [example](./docs/examples/company-lookup.sh) of an AI-generated shell script.
|
|
595
|
+
**Code mode** - Once agents understand the server's capabilities, they can write shell
|
|
596
|
+
scripts that compose multiple `mcpc` commands with `--json` output — see
|
|
597
|
+
[Scripting](#scripting) below. This can be
|
|
598
|
+
[more accurate](https://www.anthropic.com/engineering/code-execution-with-mcp) and use
|
|
599
|
+
fewer tokens than tool calling for complex workflows. Pair with
|
|
600
|
+
[schema validation](#schema-validation) to catch breaking changes early.
|
|
642
601
|
|
|
643
602
|
### Scripting
|
|
644
603
|
|
|
@@ -1094,16 +1053,13 @@ For **stdio servers:**
|
|
|
1094
1053
|
- `args` (optional) - Array of command arguments
|
|
1095
1054
|
- `env` (optional) - Environment variables for the process
|
|
1096
1055
|
|
|
1097
|
-
**
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
mcpc @fs tools-list
|
|
1105
|
-
mcpc @fs tools-call search
|
|
1106
|
-
```
|
|
1056
|
+
> **Note:** Stdio servers inherit only a minimal env whitelist from the shell
|
|
1057
|
+
> (`PATH`, `HOME`, `SHELL`, …). Other vars — `NODE_EXTRA_CA_CERTS`, `HTTPS_PROXY`,
|
|
1058
|
+
> `SSL_CERT_FILE`, etc. — must be forwarded explicitly via the `env` block using
|
|
1059
|
+
> `${VAR_NAME}`. Anything the server writes to stderr is captured to
|
|
1060
|
+
> `~/.mcpc/logs/bridge-<session>.log` with a `[server stderr]` prefix, and the
|
|
1061
|
+
> tail is appended to the error message if `mcpc connect` fails, so you can see
|
|
1062
|
+
> why a stdio server failed to start.
|
|
1107
1063
|
|
|
1108
1064
|
**Environment variable substitution:**
|
|
1109
1065
|
|
|
@@ -1254,22 +1210,22 @@ See [CONTRIBUTING](./CONTRIBUTING.md) for development setup, architecture overvi
|
|
|
1254
1210
|
|
|
1255
1211
|
### MCP CLI clients
|
|
1256
1212
|
|
|
1257
|
-
<!-- Stars, contributors, commits, and activity as of
|
|
1213
|
+
<!-- Stars, contributors, commits, and activity as of May 2026. -->
|
|
1258
1214
|
|
|
1259
1215
|
| Tool | Lang | Stars | Contrib / Commits | Active | Tools | Resources | Prompts | Tasks | Code mode | Sessions | OAuth | Stdio | HTTP | Tool search | x402 | LLM |
|
|
1260
1216
|
| ----------------------------------------------------------------------- | ------ | ----: | ----------------: | ------ | ----- | --------- | ------- | ----- | --------- | -------- | ----- | ----- | ---- | ----------- | ---- | --- |
|
|
1261
|
-
| **[apify/mcpc](https://github.com/apify/mcpc)** | TS | ~
|
|
1262
|
-
| [steipete/mcporter](https://github.com/steipete/mcporter) | TS | ~
|
|
1263
|
-
| [
|
|
1264
|
-
| [
|
|
1265
|
-
| [f/mcptools](https://github.com/f/mcptools) | Go | ~1.
|
|
1266
|
-
| [philschmid/mcp-cli](https://github.com/philschmid/mcp-cli) | TS | ~1.1k |
|
|
1217
|
+
| **[apify/mcpc](https://github.com/apify/mcpc)** | TS | ~590 | 8 / ~640 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — |
|
|
1218
|
+
| [steipete/mcporter](https://github.com/steipete/mcporter) | TS | ~4.4k | 29 / ~650 | ✅ | ✅ | — | — | — | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | — |
|
|
1219
|
+
| [knowsuchagency/mcp2cli](https://github.com/knowsuchagency/mcp2cli) | Python | ~2.1k | 11 / ~91 | ✅ | ✅ | ✅ | ✅ | — | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — |
|
|
1220
|
+
| [IBM/mcp-cli](https://github.com/IBM/mcp-cli) | Python | ~2.0k | 24 / ~790 | ✅ | ✅ | ✅ | ✅ | — | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ |
|
|
1221
|
+
| [f/mcptools](https://github.com/f/mcptools) | Go | ~1.6k | 15 / ~175 | ⚠️ | ✅ | ✅ | ✅ | — | ✅ | — | — | ✅ | ✅ | — | — | — |
|
|
1222
|
+
| [philschmid/mcp-cli](https://github.com/philschmid/mcp-cli) | TS | ~1.1k | 3 / ~30 | ⚠️ | ✅ | — | — | — | ✅ | ✅ | — | ✅ | ✅ | ✅ | — | — |
|
|
1267
1223
|
| [adhikasp/mcp-client-cli](https://github.com/adhikasp/mcp-client-cli) | Python | ~670 | 6 / ~110 | ⚠️ | ✅ | ✅ | ✅ | — | — | — | — | ✅ | — | — | — | ✅ |
|
|
1268
|
-
| [thellimist/clihub](https://github.com/thellimist/clihub) | Go | ~
|
|
1224
|
+
| [thellimist/clihub](https://github.com/thellimist/clihub) | Go | ~670 | 1 / ~60 | ✅ | ✅ | — | — | — | — | — | ✅ | ✅ | ✅ | ✅ | — | — |
|
|
1269
1225
|
| [wong2/mcp-cli](https://github.com/wong2/mcp-cli) | JS | ~430 | 4 / ~63 | ⚠️ | ✅ | ✅ | ✅ | — | — | — | ✅ | — | ✅ | — | — | — |
|
|
1270
|
-
| [mcpshim/mcpshim](https://github.com/mcpshim/mcpshim) | Go | ~
|
|
1271
|
-
| [evantahler/mcpx](https://github.com/evantahler/mcpx) | TS | ~
|
|
1272
|
-
| [EstebanForge/mcp-cli-ent](https://github.com/EstebanForge/mcp-cli-ent) | Go | ~15 |
|
|
1226
|
+
| [mcpshim/mcpshim](https://github.com/mcpshim/mcpshim) | Go | ~58 | 1 / ~13 | ✅ | ✅ | — | — | — | ✅ | ✅ | ✅ | — | ✅ | ✅ | — | — |
|
|
1227
|
+
| [evantahler/mcpx](https://github.com/evantahler/mcpx) | TS | ~32 | 2 / ~100 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | ✅ | ✅ | ✅ | ✅ | — | — |
|
|
1228
|
+
| [EstebanForge/mcp-cli-ent](https://github.com/EstebanForge/mcp-cli-ent) | Go | ~15 | 3 / ~46 | ✅ | ✅ | — | — | — | ✅ | ✅ | — | ✅ | ✅ | ✅ | — | — |
|
|
1273
1229
|
|
|
1274
1230
|
**Legend:** ✅ = supported, ⚠️ = stale (no commits in 3+ months), **Contrib / Commits** = contributors / total commits, **Tasks** = [async tasks](https://modelcontextprotocol.io/specification/latest/server/utilities/tasks), **x402** = [x402 payment protocol](https://www.x402.org/) support, **LLM** = requires/uses an LLM.
|
|
1275
1231
|
|
package/_config.yml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# GitHub Pages configuration for https://apify.github.io/mcpc/
|
|
2
|
+
#
|
|
3
|
+
# Served content (everything else is excluded):
|
|
4
|
+
# / → README.md (project homepage)
|
|
5
|
+
# /client-metadata.json → OAuth CIMD document
|
|
6
|
+
# /client-logo.svg → Client logo for OAuth consent screens
|
|
7
|
+
# /LICENSE → Terms of service (referenced by CIMD tos_uri)
|
|
8
|
+
# /CHANGELOG.md → Release history
|
|
9
|
+
# /docs/ → Additional documentation, examples, images
|
|
10
|
+
#
|
|
11
|
+
# Jekyll has no include-only mode, so we exclude everything that
|
|
12
|
+
# shouldn't be published. node_modules/ is excluded by default.
|
|
13
|
+
|
|
14
|
+
theme: jekyll-theme-cayman
|
|
15
|
+
|
|
16
|
+
exclude:
|
|
17
|
+
- CLAUDE.md
|
|
18
|
+
- CONTRIBUTING.md
|
|
19
|
+
- _config.yml
|
|
20
|
+
- bin/
|
|
21
|
+
- dist/
|
|
22
|
+
- jest.config.js
|
|
23
|
+
- package.json
|
|
24
|
+
- package-lock.json
|
|
25
|
+
- renovate.json
|
|
26
|
+
- scripts/
|
|
27
|
+
- src/
|
|
28
|
+
- test/
|
|
29
|
+
- tsconfig.json
|
|
30
|
+
- tsconfig.test.json
|