@apify/mcpc 0.1.2 → 0.1.3

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 (94) hide show
  1. package/.claude/settings.local.json +6 -2
  2. package/.idea/workspace.xml +285 -273
  3. package/README.md +174 -82
  4. package/TODOs.md +39 -47
  5. package/dist/bridge/index.js +131 -76
  6. package/dist/bridge/index.js.map +1 -1
  7. package/dist/cli/commands/auth.js +1 -1
  8. package/dist/cli/commands/auth.js.map +1 -1
  9. package/dist/cli/commands/clean.d.ts.map +1 -1
  10. package/dist/cli/commands/clean.js +31 -56
  11. package/dist/cli/commands/clean.js.map +1 -1
  12. package/dist/cli/commands/sessions.d.ts.map +1 -1
  13. package/dist/cli/commands/sessions.js +115 -40
  14. package/dist/cli/commands/sessions.js.map +1 -1
  15. package/dist/cli/helpers.d.ts +3 -0
  16. package/dist/cli/helpers.d.ts.map +1 -1
  17. package/dist/cli/helpers.js +91 -15
  18. package/dist/cli/helpers.js.map +1 -1
  19. package/dist/cli/index.js +3 -1
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/cli/output.d.ts.map +1 -1
  22. package/dist/cli/output.js +26 -4
  23. package/dist/cli/output.js.map +1 -1
  24. package/dist/cli/shell-parser.d.ts.map +1 -1
  25. package/dist/cli/shell-parser.js.map +1 -1
  26. package/dist/cli/shell.d.ts.map +1 -1
  27. package/dist/cli/shell.js +9 -8
  28. package/dist/cli/shell.js.map +1 -1
  29. package/dist/core/factory.d.ts +2 -0
  30. package/dist/core/factory.d.ts.map +1 -1
  31. package/dist/core/factory.js +3 -1
  32. package/dist/core/factory.js.map +1 -1
  33. package/dist/core/mcp-client.d.ts.map +1 -1
  34. package/dist/core/mcp-client.js +8 -12
  35. package/dist/core/mcp-client.js.map +1 -1
  36. package/dist/core/transports.d.ts +5 -1
  37. package/dist/core/transports.d.ts.map +1 -1
  38. package/dist/core/transports.js +39 -9
  39. package/dist/core/transports.js.map +1 -1
  40. package/dist/lib/auth/keychain.d.ts.map +1 -1
  41. package/dist/lib/auth/keychain.js +5 -2
  42. package/dist/lib/auth/keychain.js.map +1 -1
  43. package/dist/lib/auth/oauth-flow.d.ts.map +1 -1
  44. package/dist/lib/auth/oauth-flow.js +11 -2
  45. package/dist/lib/auth/oauth-flow.js.map +1 -1
  46. package/dist/lib/auth/oauth-provider.d.ts +19 -8
  47. package/dist/lib/auth/oauth-provider.d.ts.map +1 -1
  48. package/dist/lib/auth/oauth-provider.js +95 -27
  49. package/dist/lib/auth/oauth-provider.js.map +1 -1
  50. package/dist/lib/auth/oauth-token-manager.d.ts +8 -0
  51. package/dist/lib/auth/oauth-token-manager.d.ts.map +1 -1
  52. package/dist/lib/auth/oauth-token-manager.js +43 -0
  53. package/dist/lib/auth/oauth-token-manager.js.map +1 -1
  54. package/dist/lib/auth/{auth-profiles.d.ts → profiles.d.ts} +2 -1
  55. package/dist/lib/auth/profiles.d.ts.map +1 -0
  56. package/dist/lib/auth/{auth-profiles.js → profiles.js} +26 -10
  57. package/dist/lib/auth/profiles.js.map +1 -0
  58. package/dist/lib/auth/token-refresh.js +1 -1
  59. package/dist/lib/auth/token-refresh.js.map +1 -1
  60. package/dist/lib/bridge-client.js.map +1 -1
  61. package/dist/lib/bridge-manager.d.ts +0 -1
  62. package/dist/lib/bridge-manager.d.ts.map +1 -1
  63. package/dist/lib/bridge-manager.js +32 -46
  64. package/dist/lib/bridge-manager.js.map +1 -1
  65. package/dist/lib/cleanup.d.ts +5 -0
  66. package/dist/lib/cleanup.d.ts.map +1 -0
  67. package/dist/lib/cleanup.js +48 -0
  68. package/dist/lib/cleanup.js.map +1 -0
  69. package/dist/lib/errors.d.ts +1 -1
  70. package/dist/lib/errors.d.ts.map +1 -1
  71. package/dist/lib/errors.js +5 -1
  72. package/dist/lib/errors.js.map +1 -1
  73. package/dist/lib/index.d.ts +1 -0
  74. package/dist/lib/index.d.ts.map +1 -1
  75. package/dist/lib/index.js +1 -0
  76. package/dist/lib/index.js.map +1 -1
  77. package/dist/lib/session-client.d.ts.map +1 -1
  78. package/dist/lib/session-client.js +7 -7
  79. package/dist/lib/session-client.js.map +1 -1
  80. package/dist/lib/sessions.d.ts +6 -1
  81. package/dist/lib/sessions.d.ts.map +1 -1
  82. package/dist/lib/sessions.js +71 -13
  83. package/dist/lib/sessions.js.map +1 -1
  84. package/dist/lib/types.d.ts +6 -3
  85. package/dist/lib/types.d.ts.map +1 -1
  86. package/dist/lib/utils.d.ts +2 -1
  87. package/dist/lib/utils.d.ts.map +1 -1
  88. package/dist/lib/utils.js +16 -3
  89. package/dist/lib/utils.js.map +1 -1
  90. package/package.json +8 -3
  91. package/dist/lib/auth/auth-profiles.d.ts.map +0 -1
  92. package/dist/lib/auth/auth-profiles.js.map +0 -1
  93. /package/{claude-skill → docs/claude-skill}/README.md +0 -0
  94. /package/{claude-skill → docs/claude-skill}/SKILL.md +0 -0
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # mcpc: Universal MCP command-line client
2
2
 
3
3
  `mcpc` is a CLI for the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/),
4
- which maps MCP requests to intuitive commands for shell access, scripts, and AI coding agents.
4
+ which maps MCP operations to intuitive commands for interactive shell use, scripts, and AI coding agents.
5
5
 
6
6
  `mcpc` can connect to any MCP server over Streamable HTTP or stdio transports,
7
7
  securely login via OAuth credentials and store credentials,
@@ -11,16 +11,86 @@ It supports all major MCP features, including tools, resources, prompts, asynchr
11
11
  `mcpc` is handy for manual testing of MCP servers, scripting,
12
12
  and AI coding agents to use MCP in ["code mode"](https://www.anthropic.com/engineering/code-execution-with-mcp),
13
13
  for better accuracy and lower token compared to traditional tool function calling.
14
- After all, UNIX-compatible shell script is THE most universal coding language, for both people and LLMs.
15
-
16
- Note that `mcpc` is deterministic and does not use any LLM on its own; that's for the higher layer to do.
14
+ After all, UNIX-compatible shell script is THE most universal coding language, for people and LLMs alike.
15
+
16
+ Note that `mcpc` is deterministic and does not use any LLM on its own; that's left for the higher layer.
17
+
18
+ <!--
19
+ ## Table of contents
20
+
21
+ TODO: Simplify README - there are too many top-level sections, and then show just the second level ones
22
+ -->
23
+
24
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
25
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
26
+ <!--
27
+ - [Features](#features)
28
+ - [Install](#install)
29
+ - [Quickstart](#quickstart)
30
+ - [Usage](#usage)
31
+ - [MCP command arguments](#mcp-command-arguments)
32
+ - [Global flags](#global-flags)
33
+ - [Authentication](#authentication)
34
+ - [No authentication](#no-authentication)
35
+ - [Bearer token authentication](#bearer-token-authentication)
36
+ - [OAuth authentication](#oauth-authentication)
37
+ - [Authentication profiles](#authentication-profiles)
38
+ - [Authentication behavior](#authentication-behavior)
39
+ - [Multiple accounts for the same server](#multiple-accounts-for-the-same-server)
40
+ - [Authentication precedence](#authentication-precedence)
41
+ - [Authentication profiles storage format](#authentication-profiles-storage-format)
42
+ - [Sessions](#sessions)
43
+ - [Managing sessions](#managing-sessions)
44
+ - [Piping between sessions](#piping-between-sessions)
45
+ - [Scripting](#scripting)
46
+ - [Session failover](#session-failover)
47
+ - [Logging](#logging)
48
+ - [Cleanup](#cleanup)
49
+ - [Configuration](#configuration)
50
+ - [MCP config JSON file](#mcp-config-json-file)
51
+ - [Environment variables](#environment-variables)
52
+ - [MCP protocol notes](#mcp-protocol-notes)
53
+ - [Output format](#output-format)
54
+ - [Human-readable (default)](#human-readable-default)
55
+ - [JSON mode (`--json`)](#json-mode---json)
56
+ - [Security](#security)
57
+ - [Credential storage](#credential-storage)
58
+ - [Bridge process authentication](#bridge-process-authentication)
59
+ - [File permissions](#file-permissions)
60
+ - [Network security](#network-security)
61
+ - [Error handling](#error-handling)
62
+ - [Exit codes](#exit-codes)
63
+ - [Retry strategy](#retry-strategy)
64
+ - [Interactive shell](#interactive-shell)
65
+ - [Claude Code skill](#claude-code-skill)
66
+ - [Troubleshooting](#troubleshooting)
67
+ - [Common issues](#common-issues)
68
+ - [Debug mode](#debug-mode)
69
+ - [Logs](#logs)
70
+ - [Development](#development)
71
+ - [Design principles](#design-principles)
72
+ - [Architecture overview](#architecture-overview)
73
+ - [Core module (runtime-agnostic)](#core-module-runtime-agnostic)
74
+ - [Bridge process](#bridge-process)
75
+ - [CLI executable](#cli-executable)
76
+ - [Session lifecycle](#session-lifecycle)
77
+ - [Error recovery](#error-recovery)
78
+ - [Testing strategy](#testing-strategy)
79
+ - [Contributing](#contributing)
80
+ - [Development setup](#development-setup)
81
+ - [Release process](#release-process)
82
+ - [References](#references)
83
+ - [Authors](#authors)
84
+ - [License](#license)
85
+ -->
86
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
17
87
 
18
88
  ## Features
19
89
 
20
90
  - 🔌 **Universal MCP client** - Works with any MCP server over Streamable HTTP or stdio.
21
91
  - 🔄 **Persistent sessions** - Keep multiple server connections alive simultaneously.
22
92
  - 🚀 **Zero setup** - Connect to remote servers instantly with just a URL.
23
- - 🔧 **Full protocol support** - Tools, resources, prompts, sampling, dynamic discovery, and async notifications.
93
+ - 🔧 **Full protocol support** - Tools, resources, prompts, dynamic discovery, and async notifications.
24
94
  - 📊 **`--json` output** - Easy integration with `jq`, scripts, and other CLI tools.
25
95
  - 🤖 **AI-friendly** - Designed for code generation and automated workflows.
26
96
  - 🔒 **Secure** - OS keychain integration for credentials, encrypted auth storage.
@@ -82,8 +152,8 @@ mcpc <target> prompts-get <prompt-name> [--args key=val key2:=json ...] [--args-
82
152
 
83
153
  mcpc <target> resources
84
154
  mcpc <target> resources-list
85
- mcpc <target> resources-read <uri> [-o <file>] [--max-size <bytes>]
86
- mcpc <target> resources-subscribe <uri> # TODO
155
+ mcpc <target> resources-read <uri>
156
+ mcpc <target> resources-subscribe <uri>
87
157
  mcpc <target> resources-unsubscribe <uri>
88
158
  mcpc <target> resources-templates-list
89
159
 
@@ -210,7 +280,7 @@ This allows you to:
210
280
  - Manage credentials independently from sessions
211
281
 
212
282
  **Key concepts:**
213
- - **Authentication profile**: Named set of OAuth credentials for a specific server (stored in `~/.mcpc/auth-profiles.json` + OS keychain)
283
+ - **Authentication profile**: Named set of OAuth credentials for a specific server (stored in `~/.mcpc/profiles.json` + OS keychain)
214
284
  - **Session**: Active connection to a server that may reference an authentication profile (stored in `~/.mcpc/sessions.json`)
215
285
  - **Default profile**: When `--profile` is not specified, `mcpc` uses the authentication profile named `default`
216
286
 
@@ -315,7 +385,7 @@ When multiple authentication methods are available, `mcpc` uses this precedence
315
385
 
316
386
  ### Authentication profiles storage format
317
387
 
318
- By default, authentication profiles are stored in the `~/.mcpc/auth-profiles.json` file with the following structure:
388
+ By default, authentication profiles are stored in the `~/.mcpc/profiles.json` file with the following structure:
319
389
 
320
390
  ```json
321
391
  {
@@ -369,7 +439,7 @@ Instead of forcing every command to reconnect and reinitialize (which is slow an
369
439
  `mcpc` saves its state to `~/.mcpc/` directory (unless overridden by `MCPC_HOME_DIR`), in the following files:
370
440
 
371
441
  - `~/.mcpc/sessions.json` - Active sessions with references to authentication profiles (file-locked for concurrent access)
372
- - `~/.mcpc/auth-profiles.json` - Authentication profiles (OAuth metadata, scopes, expiry)
442
+ - `~/.mcpc/profiles.json` - Authentication profiles (OAuth metadata, scopes, expiry)
373
443
  - `~/.mcpc/bridges/` - Unix domain socket files for each bridge process
374
444
  - `~/.mcpc/logs/bridge-*.log` - Log files for each bridge process
375
445
  - OS keychain - Sensitive credentials (OAuth tokens, bearer tokens, client secrets)
@@ -466,7 +536,7 @@ mcpc https://mcp.apify.com session @apify
466
536
 
467
537
  ## Logging
468
538
 
469
- The background bridge process logs to `~/.mcpc/bridges/mcpc-@<session-name>.log`.
539
+ The background bridge process logs to `~/.mcpc/logs/bridge-<session-name>.log`.
470
540
  The main `mcpc` process doesn't save log files, but you can use `--verbose` flag to print all logs to stderr.
471
541
 
472
542
  MCP servers can be instructed to adjust their [logging level](https://modelcontextprotocol.io/specification/latest/server/utilities/logging)
@@ -493,6 +563,24 @@ mcpc @apify logging-set-level error
493
563
  **Note:** This sets the logging level on the **server side**. The actual log output depends on the server's implementation.
494
564
 
495
565
 
566
+ ## Cleanup
567
+
568
+ You can clean up the `mcpc` state and data using the `--clean` option:
569
+
570
+ ```bash
571
+ # Safe non-destructive cleanup: remove expired sessions, delete old orphaned logs
572
+ mcpc --clean
573
+
574
+ # Clean specific resources (comma-separated)
575
+ mcpc --clean=sessions # Kill bridges, delete all sessions
576
+ mcpc --clean=profiles # Delete all authentication profiles
577
+ mcpc --clean=logs # Delete all log files
578
+ mcpc --clean=sessions,logs # Clean multiple resource types
579
+
580
+ # Nuclear option: remove everything
581
+ mcpc --clean=all # Delete all sessions, profiles, logs, and sockets
582
+ ```
583
+
496
584
  ## Configuration
497
585
 
498
586
  Configuration can be provided via file, environment variables, or command-line flags.
@@ -610,7 +698,7 @@ Config files support environment variable substitution using `${VAR_NAME}` synta
610
698
  - **Tools**: Executable functions with JSON Schema-validated arguments.
611
699
  - **Resources**: Data sources identified by URIs (e.g., `file:///path/to/file`, `https://example.com/data`), with optional subscriptions for change notifications
612
700
  - **Prompts**: Reusable message templates with customizable arguments
613
- - **Completion**: Provides access to Completion API for tools and resources, and offers completions in shell mode
701
+ - **Completion**: Provides access to Completion API for tools and resources
614
702
  - Supports server logging settings (`logging/setLevel`) and messages (`notifications/message`), and prints them to stderr or stdout based on verbosity level.
615
703
  - Handles server notifications: progress tracking, logging, and change notifications (`notifications/tools/list_changed`, `notifications/resources/list_changed`, `notifications/prompts/list_changed`)
616
704
  - Request multiplexing: supports up to 10 concurrent requests, queues up to 100 additional requests
@@ -645,7 +733,7 @@ MCP enables arbitrary tool execution and data access; treat servers like you tre
645
733
  - OAuth refresh tokens are stored in the OS keychain (access tokens are kept in memory only)
646
734
  - OAuth client credentials (client_id, client_secret from dynamic registration) are stored in the keychain
647
735
  - All HTTP headers from `--header` flags are stored per-session in the keychain (as JSON)
648
- - The `~/.mcpc/auth-profiles.json` file only contains metadata (server URL, scopes, timestamps) - never tokens
736
+ - The `~/.mcpc/profiles.json` file only contains metadata (server URL, scopes, timestamps) - never tokens
649
737
 
650
738
  **Keychain entries:**
651
739
  - OAuth tokens: `mcpc:auth:<serverUrl>:<profileName>:oauth-tokens`
@@ -681,7 +769,7 @@ This architecture ensures:
681
769
  ### File permissions
682
770
 
683
771
  - `~/.mcpc/sessions.json` is set to `0600` (user-only read/write)
684
- - `~/.mcpc/auth-profiles.json` is set to `0600` (user-only read/write)
772
+ - `~/.mcpc/profiles.json` is set to `0600` (user-only read/write)
685
773
  - Bridge sockets in `~/.mcpc/bridges/` are created with `0700` permissions
686
774
  - Log files in `~/.mcpc/logs/` are created with `0600` permissions
687
775
 
@@ -728,9 +816,8 @@ mcpc @apify shell
728
816
  ```
729
817
 
730
818
  **Features:**
731
- - Command history (saved to `~/.mcpc/history`, last 1000 commands)
732
- - Tab completion for commands, tool names, and resource URIs
733
- - Multi-line editing with arrow keys
819
+ - Command history with arrow key navigation (saved to `~/.mcpc/history`, last 1000 commands)
820
+ - Real-time server notifications displayed during session
734
821
  - Prompt shows session name: `mcpc(@apify)> `
735
822
 
736
823
  **Shell-specific commands:**
@@ -770,17 +857,60 @@ Then restart Claude Code. The skill enables Claude to interact with MCP servers
770
857
 
771
858
  See [`claude-skill/README.md`](./claude-skill/README.md) for details.
772
859
 
773
- ## Implementation
860
+
861
+ ## Troubleshooting
862
+
863
+ ### Common issues
864
+
865
+ **"Cannot connect to bridge"**
866
+ - Bridge may have crashed. Try: `mcpc <server> session @<session-name>`
867
+ - Check bridge is running: `ps aux | grep -e 'mcpc-bridge' -e '[m]cpc/dist/bridge'`
868
+ - Check socket exists: `ls ~/.mcpc/bridges/`
869
+
870
+ **"Session not found"**
871
+ - Session may have expired. Create new session: `mcpc <target> session @<session-name>`
872
+ - List existing sessions: `mcpc`
873
+
874
+ **"Authentication failed"**
875
+ - List saved profiles: `mcpc`
876
+ - Re-authenticate: `mcpc <server> login [--profile <name>]`
877
+ - For bearer tokens: provide `--header "Authorization: Bearer ${TOKEN}"` again
878
+
879
+ ### Debug mode
880
+
881
+ Enable detailed logging with `--verbose`:
882
+
883
+ ```bash
884
+ mcpc --verbose @apify tools-list
885
+ ```
886
+
887
+ This shows:
888
+ - Protocol negotiation details
889
+ - JSON-RPC request/response messages
890
+ - Streaming events and reconnection attempts
891
+ - Bridge communication (socket messages)
892
+ - File locking operations
893
+ - Prints server log messages with severity `debug`, `info`, and `notice` to standard output
894
+
895
+ ### Logs
896
+
897
+ Bridge processes log to:
898
+ - `~/.mcpc/logs/bridge-<session-name>.log`
899
+
900
+ Log rotation: Keep last 10MB per session, max 5 files.
901
+
902
+ ## Development
774
903
 
775
904
  `mcpc` is under active development and some things might not work 100% yet. You have been warned.
776
905
 
777
906
  ### Design principles
778
907
 
779
908
  - Delightful for humans and AI agents alike (interactive + scripting)
780
- - One clear way to do things (orthogonal commands, no surprises, saving tokens)
781
- - Do not ask for user input (except `shell` and `login`)
782
- - Be forgiving, always help users make forward progress (great errors + guidance)
783
- - JSON strictly consistency with the MCP specification
909
+ - Avoid unnecessary interaction loops, provide sufficient context, yet be concise (save tokens)
910
+ - One clear way to do things (orthogonal commands, no surprises)
911
+ - Do not ask for user input (except `shell` and `login`, no unexpected OAuth flows)
912
+ - Be forgiving, always help users make progress (great errors + guidance)
913
+ - Be consistent with the [MCP specification](https://modelcontextprotocol.io/specification/latest), with `--json` strictly
784
914
  - Minimal and portable (few deps, cross-platform)
785
915
  - No slop!
786
916
 
@@ -854,18 +984,18 @@ Implemented as a separate executable (`mcpc-bridge`) that maintains persistent c
854
984
  The main `mcpc` command provides the user interface.
855
985
 
856
986
  **CLI responsibilities:**
857
- - Argument parsing (using `minimist` or similar)
987
+ - Argument parsing using Commander.js
858
988
  - Output formatting (human-readable vs `--json`)
859
989
  - Bridge lifecycle: start/connect/stop
860
990
  - Communication with bridge via socket
861
- - Interactive shell (REPL using `@inquirer/prompts`)
991
+ - Interactive shell (REPL using Node.js `readline`)
862
992
  - Configuration file loading (standard MCP JSON format)
863
993
  - Credential management (OS keychain via `keytar` package)
864
994
 
865
995
  **Shell implementation:**
866
- - Built on `@inquirer/prompts` for input handling
867
- - Command history using `~/.mcpc/history`
868
- - Tab completion using inquirer autocomplete and MCP completion API
996
+ - Built on Node.js `readline` module for input handling with history support
997
+ - Command history using `~/.mcpc/history` (last 1000 commands)
998
+ - Real-time notification display during shell sessions
869
999
  - Graceful exit handling (cleanup on Ctrl+C/Ctrl+D)
870
1000
 
871
1001
  ### Session lifecycle
@@ -938,47 +1068,6 @@ Later...
938
1068
  - `examples/test-server/` - Reference MCP server for testing
939
1069
  - `test/mock-keychain.ts` - Mock OS keychain for testing
940
1070
 
941
- ## Troubleshooting
942
-
943
- ### Common issues
944
-
945
- **"Cannot connect to bridge"**
946
- - Bridge may have crashed. Try: `mcpc <server> session @<session-name>`
947
- - Check bridge is running: `ps aux | grep -e 'mcpc-bridge' -e '[m]cpc/dist/bridge'`
948
- - Check socket exists: `ls ~/.mcpc/bridges/`
949
-
950
- **"Session not found"**
951
- - Session may have expired. Create new session: `mcpc <target> session @<session-name>`
952
- - List existing sessions: `mcpc`
953
-
954
- **"Authentication failed"**
955
- - List saved profiles: `mcpc`
956
- - Re-authenticate: `mcpc <server> login [--profile <name>]`
957
- - For bearer tokens: provide `--header "Authorization: Bearer ${TOKEN}"` again
958
-
959
- ### Debug mode
960
-
961
- Enable detailed logging with `--verbose`:
962
-
963
- ```bash
964
- mcpc --verbose @apify tools-list
965
- ```
966
-
967
- This shows:
968
- - Protocol negotiation details
969
- - JSON-RPC request/response messages
970
- - Streaming events and reconnection attempts
971
- - Bridge communication (socket messages)
972
- - File locking operations
973
- - Prints server log messages with severity `debug`, `info`, and `notice` to standard output
974
-
975
- ### Logs
976
-
977
- Bridge processes log to:
978
- - `~/.mcpc/logs/bridge-<session-name>.log`
979
-
980
- Log rotation: Keep last 10MB per session, max 5 files.
981
-
982
1071
  ## Contributing
983
1072
 
984
1073
  Contributions are welcome!
@@ -1006,23 +1095,26 @@ mcpc --help
1006
1095
 
1007
1096
  ### Release process
1008
1097
 
1009
- ```bash
1010
- # Run tests
1011
- npm test
1012
-
1013
- # Build
1014
- npm run build
1015
-
1016
- # Bump version
1017
- npm version patch|minor|major
1098
+ Use the release script to publish a new version (must be on `main` branch):
1018
1099
 
1019
- # Publish
1020
- npm publish
1021
-
1022
- # Push tags
1023
- git push --tags
1100
+ ```bash
1101
+ npm run release # patch version bump (0.1.2 → 0.1.3)
1102
+ npm run release:minor # minor version bump (0.1.2 → 0.2.0)
1103
+ npm run release:major # major version bump (0.1.2 → 1.0.0)
1024
1104
  ```
1025
1105
 
1106
+ The script automatically:
1107
+ - Ensures you're on `main` branch
1108
+ - Ensures working directory is clean (no uncommitted changes)
1109
+ - Ensures branch is up-to-date with remote
1110
+ - Runs lint, build, and tests
1111
+ - Bumps the version in package.json
1112
+ - Creates a git commit and annotated tag (`v{version}`)
1113
+ - Pushes the commit and tag to origin
1114
+ - Publishes to npm
1115
+
1116
+ After publishing, create a GitHub release at the provided link.
1117
+
1026
1118
  Please open an issue or pull request on [GitHub](https://github.com/apify/mcpc).
1027
1119
 
1028
1120
 
package/TODOs.md CHANGED
@@ -1,93 +1,85 @@
1
1
 
2
2
  # TODOs
3
3
 
4
-
5
4
  ## Bugs
6
- - Seems calling invalid/unknown MCP command in shell (perhaps also normally) causes the bridge to be flagged as expired
7
-
8
- - reconnection doesn't work
9
- mcpc @apify session  1 ✘
10
- error: missing required argument 'name'
5
+ ...
11
6
 
12
7
 
13
8
  ## Next
14
9
 
15
- - nit: consistent good server and session info, on server/session info, print also auth info
16
- - [Using session: apify-docs] => change to show server + transport + version? + auth info!!!
17
- Active MCP sessions:
18
- @fs → npx (stdio) --- show also args instead of just "npx"
19
- - print PID of bridge process
20
-
21
- Visual examples:
22
-
23
- Xxx/
24
- ├── run.sh # Master runner (parallel by suite)
25
- ├── lib/
26
- │ ├── common.sh # Assertions, temp dirs, cleanup
27
- │ ├── server.sh # Start/stop test server helpers
28
- │ └── mcpc.sh # Wrapper to invoke mcpc with coverage
29
- ├── fixtures/
30
- │ └── configs/ # Test config files
31
- ├── server/
32
- │ └── index.ts # Configurable test MCP server
33
-
34
-
35
- * ▐▛███▜▌ * Claude Code v2.0.75
36
- * ▝▜█████▛▘ * Opus 4.5 · Claude Team
37
- * ▘▘ ▝▝ * ~/Projects/mcpc
10
+ - Expand --help to use same text as in README, add link to README
38
11
 
12
+ BIG: We need to decide whether to show Markdown-ish or not
39
13
 
40
- - Better error handling:
41
- - "mcpc https://mcp.sentry.dev/mcp" with an unknown sever => should hint to use "login"
42
- - Handle MCP errors by failing the command tool, e.g. invalid tool name..
43
14
 
44
- - implement resources-subscribe/resources-unsubscribe command properly
15
+ - implement resources-subscribe/resources-unsubscribe, --o file command properly, --max-size
45
16
  - > # TODO: automatically update the -o file on changes, without it just keep track of changed files in bridge process' cache, and report in resources-list
46
-
47
-
17
+
18
+
48
19
  ## Security
49
20
  - Double-check the MCP security guidelines
50
21
  - OAuth issuer - maybe save it and double-check it to ensure domain is not spoofed?
51
22
 
52
-
53
23
  ## Later
54
24
 
25
+ - nit: Print version info to logs, and link to https://github.com/apify/mcpc (to right release tag) - add this also to --help
26
+
27
+ - Implement "mcpc @session restart"
28
+
55
29
  - nit: Colorize output, e.g. JSONs in one color. MCP provided data like descriptions and instructions in orange.
56
30
  - warnings could be orange, errors red
57
- - - docs: add Claude Skills file to /docs, maybe also man page?
58
- - Add support for MCP elicitations, and potentially for sampling (e.g. via shell interface?)
31
+ - nit: Cooler OAuth flow finish web page with CSS animation, add Apify example there. E.g. next step - check Apify rather than close
32
+
59
33
  - Add `--proxy [HOST:]PORT` feature to `connect` command to enable MCP proxy:
60
34
  - `--proxy-bearer-token X` to require auth token for better security
61
35
  - `--proxy-capabilities tools:TOOL_NAME,TOOL_NAME2,...,prompts[:...],...` to limit access to selected MCP features and tools
62
36
  (what if tools have ":" or "," in their names?)
63
37
  In theory, we could add limit of capabilities to normal sessions, but the LLM could still break out of it, so what's the point.
64
38
  - Explain this is useful for AI sandboxing!
65
- - Implement typing completions (e.g. "mcpc @a...") - not sure how difficult that is
66
- - nit: Nicer OAuth flow finish web page, add Apify example there. E.g. next step - check Apify rather than close
39
+
40
+ - For auth profiles, fetch the detailed user info from http, ensure the info is up-to-date
41
+ - Add support for MCP elicitations, and potentially for sampling (e.g. via shell interface?)
42
+
67
43
  - nit: cooler OAuth web pages "Authentication successful!" - show mcpc info
68
44
  - audit that on every command, we print next steps as examples
69
45
  - more shortcuts, e.g. --profile => -p
70
46
  - nit: in README, explain the MCP commands better in a standlone section, with details how they work
47
+ - Add unique Session.id and Profile.id and use it for OS keychain keys, to truly enable using multiple independent mcpc profiles
48
+ - When user runs --clean=profiles, print warning if some sessions were using them
49
+
50
+ - nit: Implement typing completions (e.g. "mcpc @a...") - not sure how difficult that is
51
+
52
+
71
53
 
72
54
 
73
55
 
74
56
  ## E2E test scenarios
75
- - add end-to-end tests e.g. under `test/e2e` - one bash script per test suite , organized in directories, and one master script that runs them all or selected ones (per directory) in parallel
76
- - Invariants:
57
+ - DONE: add end-to-end tests e.g. under `test/e2e` - one bash script per test suite , organized in directories,and one master script that runs them all or selected ones (per directory) in parallel
58
+ - Invariants (ideally test this for all commands used in other tests, or is it better just to always test one thing?):
77
59
  - --verbose only adds extra info to stderr, never to stdout
78
60
  - --json always returns single JSON object to stdout on success (exit code = 0), or an object or nothing at all on error (exit code != 0)
79
61
  - We'll need a testing server with all the available features and configurable, for testing.
62
+ - "npm run test:coverage" doesn't seem to work and cover e2e tests
80
63
  - Things to test:
81
64
  - handling of errors, invalid params, names, etc.
82
65
  - pagination
83
66
  - env vars...
84
- - stdio + filesystem operations,
67
+ - stdio + filesystem operations
85
68
  - sessions
69
+ - test stdio transport with fs mcp server
70
+ - test expired session (create fake record in session.json) - ensure attempts to use it will fail with the right error
86
71
  - for all commands, tests --verbose doesn't print anything extra to stdout, --json returns json
87
72
  - that on session close we send HTTP DELETE https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#session-management
88
- - Test session failover - e.g. kill the bridge process, and try to access the session again (should be restarted)
73
+ - Test session failover - e.g. kill the bridge process, and try to access the session again - should be restarted, work, and have same MCP-Session-Id
74
+ - Test auth - if no profile available and server requires OAuth, we need to fail with info what to do! e.g. "mcpc https://mcp.sentry.dev/mcp --verbose"
89
75
  - Test server session aborting - if session is aborted by server, bridge process should exit and set session status to "expired"
90
- - Test auth profiles work long-term and sessions too
91
- - Can we track test coverage also this way?
76
+ - Test auth profiles work long-term and sessions too - basically when running some tests the next day they should use old saved auths and sessions
77
+ - Test "mcpc @test close" and "mcpc <server> session @test" in rapid succession, it should work and use different pid (check sessions.json)
78
+ - Ensure calling invalid/unknown MCP command in shell and normally doesn't causes the bridge to be flagged as expired or dead
92
79
  - Text copy can change, but the core texts needs to be shown in both text and JSON mode
93
-
80
+ - Testing servers we can use:
81
+ - https://mcp.apify.com (for testing real OAuth login, we can create various accounts, both OAuth and API tokens)
82
+ - https://mcp.apify.com/tools=docs (anonymous, no auth needed)
83
+ - https://mcp.sentry.dev/mcp (for testing if no auth profile available)
84
+ - ideally get some on non-standard port, maybe localhost
85
+