Skip to content

feat: Major CLI syntax overhaul to mcpc [<@session>] [<command>]#29

Merged
jancurn merged 26 commits intomainfrom
feat/new-syntax
Mar 7, 2026
Merged

feat: Major CLI syntax overhaul to mcpc [<@session>] [<command>]#29
jancurn merged 26 commits intomainfrom
feat/new-syntax

Conversation

@jancurn
Copy link
Member

@jancurn jancurn commented Mar 6, 2026

Breaking change: major improvement of syntax:

mcpc <target> [<command>] => mcpc [<@session>] [<command>]

Plus various related fixes and improvements in CLI interface.

--

The existing interface of mcpc now looks like this:

Usage: mcpc [options] [command]

The main “verb” after mcpc is always expected to be a target (either URL, config entry, or sesion name). But that’s problematic and non-standard, as for example we can’t easlie introduce new global commands to mcpc such as “clean”, “x402”, “grep” etc.

This is a new proposal for the interface that introduces a more standard “mcpc ” syntax, where can also be a @session and then mcpc will operate on the session as it does now. Also, we’re getting rid of the non-session access to MCP servers (e.g. “mcpc mcp.apify.com tools-list”), it only complicates syntax and implementation.

# List all active sessions and saved authentication profiles (works same as now)
mcpc

# Print version
mcpc --version


# Print general help (both commands do the same)
mcpc --help
mcpc help

# Print help for a specific command (works even for the MCP commands like tools-list)
mcpc help <command>

# Login to remote MCP server and save OAuth credentials for future use
mcpc login mcp.apify.com [--profile <name>]
mcpc logout mcp.apify.com [--profile <name>]

# Clean up
mcpc clean [resource...]
# Resources are: sessions, profiles, logs, sockets, all
# MCP session commands - after session is connected, you can use "mcpc @<session> ..." to interact with it
mcpc connect mcp.apify.com @apify [--profile <name>] [--proxy <[host:]port>] [--proxy-bearer-token <token>]


# Connect to single entry from config file (mcpc first checks if target is valid URL - if not it checks if it's a file. So use ./xxx or ~/xxx to force file.)
mcpc connect ~/.vscode/mcp.json:filesystem @fs 

# MAYBE LATER:
# Connects to all entries from file - the 
# mcpc connect ~/.vscode/mcp.json
# Connect to all 
# mcpc connect




# All session-related commands then use "mcpc @<session> <command>" syntax:

# Print help for session and its server incl. capabilities (same as it works now)
mcpc @<session> shell
mcpc @<session> close
mcpc @<session> restart

# MCP commands (same as it works now)
mcpc @<session> tools-list
mcpc @<session> tools-get <tool-name>
mcpc @<session> tools-call <tool-name> [arg1:=val1 arg2:=val2 ... | <args-json> | <stdin]
...
mcpc @<session> ping


# General options (applicable to multiple commands)
--json
--verbose
--timeout
--header
--help

@jancurn jancurn changed the title feat: Breaking change CLI syntax from mcpc <target> [<command>] to mcpc [<@session>] [<command>] feat: Major CLI syntax change to mcpc [<@session>] [<command>] Mar 7, 2026
@jancurn jancurn requested review from MQ37 and Copilot March 7, 2026 00:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a breaking, command-first CLI redesign for mcpc, shifting from mcpc <target> [command] to mcpc [<@session>] [<command>] and removing direct one-shot access to servers (users must connect to create a session before running MCP commands).

Changes:

  • Introduces top-level verb commands (connect, login, logout, clean, help, x402) and routes MCP operations through @session targets.
  • Adds parsing utilities for server arguments (parseServerArg) and session subcommand detection (hasSubcommand); removes legacy --config/target parsing logic.
  • Updates unit + E2E tests and refreshes user-facing docs (README/CLAUDE/CHANGELOG) to reflect the new interface.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/cli/index.ts Reworks CLI routing into top-level commands vs session subcommands; adds connect/login/logout/clean/help wiring.
src/cli/parser.ts Removes legacy target/config parsing; adds hasSubcommand and parseServerArg.
src/cli/helpers.ts Removes direct-connection client path; withMcpClient now enforces session-only usage.
src/cli/commands/sessions.ts Updates connectSession argument ordering to match new connect command flow.
src/lib/errors.ts Updates auth error guidance strings to new command syntax.
src/lib/utils.ts Removes unused isFile/isDirectory helpers and stat import.
test/unit/cli/index.test.ts Replaces findTarget tests with coverage for parseServerArg and hasSubcommand.
test/e2e/lib/framework.sh Removes implicit test-header injection from run_mcpc; adds header injection only in create_session.
test/e2e/suites/** Updates E2E invocations to `mcpc connect <server
README.md Updates embedded --help output snippet to new usage/commands list.
CLAUDE.md Updates documented CLI usage patterns to the new session-first workflow.
CHANGELOG.md Documents the breaking syntax change and migration examples.
docs/TODOs.md Adds notes/examples related to x402 and an auth/session bug (needs syntax refresh).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jancurn jancurn changed the title feat: Major CLI syntax change to mcpc [<@session>] [<command>] feat: Major CLI syntax overhaul to mcpc [<@session>] [<command>] Mar 7, 2026
jancurn and others added 2 commits March 7, 2026 01:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Mar 7, 2026

@jancurn I've opened a new pull request, #30, to work on those changes. Once the pull request is ready, I'll request review from you.

jancurn and others added 9 commits March 7, 2026 01:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ds (#31)

* Add command-first syntax for close, restart, and shell session commands

Support `mcpc close @session`, `mcpc restart @session`, and `mcpc shell @session`
as alternatives to `mcpc @session close/restart/shell`. Also fix pre-existing
broken code in the clean command handler.

https://claude.ai/code/session_01Jz8RQGLnPdn262ztePPcEZ

* Remove redundant alternative syntax hints from help text

https://claude.ai/code/session_01Jz8RQGLnPdn262ztePPcEZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
* Initial plan

* Fix validateOptions to stop at first command token, not scan all args

Co-authored-by: jancurn <10612996+jancurn@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jancurn <10612996+jancurn@users.noreply.github.com>
* Fix Prettier formatting in src/cli/index.ts to pass CI lint check

https://claude.ai/code/session_01QrZyVG5ucMFTRoqQuh3iC9

* Normalize package-lock.json peer dependency markers

https://claude.ai/code/session_01QrZyVG5ucMFTRoqQuh3iC9

---------

Co-authored-by: Claude <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jancurn and others added 6 commits March 7, 2026 09:48
* fix: e2e test failures for schema-mode validation and run.sh portability

- Align --schema-mode error message in getOptionsFromCommand() with test
  expectations (was "Invalid schema mode", now matches "Invalid --schema-mode
  value" format used elsewhere)
- Add --timeout validation in getOptionsFromCommand() since validateArgValues()
  now stops at the first non-option arg and no longer catches subcommand options
- Replace bash process substitution (< <(...)) in run.sh with heredoc
  alternatives (<<< "$()") for portability in environments without /dev/fd

https://claude.ai/code/session_01FSt1NZy2bmcF2zDbhFEjSQ

* TODOs

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@apify apify deleted a comment from Copilot AI Mar 7, 2026
@jancurn jancurn merged commit ed9b254 into main Mar 7, 2026
5 checks passed
@apify apify deleted a comment from Copilot AI Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants