@apify/mcpc 0.1.11 → 0.2.0-beta.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +72 -3
  2. package/README.md +231 -201
  3. package/dist/bridge/index.js +224 -34
  4. package/dist/bridge/index.js.map +1 -1
  5. package/dist/cli/commands/auth.d.ts +2 -0
  6. package/dist/cli/commands/auth.d.ts.map +1 -1
  7. package/dist/cli/commands/auth.js +11 -1
  8. package/dist/cli/commands/auth.js.map +1 -1
  9. package/dist/cli/commands/logging.d.ts.map +1 -1
  10. package/dist/cli/commands/logging.js +1 -4
  11. package/dist/cli/commands/logging.js.map +1 -1
  12. package/dist/cli/commands/sessions.d.ts +3 -1
  13. package/dist/cli/commands/sessions.d.ts.map +1 -1
  14. package/dist/cli/commands/sessions.js +178 -141
  15. package/dist/cli/commands/sessions.js.map +1 -1
  16. package/dist/cli/commands/tasks.d.ts +5 -0
  17. package/dist/cli/commands/tasks.d.ts.map +1 -0
  18. package/dist/cli/commands/tasks.js +53 -0
  19. package/dist/cli/commands/tasks.js.map +1 -0
  20. package/dist/cli/commands/tools.d.ts +2 -0
  21. package/dist/cli/commands/tools.d.ts.map +1 -1
  22. package/dist/cli/commands/tools.js +158 -12
  23. package/dist/cli/commands/tools.js.map +1 -1
  24. package/dist/cli/commands/x402.d.ts.map +1 -1
  25. package/dist/cli/commands/x402.js +20 -6
  26. package/dist/cli/commands/x402.js.map +1 -1
  27. package/dist/cli/helpers.d.ts +2 -6
  28. package/dist/cli/helpers.d.ts.map +1 -1
  29. package/dist/cli/helpers.js +27 -185
  30. package/dist/cli/helpers.js.map +1 -1
  31. package/dist/cli/index.js +436 -203
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/cli/output.d.ts +7 -3
  34. package/dist/cli/output.d.ts.map +1 -1
  35. package/dist/cli/output.js +135 -16
  36. package/dist/cli/output.js.map +1 -1
  37. package/dist/cli/parser.d.ts +11 -8
  38. package/dist/cli/parser.d.ts.map +1 -1
  39. package/dist/cli/parser.js +89 -65
  40. package/dist/cli/parser.js.map +1 -1
  41. package/dist/cli/shell.d.ts.map +1 -1
  42. package/dist/cli/shell.js +30 -3
  43. package/dist/cli/shell.js.map +1 -1
  44. package/dist/core/mcp-client.d.ts +17 -3
  45. package/dist/core/mcp-client.d.ts.map +1 -1
  46. package/dist/core/mcp-client.js +236 -3
  47. package/dist/core/mcp-client.js.map +1 -1
  48. package/dist/lib/auth/keychain.d.ts.map +1 -1
  49. package/dist/lib/auth/keychain.js +3 -2
  50. package/dist/lib/auth/keychain.js.map +1 -1
  51. package/dist/lib/auth/oauth-flow.d.ts +4 -1
  52. package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
  53. package/dist/lib/auth/oauth-flow.js +108 -16
  54. package/dist/lib/auth/oauth-flow.js.map +1 -1
  55. package/dist/lib/auth/oauth-provider.d.ts +5 -0
  56. package/dist/lib/auth/oauth-provider.d.ts.map +1 -1
  57. package/dist/lib/auth/oauth-provider.js +16 -1
  58. package/dist/lib/auth/oauth-provider.js.map +1 -1
  59. package/dist/lib/bridge-client.d.ts +1 -1
  60. package/dist/lib/bridge-client.d.ts.map +1 -1
  61. package/dist/lib/bridge-client.js +18 -4
  62. package/dist/lib/bridge-client.js.map +1 -1
  63. package/dist/lib/bridge-manager.d.ts +1 -0
  64. package/dist/lib/bridge-manager.d.ts.map +1 -1
  65. package/dist/lib/bridge-manager.js +39 -17
  66. package/dist/lib/bridge-manager.js.map +1 -1
  67. package/dist/lib/errors.js +2 -2
  68. package/dist/lib/errors.js.map +1 -1
  69. package/dist/lib/file-lock.d.ts.map +1 -1
  70. package/dist/lib/file-lock.js +4 -2
  71. package/dist/lib/file-lock.js.map +1 -1
  72. package/dist/lib/session-client.d.ts +16 -3
  73. package/dist/lib/session-client.d.ts.map +1 -1
  74. package/dist/lib/session-client.js +121 -15
  75. package/dist/lib/session-client.js.map +1 -1
  76. package/dist/lib/sessions.d.ts.map +1 -1
  77. package/dist/lib/sessions.js +9 -4
  78. package/dist/lib/sessions.js.map +1 -1
  79. package/dist/lib/types.d.ts +37 -6
  80. package/dist/lib/types.d.ts.map +1 -1
  81. package/dist/lib/types.js +2 -0
  82. package/dist/lib/types.js.map +1 -1
  83. package/dist/lib/utils.d.ts +0 -2
  84. package/dist/lib/utils.d.ts.map +1 -1
  85. package/dist/lib/utils.js +1 -19
  86. package/dist/lib/utils.js.map +1 -1
  87. package/dist/lib/x402/fetch-middleware.d.ts.map +1 -1
  88. package/dist/lib/x402/fetch-middleware.js +41 -8
  89. package/dist/lib/x402/fetch-middleware.js.map +1 -1
  90. package/docs/TODOs.md +87 -26
  91. package/package.json +2 -2
  92. package/renovate.json +2 -1
package/README.md CHANGED
@@ -84,21 +84,21 @@ dbus-run-session -- bash -c "echo -n 'password' | gnome-keyring-daemon --unlock
84
84
  mcpc
85
85
 
86
86
  # Login to remote MCP server and save OAuth credentials for future use
87
- mcpc mcp.apify.com login
87
+ mcpc login mcp.apify.com
88
88
 
89
- # Show information about a remote MCP server
90
- mcpc mcp.apify.com
91
-
92
- # Use JSON mode for scripting
93
- mcpc mcp.apify.com tools-list --json
94
-
95
- # Create and use persistent MCP session
96
- mcpc mcp.apify.com connect @test
89
+ # Create a persistent session and interact with it
90
+ mcpc connect mcp.apify.com @test
91
+ mcpc @test # show server info
92
+ mcpc @test tools-list
97
93
  mcpc @test tools-call search-actors keywords:="website crawler"
98
94
  mcpc @test shell
99
95
 
100
- # Interact with a local MCP server package (stdio) referenced from config file
101
- mcpc --config ~/.vscode/mcp.json filesystem tools-list
96
+ # Use JSON mode for scripting
97
+ mcpc --json @test tools-list
98
+
99
+ # Use a local MCP server package (stdio) referenced from config file
100
+ mcpc connect ./.vscode/mcp.json:filesystem @fs
101
+ mcpc @fs tools-list
102
102
  ```
103
103
 
104
104
  ## Usage
@@ -106,68 +106,56 @@ mcpc --config ~/.vscode/mcp.json filesystem tools-list
106
106
  <!-- AUTO-GENERATED: mcpc --help -->
107
107
 
108
108
  ```
109
- Usage: mcpc [options] <target> [command]
109
+ Usage: mcpc [options] [<@session>] [<command>]
110
110
 
111
111
  Universal command-line client for the Model Context Protocol (MCP).
112
112
 
113
113
  Options:
114
- -j, --json Output in JSON format for scripting
115
- -c, --config <file> Path to MCP config JSON file (e.g. ".vscode/mcp.json")
116
- -H, --header <header> HTTP header for remote MCP server (can be repeated)
117
- -v, --version Output the version number
118
- --verbose Enable debug logging
119
- --profile <name> OAuth profile for the server ("default" if not provided)
120
- --schema <file> Validate tool/prompt schema against expected schema
121
- --schema-mode <mode> Schema validation mode: strict, compatible (default), ignore
122
- --timeout <seconds> Request timeout in seconds (default: 300)
123
- --proxy <[host:]port> Start proxy MCP server for session (with "connect" command)
124
- --proxy-bearer-token <token> Require authentication for access to proxy server
125
- --x402 Enable x402 auto-payment using the configured wallet
126
- --clean[=types] Clean up mcpc data (types: sessions, logs, profiles, all)
127
- -h, --help Display general help
128
-
129
- Targets:
130
- @<session> Named persistent session (e.g. "@apify")
131
- <config-entry> Entry in MCP config file specified by --config (e.g. "fs")
132
- <server-url> Remote MCP server URL (e.g. "mcp.apify.com")
133
-
134
- Management commands:
135
- login Create OAuth profile with credentials for remote server
136
- logout Remove OAuth profile for remote server
137
- connect @<session> Connect to server and create named persistent session
138
- restart Kill and restart a session
139
- close Close a session
140
-
141
- MCP server commands:
142
- help Show server info ("help" can be omitted)
143
- shell Open interactive shell
144
- tools-list [--full] Send "tools/list" MCP request...
145
- tools-get <tool-name>
146
- tools-call <tool-name> [arg1:=val1 arg2:=val2 ... | <args-json> | <stdin]
147
- prompts-list
148
- prompts-get <prompt-name> [arg1:=val1 arg2:=val2 ... | <args-json> | <stdin]
149
- resources
150
- resources-list
151
- resources-read <uri>
152
- resources-subscribe <uri>
153
- resources-unsubscribe <uri>
154
- resources-templates-list
155
- logging-set-level <level>
156
- ping
157
-
158
- x402 payment commands (no target needed):
159
- x402 init Create a new x402 wallet
160
- x402 import <key> Import wallet from private key
161
- x402 info Show wallet info
162
- x402 sign -r <base64> Sign payment from PAYMENT-REQUIRED header
163
- x402 remove Remove the wallet
164
-
165
- Run "mcpc" without <target> to show available sessions and profiles.
114
+ -j, --json Output in JSON format for scripting
115
+ --verbose Enable debug logging
116
+ --profile <name> OAuth profile for the server ("default" if not provided)
117
+ --schema <file> Validate tool/prompt schema against expected schema
118
+ --schema-mode <mode> Schema validation mode: strict, compatible (default), ignore
119
+ --timeout <seconds> Request timeout in seconds (default: 300)
120
+ --insecure Skip TLS certificate verification (for self-signed certs)
121
+ -v, --version Output the version number
122
+ -h, --help Display help
123
+
124
+ Commands:
125
+ connect <server> <@session> Connect to an MCP server and start a new named @session
126
+ close <@session> Close a session
127
+ restart <@session> Restart a session (losing all state)
128
+ shell <@session> Open interactive shell for a session
129
+ login <server> Interactively login to a server using OAuth and save profile
130
+ logout <server> Delete an authentication profile for a server
131
+ clean [resources...] Clean up mcpc data (sessions, profiles, logs, all)
132
+ x402 [subcommand] [args...] Configure an x402 payment wallet (EXPERIMENTAL)
133
+ help [command] [subcommand] Show help for a specific command
134
+
135
+ MCP session commands (after connecting):
136
+ <@session> Show MCP server info and capabilities
137
+ <@session> tools-list List MCP tools
138
+ <@session> tools-get <name>
139
+ <@session> tools-call <name> [arg:=val ... | <json> | <stdin]
140
+ <@session> prompts-list
141
+ <@session> prompts-get <name> [arg:=val ... | <json> | <stdin]
142
+ <@session> resources-list
143
+ <@session> resources-read <uri>
144
+ <@session> resources-subscribe <uri>
145
+ <@session> resources-unsubscribe <uri>
146
+ <@session> resources-templates-list
147
+ <@session> tasks-list
148
+ <@session> tasks-get <taskId>
149
+ <@session> tasks-cancel <taskId>
150
+ <@session> logging-set-level <level>
151
+ <@session> ping
152
+
153
+ Run "mcpc" without arguments to show active sessions and OAuth profiles.
166
154
  ```
167
155
 
168
156
  ### General actions
169
157
 
170
- When `<target>` is omitted, `mcpc` provides general actions:
158
+ With no arguments, `mcpc` lists all active sessions and saved OAuth profiles:
171
159
 
172
160
  ```bash
173
161
  # List all sessions and OAuth profiles (also in JSON mode)
@@ -178,46 +166,31 @@ mcpc --json
178
166
  mcpc --help
179
167
  mcpc --version
180
168
 
181
- # Clean expired sessions and old log files (see below for details)
182
- mcpc --clean
169
+ # Clean stale sessions and old log files
170
+ mcpc clean
183
171
  ```
184
172
 
185
- ### Targets
173
+ ### Server formats
186
174
 
187
- To connect and interact with an MCP server, you need to specify a `<target>`, which can be one of (in this order of precedence):
175
+ The `connect`, `login`, and `logout` commands accept a `<server>` argument in these formats:
188
176
 
189
- - **Entry in a config file** (e.g. `--config .vscode/mcp.json filesystem`) - see [Config file](#mcp-server-config-file)
190
- - **Remote MCP server URL** (e.g. `https://mcp.apify.com`)
191
- - **Named session** (e.g. `@apify`) - see [Sessions](#sessions)
192
-
193
- `mcpc` automatically selects the transport protocol based on the server (stdio or Streamable HTTP),
194
- connects, and enables you to interact with it.
195
-
196
- **URL handling:**
197
-
198
- - URLs without a scheme (e.g. `mcp.apify.com`) default to `https://`
199
- - `localhost` and `127.0.0.1` addresses without a scheme default to `http://` (for local dev/proxy servers)
200
- - To override the default, specify the scheme explicitly (e.g. `http://example.com`)
177
+ - **Remote URL** (e.g. `mcp.apify.com` or `https://mcp.apify.com`) scheme defaults to `https://`
178
+ - **Config file entry** (e.g. `~/.vscode/mcp.json:filesystem`) — `file:entry-name` syntax
201
179
 
202
180
  ### MCP commands
203
181
 
204
- When `<target>` is provided, `mcpc` sends MCP requests to the target server:
182
+ All MCP commands go through a named session created with `connect`:
205
183
 
206
184
  ```bash
207
- # Server from config file (stdio)
208
- mcpc --config .vscode/mcp.json fileSystem
209
- mcpc --config .vscode/mcp.json fileSystem tools-list
210
- mcpc --config .vscode/mcp.json fileSystem tools-call list_directory path:=/
211
-
212
- # Remote server (Streamable HTTP)
213
- mcpc mcp.apify.com\?tools=docs
214
- mcpc mcp.apify.com\?tools=docs tools-list
215
- mcpc mcp.apify.com\?tools=docs tools-call search-apify-docs query:="What are Actors?"
216
-
217
- # Session
218
- mcpc mcp.apify.com\?tools=docs connect @apify
185
+ # Connect to a remote server and create a session
186
+ mcpc connect mcp.apify.com @apify
219
187
  mcpc @apify tools-list
220
188
  mcpc @apify tools-call search-apify-docs query:="What are Actors?"
189
+
190
+ # Connect to a local server via config file entry
191
+ mcpc connect ~/.vscode/mcp.json:filesystem @fs
192
+ mcpc @fs tools-list
193
+ mcpc @fs tools-call list_directory path:=/
221
194
  ```
222
195
 
223
196
  See [MCP feature support](#mcp-feature-support) for details about all supported MCP features and commands.
@@ -228,18 +201,18 @@ The `tools-call` and `prompts-get` commands accept arguments as positional param
228
201
 
229
202
  ```bash
230
203
  # Key:=value pairs (auto-parsed: tries JSON, falls back to string)
231
- mcpc <target> tools-call <tool-name> greeting:="hello world" count:=10 enabled:=true
232
- mcpc <target> tools-call <tool-name> config:='{"key":"value"}' items:='[1,2,3]'
204
+ mcpc @session tools-call <tool-name> greeting:="hello world" count:=10 enabled:=true
205
+ mcpc @session tools-call <tool-name> config:='{"key":"value"}' items:='[1,2,3]'
233
206
 
234
207
  # Force string type with JSON quotes
235
- mcpc <target> tools-call <tool-name> id:='"123"' flag:='"true"'
208
+ mcpc @session tools-call <tool-name> id:='"123"' flag:='"true"'
236
209
 
237
210
  # Inline JSON object (if first arg starts with { or [)
238
- mcpc <target> tools-call <tool-name> '{"greeting":"hello world","count":10}'
211
+ mcpc @session tools-call <tool-name> '{"greeting":"hello world","count":10}'
239
212
 
240
213
  # Read from stdin (automatic when no positional args and input is piped)
241
- echo '{"greeting":"hello","count":10}' | mcpc <target> tools-call <tool-name>
242
- cat args.json | mcpc <target> tools-call <tool-name>
214
+ echo '{"greeting":"hello","count":10}' | mcpc @session tools-call <tool-name>
215
+ cat args.json | mcpc @session tools-call <tool-name>
243
216
  ```
244
217
 
245
218
  **Rules:**
@@ -286,8 +259,7 @@ mcpc @server tools-call search "query:=hello world"
286
259
  `mcpc` provides an interactive shell for discovery and testing of MCP servers.
287
260
 
288
261
  ```bash
289
- mcpc mcp.apify.com shell # Direct connection
290
- mcpc @apify shell # Use existing session
262
+ mcpc @apify shell
291
263
  ```
292
264
 
293
265
  Shell commands: `help`, `exit`/`quit`/Ctrl+D, Ctrl+C to cancel.
@@ -317,7 +289,7 @@ which then serve as unique reference in commands.
317
289
 
318
290
  ```bash
319
291
  # Create a persistent session
320
- mcpc mcp.apify.com\?tools=docs connect @apify
292
+ mcpc connect mcp.apify.com @apify
321
293
 
322
294
  # List all sessions and OAuth profiles
323
295
  mcpc
@@ -327,10 +299,10 @@ mcpc @apify tools-list
327
299
  mcpc @apify shell
328
300
 
329
301
  # Restart the session (kills and restarts the bridge process)
330
- mcpc @apify restart
302
+ mcpc @apify restart # or: mcpc restart @apify
331
303
 
332
304
  # Close the session, terminates bridge process
333
- mcpc @apify close
305
+ mcpc @apify close # or: mcpc close @apify
334
306
 
335
307
  # ...now session name "@apify" is forgotten and available for future use
336
308
  ```
@@ -344,41 +316,46 @@ Still, sessions can fail due to network disconnects, bridge process crash, or se
344
316
 
345
317
  **Session states:**
346
318
 
347
- | State | Meaning |
348
- | ---------------- | --------------------------------------------------------------------------------------------- |
349
- | 🟢 **`live`** | Bridge process is running; server might or might not be operational |
350
- | 🟡 **`crashed`** | Bridge process crashed or was killed; will auto-restart on next use |
351
- | 🔴 **`expired`** | Server rejected the session (auth failed, session ID invalid); requires `close` and reconnect |
319
+ | State | Meaning |
320
+ | --------------------- | ------------------------------------------------------------------------------------------------- |
321
+ | 🟢 **`live`** | Bridge process running and server responding |
322
+ | 🟡 **`disconnected`** | Bridge process running but server unreachable; auto-recovers when server responds |
323
+ | 🟡 **`crashed`** | Bridge process crashed or was killed; auto-restarts on next use |
324
+ | 🔴 **`unauthorized`** | Server rejected authentication (401/403) or token refresh failed; requires `login` then `restart` |
325
+ | 🔴 **`expired`** | Server rejected session ID (404); requires `restart` |
352
326
 
353
327
  Here's how `mcpc` handles various bridge process and server connection states:
354
328
 
355
329
  - While the **bridge process is running**:
356
330
  - If **server positively responds** to pings, the session is marked 🟢 **`live`**, and everything is fine.
357
- - If **server stops responding**, the bridge will keep trying to reconnect in the background.
358
- - If **server negatively responds** to indicate `MCP-Session-Id` is no longer valid
359
- or authentication permanently failed (HTTP 401 or 403),
360
- the bridge process will flag the session as 🔴 **`expired`** and **terminate** to avoid wasting resources.
361
- Any future attempt to use the session (`mcpc @my-session ...`) will fail.
331
+ - If **server stops responding**, the session is marked 🟡 **`disconnected`**.
332
+ The bridge will keep trying to reconnect in the background and will return to 🟢 **`live`** once the server responds again.
333
+ - If **server rejects authentication** (HTTP 401 or 403) or token refresh fails,
334
+ the session is marked 🔴 **`unauthorized`**.
335
+ You need to re-authenticate with `mcpc login <server>` and then `mcpc @my-session restart`.
336
+ - If **server rejects the session ID** (HTTP 404), indicating the MCP session is no longer valid,
337
+ the session is marked 🔴 **`expired`**.
338
+ You need to restart the session with `mcpc @my-session restart` to establish a new connection.
362
339
  - If the **bridge process crashes**, `mcpc` will mark the session as 🟡 **`crashed`** on first use.
363
340
  Next time you run `mcpc @my-session ...`, it will attempt to restart the bridge process.
364
341
  - If bridge **restart succeeds**, everything starts again (see above).
365
342
  - If bridge **restart fails**, `mcpc @my-session ...` returns error, and session remains marked 🟡 **`crashed`**.
366
343
 
367
344
  Note that `mcpc` never automatically removes sessions from the list.
368
- Instead, it keeps them flagged as 🟡 **`crashed`** or 🔴 **`expired`**,
369
- and any future attempts to use them will fail.
345
+ Instead, it keeps them flagged as 🟡 **`crashed`**, 🔴 **`unauthorized`**, or 🔴 **`expired`**,
346
+ and any future attempts to use them will show the appropriate error with recovery instructions.
370
347
 
371
348
  To **remove the session from the list**, you need to explicitly close it:
372
349
 
373
350
  ```bash
374
- mcpc @apify close
351
+ mcpc @apify close # or: mcpc close @apify
375
352
  ```
376
353
 
377
354
  You can restart a session anytime, which kills the bridge process
378
355
  and opens new connection with new `MCP-Session-Id`, by running:
379
356
 
380
357
  ```bash
381
- mcpc @apify restart
358
+ mcpc @apify restart # or: mcpc restart @apify
382
359
  ```
383
360
 
384
361
  ## Authentication
@@ -391,11 +368,7 @@ For local servers (stdio) or remote servers (Streamable HTTP) which do not requi
391
368
  `mcpc` can be used without authentication:
392
369
 
393
370
  ```bash
394
- # One-shot command
395
- mcpc mcp.apify.com\?tools=docs tools-list
396
-
397
- # Session command
398
- mcpc mcp.apify.com\?tools=docs connect @test
371
+ mcpc connect mcp.apify.com @test
399
372
  mcpc @test tools-list
400
373
  ```
401
374
 
@@ -407,11 +380,8 @@ All headers are stored securely in the OS keychain for the session, but they are
407
380
  running a one-shot command or connecting new session.
408
381
 
409
382
  ```bash
410
- # One-time command with Bearer token
411
- mcpc --header "Authorization: Bearer ${APIFY_TOKEN}" https://mcp.apify.com tools-list
412
-
413
- # Create session with Bearer token (saved to keychain for this session only)
414
- mcpc --header "Authorization: Bearer ${APIFY_TOKEN}" https://mcp.apify.com connect @apify
383
+ # Create session with Bearer token (token saved to keychain for this session only)
384
+ mcpc connect https://mcp.apify.com @apify --header "Authorization: Bearer ${APIFY_TOKEN}"
415
385
 
416
386
  # Use the session (Bearer token is loaded from keychain automatically)
417
387
  mcpc @apify tools-list
@@ -443,25 +413,25 @@ Key concepts:
443
413
 
444
414
  ```bash
445
415
  # Login to server and save 'default' authentication profile for future use
446
- mcpc mcp.apify.com login
416
+ mcpc login mcp.apify.com
447
417
 
448
418
  # Use named authentication profile instead of 'default'
449
- mcpc mcp.apify.com login --profile work
419
+ mcpc login mcp.apify.com --profile work
450
420
 
451
421
  # Create two sessions using the two different credentials
452
- mcpc https://mcp.apify.com connect @apify-personal
453
- mcpc https://mcp.apify.com connect @apify-work --profile work
422
+ mcpc connect mcp.apify.com @apify-personal
423
+ mcpc connect mcp.apify.com @apify-work --profile work
454
424
 
455
425
  # Both sessions now work independently
456
426
  mcpc @apify-personal tools-list # Uses personal account
457
427
  mcpc @apify-work tools-list # Uses work account
458
428
 
459
429
  # Re-authenticate existing profile (e.g., to refresh or change scopes)
460
- mcpc mcp.apify.com login --profile work
430
+ mcpc login mcp.apify.com --profile work
461
431
 
462
432
  # Delete "default" and "work" authentication profiles
463
- mcpc mcp.apify.com logout
464
- mcpc mcp.apify.com logout --profile work
433
+ mcpc logout mcp.apify.com
434
+ mcpc logout mcp.apify.com --profile work
465
435
  ```
466
436
 
467
437
  ### Authentication precedence
@@ -473,7 +443,16 @@ When multiple authentication methods are available, `mcpc` uses this precedence
473
443
  3. **Config file headers** - Headers from `--config` file for the server
474
444
  4. **No authentication** - Attempts unauthenticated connection
475
445
 
476
- `mcpc` automatically handles authentication based on whether you specify a profile:
446
+ **Note:** `--profile` and `--header "Authorization: ..."` cannot be combined they are mutually
447
+ exclusive. Providing both will result in a clear error. Use one or the other.
448
+
449
+ `mcpc` automatically handles authentication based on what you specify:
450
+
451
+ **When `--header "Authorization: ..."` is provided:**
452
+
453
+ - The explicit header is always used, and OAuth profile auto-detection is skipped entirely
454
+ - This works even if a `default` profile exists for the server
455
+ - Cannot be combined with `--profile` (returns an error)
477
456
 
478
457
  **When `--profile <name>` is specified:**
479
458
 
@@ -482,7 +461,13 @@ When multiple authentication methods are available, `mcpc` uses this precedence
482
461
  - If authentication fails (expired/invalid) → Fail with an error
483
462
  2. **Profile doesn't exist**: Fail with an error
484
463
 
485
- **When no `--profile` is specified:**
464
+ **When `--no-profile` is specified:**
465
+
466
+ - Skip all OAuth profile detection and connect anonymously
467
+ - Useful when a `default` profile exists but you want an unauthenticated session
468
+ - Can be combined with `--header "Authorization: ..."` for explicit bearer token without profile
469
+
470
+ **When no flags are specified (default):**
486
471
 
487
472
  1. **`default` profile exists for the server**: Use its stored credentials
488
473
  - If authentication succeeds → Continue with command/session
@@ -495,7 +480,7 @@ On failure, the error message includes instructions on how to login and save the
495
480
 
496
481
  This flow ensures:
497
482
 
498
- - You only authenticate when necessary
483
+ - Explicit CLI flags always take precedence over stored profiles
499
484
  - Credentials are never silently mixed up (personal → work) or downgraded (authenticated → unauthenticated)
500
485
  - You can mix authenticated sessions (with named profiles) and public access on the same server
501
486
 
@@ -505,16 +490,19 @@ This flow ensures:
505
490
  # With specific profile - always authenticated:
506
491
  # - Uses 'work' if it exists
507
492
  # - Fails if it doesn't exist
508
- mcpc mcp.apify.com connect @apify-work --profile work
493
+ mcpc connect mcp.apify.com @apify-work --profile work
509
494
 
510
495
  # Without profile - opportunistic authentication:
511
496
  # - Uses 'default' if it exists
512
497
  # - Tries unauthenticated if 'default' doesn't exist
513
498
  # - Fails if the server requires authentication
514
- mcpc mcp.apify.com connect @apify-personal
499
+ mcpc connect mcp.apify.com @apify-personal
500
+
501
+ # Explicit bearer token - skips profile auto-detection:
502
+ mcpc connect mcp.apify.com @apify --header "Authorization: Bearer ${APIFY_TOKEN}"
515
503
 
516
- # Public server - no authentication needed:
517
- mcpc mcp.apify.com\?tools=docs tools-list
504
+ # Anonymous - skips default profile even if it exists:
505
+ mcpc connect mcp.apify.com @apify-anon --no-profile
518
506
  ```
519
507
 
520
508
  ## MCP proxy
@@ -526,25 +514,21 @@ See also [AI sandboxes](#ai-sandboxes).
526
514
 
527
515
  ```bash
528
516
  # Human authenticates to a remote server
529
- mcpc mcp.apify.com login
517
+ mcpc login mcp.apify.com
530
518
 
531
519
  # Create authenticated session with proxy server on localhost:8080
532
- mcpc mcp.apify.com connect @open-relay --proxy 8080
520
+ mcpc connect mcp.apify.com @open-relay --proxy 8080
533
521
 
534
522
  # Now any MCP client can connect to proxy like to a regular MCP server
535
523
  # The client has NO access to the original OAuth tokens or HTTP headers
536
524
  # Note: localhost/127.0.0.1 URLs default to http:// (no scheme needed)
537
- mcpc localhost:8080 tools-list
538
- mcpc 127.0.0.1:8080 tools-call search-actors keywords:="web scraper"
539
-
540
- # Or create a new session from the proxy for convenience
541
- mcpc localhost:8080 connect @sandboxed
525
+ mcpc connect localhost:8080 @sandboxed
542
526
  mcpc @sandboxed tools-call search-actors keywords:="web scraper"
543
527
 
544
528
  # Optionally protect proxy with bearer token for better security (stored in OS keychain)
545
- mcpc mcp.apify.com connect @secure-relay --proxy 8081 --proxy-bearer-token secret123
529
+ mcpc connect mcp.apify.com @secure-relay --proxy 8081 --proxy-bearer-token secret123
546
530
  # To use the proxy, caller needs to pass the bearer token in HTTP header
547
- mcpc localhost:8081 connect @sandboxed2 --header "Authorization: Bearer secret123"
531
+ mcpc connect localhost:8081 @sandboxed2 --header "Authorization: Bearer secret123"
548
532
  ```
549
533
 
550
534
  **Proxy options for `connect` command:**
@@ -565,13 +549,13 @@ mcpc localhost:8081 connect @sandboxed2 --header "Authorization: Bearer secret12
565
549
 
566
550
  ```bash
567
551
  # Localhost only (default, most secure)
568
- mcpc mcp.apify.com connect @relay --proxy 8080
552
+ mcpc connect mcp.apify.com @relay --proxy 8080
569
553
 
570
554
  # Bind to all interfaces (allows network access - use with caution!)
571
- mcpc mcp.apify.com connect @relay --proxy 0.0.0.0:8080
555
+ mcpc connect mcp.apify.com @relay --proxy 0.0.0.0:8080
572
556
 
573
557
  # Bind to specific interface
574
- mcpc mcp.apify.com connect @relay --proxy 192.168.1.100:8080
558
+ mcpc connect mcp.apify.com @relay --proxy 192.168.1.100:8080
575
559
  ```
576
560
 
577
561
  When listing sessions, proxy info is displayed prominently:
@@ -664,8 +648,8 @@ it's always a good idea to run them in a code sandbox with limited access to you
664
648
 
665
649
  The [proxy MCP server](#mcp-proxy) feature provides a security boundary for AI agents:
666
650
 
667
- 1. **Human creates authentication profile**: `mcpc mcp.apify.com login --profile ai-access`
668
- 2. **Human creates session**: `mcpc mcp.apify.com connect @ai-sandbox --profile ai-access --proxy 8080`
651
+ 1. **Human creates authentication profile**: `mcpc login mcp.apify.com --profile ai-access`
652
+ 2. **Human creates session**: `mcpc connect mcp.apify.com @ai-sandbox --profile ai-access --proxy 8080`
669
653
  3. **AI runs inside a sandbox**: If sandbox has access limited to `localhost:8080`,
670
654
  it can only interact with the MCP server through the `@ai-sandbox` session,
671
655
  without access to the original OAuth credentials, HTTP headers, or `mcpc` configuration.
@@ -726,13 +710,42 @@ mcpc x402 remove
726
710
 
727
711
  After creating a wallet, **fund it with USDC on Base** (mainnet or Sepolia testnet) to enable payments.
728
712
 
713
+ ### Manual payment signing
714
+
715
+ You can manually sign a payment from a server's `PAYMENT-REQUIRED` header using `x402 sign`.
716
+ This is useful for pre-signing payments or integrating with tools outside of `mcpc`.
717
+
718
+ ```bash
719
+ # Sign a payment using the base64-encoded PAYMENT-REQUIRED header
720
+ mcpc x402 sign <base64-payment-required>
721
+
722
+ # Override the amount (in USD, e.g. 2.50 = $2.50)
723
+ mcpc x402 sign <base64-payment-required> --amount 2.50
724
+
725
+ # Override the expiry (in seconds from now)
726
+ mcpc x402 sign <base64-payment-required> --expiry 7200
727
+
728
+ # Combine overrides and use JSON output
729
+ mcpc x402 sign <base64-payment-required> --amount 1.00 --expiry 3600 --json
730
+ ```
731
+
732
+ **Options:**
733
+
734
+ | Option | Description |
735
+ | ------------------- | ---------------------------------------------------------------- |
736
+ | `--amount <usd>` | Override the payment amount in USD (e.g. `0.50` for $0.50) |
737
+ | `--expiry <seconds>`| Override the payment expiry in seconds from now (e.g. `3600`) |
738
+
739
+ The command outputs the signed `PAYMENT-SIGNATURE` header value and an MCP config snippet
740
+ that can be used directly with other MCP clients.
741
+
729
742
  ### Using x402 with MCP servers
730
743
 
731
744
  Pass the `--x402` flag when connecting to a session or running direct commands:
732
745
 
733
746
  ```bash
734
747
  # Create a session with x402 payment support
735
- mcpc mcp.apify.com connect @apify --x402
748
+ mcpc connect mcp.apify.com @apify --x402
736
749
 
737
750
  # The session now automatically handles 402 responses
738
751
  mcpc @apify tools-call expensive-tool query:="hello"
@@ -904,7 +917,7 @@ When connected via a [session](#sessions), `mcpc` automatically handles `list_ch
904
917
  notifications for tools, resources, and prompts.
905
918
  The bridge process tracks when each notification type was last received.
906
919
  In [shell mode](#interactive-shell), notifications are displayed in real-time.
907
- The timestamps are available in JSON output of `mcpc <target> --json` under the `_mcpc.notifications`
920
+ The timestamps are available in JSON output of `mcpc @session --json` under the `_mcpc.notifications`
908
921
  field - see [Server instructions](#server-instructions).
909
922
 
910
923
  #### Server logs
@@ -958,14 +971,12 @@ You can configure `mcpc` using a config file, environment variables, or command-
958
971
 
959
972
  `mcpc` supports the ["standard"](https://gofastmcp.com/integrations/mcp-json-configuration)
960
973
  MCP server JSON config file, compatible with Claude Desktop, VS Code, and other MCP clients.
961
- You can point to an existing config file with `--config`:
974
+ Use the `file:entry` syntax to reference a server from a config file:
962
975
 
963
976
  ```bash
964
- # One-shot command to an MCP server configured in Visual Studio Code
965
- mcpc --config .vscode/mcp.json apify tools-list
966
-
967
- # Open a session to a server specified in the custom config file
968
- mcpc --config .vscode/mcp.json apify connect @my-apify
977
+ # Open a session to a server specified in the Visual Studio Code config
978
+ mcpc connect .vscode/mcp.json:apify @my-apify
979
+ mcpc @my-apify tools-list
969
980
  ```
970
981
 
971
982
  **Example MCP config JSON file:**
@@ -1010,14 +1021,12 @@ For **stdio servers:**
1010
1021
 
1011
1022
  **Using servers from config file:**
1012
1023
 
1013
- When `--config` is provided, you can reference servers by name:
1024
+ Reference servers by their name using the `file:entry` syntax:
1014
1025
 
1015
1026
  ```bash
1016
- # With config file, use server names directly
1017
- mcpc --config .vscode/mcp.json filesystem tools-list
1018
-
1019
- # Create a named session from server in config
1020
- mcpc --config .vscode/mcp.json filesystem connect @fs
1027
+ # Create a named session from a server in the config
1028
+ mcpc connect .vscode/mcp.json:filesystem @fs
1029
+ mcpc @fs tools-list
1021
1030
  mcpc @fs tools-call search
1022
1031
  ```
1023
1032
 
@@ -1060,20 +1069,19 @@ Config files support environment variable substitution using `${VAR_NAME}` synta
1060
1069
 
1061
1070
  ### Cleanup
1062
1071
 
1063
- You can clean up the `mcpc` state and data using the `--clean` option:
1072
+ You can clean up the `mcpc` state and data using the `clean` command:
1064
1073
 
1065
1074
  ```bash
1066
1075
  # Safe non-destructive cleanup: remove expired sessions, delete old orphaned logs
1067
- mcpc --clean
1076
+ mcpc clean
1068
1077
 
1069
- # Clean specific resources (comma-separated)
1070
- mcpc --clean=sessions # Kill bridges, delete all sessions
1071
- mcpc --clean=profiles # Delete all authentication profiles
1072
- mcpc --clean=logs # Delete all log files
1073
- mcpc --clean=sessions,logs # Clean multiple resource types
1078
+ # Clean specific resources
1079
+ mcpc clean sessions # Kill bridges, delete all sessions
1080
+ mcpc clean profiles # Delete all authentication profiles
1081
+ mcpc clean logs # Delete all log files
1074
1082
 
1075
1083
  # Nuclear option: remove everything
1076
- mcpc --clean=all # Delete all sessions, profiles, logs, and sockets
1084
+ mcpc clean all # Delete all sessions, profiles, logs, and sockets
1077
1085
  ```
1078
1086
 
1079
1087
  ## Security
@@ -1152,12 +1160,12 @@ The main `mcpc` process doesn't save log files, but supports [verbose mode](#ver
1152
1160
  **"Session not found"**
1153
1161
 
1154
1162
  - List existing sessions: `mcpc`
1155
- - Create new session if expired: `mcpc @<session-name> close` and `mcpc <target> connect @<session-name>`
1163
+ - Create new session if expired: `mcpc @<session-name> close` and `mcpc connect <server> @<session-name>`
1156
1164
 
1157
1165
  **"Authentication failed"**
1158
1166
 
1159
1167
  - List saved OAuth profiles: `mcpc`
1160
- - Re-authenticate: `mcpc <server> login [--profile <name>]`
1168
+ - Re-authenticate: `mcpc login <server> [--profile <name>]`
1161
1169
  - For bearer tokens: provide `--header "Authorization: Bearer ${TOKEN}"` again
1162
1170
 
1163
1171
  ## Development
@@ -1169,26 +1177,48 @@ See [CONTRIBUTING](./CONTRIBUTING.md) for development setup, architecture overvi
1169
1177
 
1170
1178
  ## Related work
1171
1179
 
1172
- - MCP CLI clients
1173
- - https://github.com/chrishayuk/mcp-cli
1174
- - https://github.com/wong2/mcp-cli
1175
- - https://github.com/f/mcptools
1176
- - https://github.com/adhikasp/mcp-client-cli
1177
- - https://github.com/mattzcarey/cloudflare-mcp
1178
- - https://github.com/thellimist/clihub (see https://news.ycombinator.com/item?id=47157398)
1179
- - https://github.com/EstebanForge/mcp-cli-ent
1180
- - https://github.com/assimelha/cmcp
1181
- - Code mode
1182
- - https://blog.cloudflare.com/code-mode/
1183
- - https://www.anthropic.com/engineering/code-execution-with-mcp
1184
- - https://github.com/steipete/mcporter
1185
- - Dynamic tool discovery
1186
- - https://www.anthropic.com/engineering/advanced-tool-use
1187
- - https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool
1188
- - https://cursor.com/blog/dynamic-context-discovery
1189
- - https://github.com/philschmid/mcp-cli (https://www.philschmid.de/mcp-cli)
1190
- - Other
1191
- - https://github.com/TeamSparkAI/mcpGraph
1180
+ ### MCP CLI clients
1181
+
1182
+ <!-- Stars and activity as of March 2026. -->
1183
+
1184
+ | Tool | Lang | Stars | Active | Tools | Resources | Prompts | Code mode | Sessions | OAuth | Stdio | HTTP | Tool search | LLM |
1185
+ | ----------------------------------------------------------------------- | ------ | ----: | ------ | ----- | --------- | ------- | --------- | -------- | ----- | ----- | ---- | ----------- | --- |
1186
+ | **[apify/mcpc](https://github.com/apify/mcpc)** | TS | ~350 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — |
1187
+ | [steipete/mcporter](https://github.com/steipete/mcporter) | TS | ~2.6k | ✅ | ✅ | — | — | ✅ | ✅ | ✅ | ✅ | ✅ | — | — |
1188
+ | [IBM/mcp-cli](https://github.com/IBM/mcp-cli) | Python | ~1.9k | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | ✅ |
1189
+ | [f/mcptools](https://github.com/f/mcptools) | Go | ~1.5k | ⚠️ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ | ✅ | — | — |
1190
+ | [philschmid/mcp-cli](https://github.com/philschmid/mcp-cli) | TS | ~950 | ✅ | ✅ | — | — | ✅ | ✅ | — | ✅ | ✅ | ✅ | — |
1191
+ | [adhikasp/mcp-client-cli](https://github.com/adhikasp/mcp-client-cli) | Python | ~670 | ⚠️ | ✅ | ✅ | ✅ | — | — | — | ✅ | — | — | ✅ |
1192
+ | [thellimist/clihub](https://github.com/thellimist/clihub) | Go | ~590 | ✅ | ✅ | — | — | — | — | ✅ | ✅ | ✅ | ✅ | — |
1193
+ | [wong2/mcp-cli](https://github.com/wong2/mcp-cli) | JS | ~420 | ⚠️ | ✅ | ✅ | ✅ | — | — | ✅ | — | ✅ | — | — |
1194
+ | [knowsuchagency/mcp2cli](https://github.com/knowsuchagency/mcp2cli) | Python | ~170 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — |
1195
+ | [mcpshim/mcpshim](https://github.com/mcpshim/mcpshim) | Go | ~46 | ✅ | ✅ | — | — | ✅ | ✅ | ✅ | — | ✅ | ✅ | — |
1196
+ | [EstebanForge/mcp-cli-ent](https://github.com/EstebanForge/mcp-cli-ent) | Go | ~13 | ✅ | ✅ | — | — | ✅ | ✅ | — | ✅ | ✅ | ✅ | — |
1197
+
1198
+ **Legend:** ✅ = supported, ⚠️ = stale (no commits in 3+ months), **LLM** = requires/uses an LLM.
1199
+
1200
+ **Notes:**
1201
+
1202
+ - [thellimist/clihub](https://github.com/thellimist/clihub) is a code generator that compiles MCP tools into standalone CLI binaries, rather than a runtime client ([HN discussion](https://news.ycombinator.com/item?id=47157398)).
1203
+ - [knowsuchagency/mcp2cli](https://github.com/knowsuchagency/mcp2cli) also supports OpenAPI specs directly and uses a custom TOON encoding for token-efficient tool schemas.
1204
+ - [IBM/mcp-cli](https://github.com/IBM/mcp-cli) and [mcp-client-cli](https://github.com/adhikasp/mcp-client-cli) integrate an LLM (Ollama, OpenAI, etc.) for chat-style interaction, while the other tools are pure CLI clients.
1205
+
1206
+ ### Code mode and dynamic tool discovery
1207
+
1208
+ These resources describe the "code mode" pattern (replacing many tool definitions with `search` + `execute`) and dynamic tool discovery:
1209
+
1210
+ - [Code mode](https://www.anthropic.com/engineering/code-execution-with-mcp) - Anthropic's blog post on code execution with MCP
1211
+ - [Code mode at Cloudflare](https://blog.cloudflare.com/code-mode/) - Cloudflare's implementation of the code mode pattern
1212
+ - [Advanced tool use](https://www.anthropic.com/engineering/advanced-tool-use) - Anthropic's engineering post on tool search
1213
+ - [Claude tool search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) - Claude platform docs
1214
+ - [Dynamic context discovery](https://cursor.com/blog/dynamic-context-discovery) - Cursor's approach to dynamic tool discovery
1215
+ - [cmcp](https://github.com/assimelha/cmcp) (~27 stars, Rust) - MCP proxy aggregating servers behind `search()` + `execute()`
1216
+ - [cloudflare-mcp](https://github.com/mattzcarey/cloudflare-mcp) (~124 stars, TS) - MCP server for the Cloudflare API using code mode
1217
+ - [infinite-mcp](https://github.com/day50-dev/infinite-mcp) (Python) - Meta-MCP server that exposes 1000+ pre-indexed MCP servers via semantic search and dynamic tool discovery
1218
+
1219
+ ### Other
1220
+
1221
+ - [mcpGraph](https://github.com/TeamSparkAI/mcpGraph) - MCP server that orchestrates directed graphs of MCP tool calls
1192
1222
 
1193
1223
  ## License
1194
1224