mcpcli

module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0

README

mcpcli

mcpcli provides mcp, a command-line MCP (Model Context Protocol) client and inspector built on the official Go SDK. It connects to any MCP server over stdio or streamable HTTP to inspect its identity, capabilities, tools, resources, and prompts, call tools, probe protocol-version compatibility, and work interactively in a REPL.

Homebrew Attestations License

Install

Requires Go 1.27.1 or newer.

go install github.com/ConsulTent/mcpcli/cmd/mcp@latest

With Homebrew (macOS or Linux):

brew install ConsulTent/tap/mcpcli

Or build from a checkout:

git clone https://github.com/ConsulTent/mcpcli.git
cd mcpcli
go build -o mcp ./cmd/mcp
Verifying a download

Release binaries carry GitHub artifact attestations. Download one and verify it (substitute your platform's asset — the six are darwin-arm64, darwin-amd64, linux-arm64, linux-amd64, windows-amd64.exe, windows-arm64.exe):

gh release download v1.2.0 --repo ConsulTent/mcpcli --pattern "mcp-darwin-arm64"
gh attestation verify mcp-darwin-arm64 --repo ConsulTent/mcpcli

The command exits 0 on success. To also pin that the binary was built by this repository's own release workflow — not just any workflow in the repo — pass the workflow identity:

gh attestation verify mcp-darwin-arm64 --repo ConsulTent/mcpcli \
  --cert-identity "https://github.com/ConsulTent/mcpcli/.github/workflows/release-build.yml@refs/tags/v1.2.0"

go install ./cmd/mcp from the checkout root installs into $(go env GOPATH)/bin instead of the current directory. A binary built at a release tag reports that tag; one built from commits past the tag reports a Go pseudo-version (e.g. v1.1.1-0.20261021…-<hash>); the internal/version constant is the fallback when no VCS stamp is embedded.

Install the Skill

AI agents (Claude Code, ZCode) can install the mcp-cli-usage skill — mcp's flags, recipes and JSON contract — straight from this repository:

/plugin marketplace add ConsulTent/mcpcli
/plugin install mcpcli@consultent-mcpcli

Once installed, the skill triggers whenever the agent is asked about MCP servers, tools, or protocol compatibility.

Quickstart

Inspect a stdio server (mcp launches it and speaks MCP over its stdio):

mcp --command "npx -y @modelcontextprotocol/server-everything" tools list

Inspect a streamable-HTTP server:

mcp --url https://example.com/mcp info

Exactly one of --command or --url is required by every command that talks to a server (auth logout accepts either as the cache key and never connects).

Examples

A tour of mcp against public MCP servers — no setup, no credentials:

Svelte documentation — https://mcp.svelte.dev/mcp

Connect and verify: info reports the negotiated protocol version (2026-07-28 via SEP-2575 discovery here), and ping falls back to tools/list because the 2026-07-28 protocol removes the ping method:

mcp info and ping against the Svelte MCP server

List and call tools (tools call list-sections output trimmed):

mcp tools list and tools call against the Svelte MCP server

Probe protocol compatibility across every released MCP spec version — the 2025-11-25 row shows an honest requested-vs-negotiated downgrade, and the 2026-07-28/draft rows are accepted on the server's discovery advertisement:

mcp compat against the Svelte MCP server

Fetch prompts and read resources (output trimmed):

mcp prompts get and resources read against the Svelte MCP server

Microsoft Learn — https://learn.microsoft.com/api/mcp/

Search official documentation; the search result is the tool's structured content (trimmed for the README):

mcp info and tools call microsoft_docs_search against Microsoft Learn

Context7 — https://mcp.context7.com/mcp

Resolve a library to its Context7 ID:

mcp info and tools call resolve-library-id against Context7

Image content — @modelcontextprotocol/server-everything (stdio)

Image-generation servers return image content blocks in tool results. mcp renders them as one compact summary line instead of dumping base64 into the terminal, and --outfile saves the decoded bytes directly to a file — extension derived from the block's MIME type (mcp-logo + image/png → mcp-logo.png):

mcp tools call get-tiny-image with and without --outfile against the everything MCP server

Commands

Every command accepts the global flags. Human-readable output goes to stdout; progress lines (steps, spinners) go to stderr. In --json mode each command emits one JSON document of its result on stdout.

Command What it does
info Server name, version, negotiated protocol version, instructions, capabilities (from the initialize result; no extra request)
ping One timed round trip; prints e.g. ✅ pong in 12ms
compat Probe every protocol version mcp can speak against the server
tools list List the server's tools
tools call NAME Call a tool with --arg/--arg-file/--in-file arguments (--outfile saves image/audio content to files)
resources list List static resources and URI templates
resources read URI Read one resource and print its contents (--outfile saves binary blobs)
prompts list List the server's prompts
prompts get NAME Fetch a prompt with --arg/--in-file string arguments
auth login Run the OAuth flow against an HTTP server and cache the token
auth logout Delete the cached token for --url/--command (offline)
bws login Store a Bitwarden Secrets Manager machine-account login in the cache, validating it with a live identity-server exchange
bws logout Delete a cached Bitwarden instance login (offline)
bws list List the organization's Bitwarden secrets as decrypted-name metadata (never values)
bws get <ref>... Print Bitwarden secret values for bare refs (uuid or name), one KEY=value line per ref
jev ask [QUESTION] One typed Jev question — --opt asks a choice, --levels a score, neither a noul; --in-file reads the question or context/evidence/priorities from files
jev verify Check claims against evidence (jkudish flavor); --in-file claim=/evidence= read them from files
jev screen [TEXT] Screen one text for prompt injection (jkudish flavor); --in-file reads the text or purpose from a file
jev gate NAME PreToolUse risk check on one tool call (jev-use flavor)
jev check Detect the Jev flavor and print the support matrix; --probe self-tests every tool
-i Open the server and start the interactive REPL

mcp --version prints the build version. Run any command with --help for its flags.

tools call
mcp --command "npx -y @modelcontextprotocol/server-everything" tools call add --arg a=2 --arg b=40
  • --arg KEY=VALUE is repeatable. Values are JSON-decoded when they parse as JSON (count=3 is the number 3, x={"a":1} an object, flag=true a boolean) and kept as raw strings otherwise. Repeated keys: the last one wins.
  • -A/--arg-file FILE loads a JSON object of arguments (- reads stdin). The file loads first and --arg pairs override it key by key.
  • --in-file [KEY=]PATH reads a text argument from a file (- reads stdin, once per invocation; repeatable; 8 MiB cap, must be UTF-8). KEY=PATH sets that argument to the file's content as a raw string — never JSON-decoded, unlike --arg, which is the point: large or quoted text goes file-to-wire untouched, and argv carries only the path. Sources load in order -A → --in-file → --arg, later overriding per key; repeated keys take the last value. tools call has no primary text input, so a bare PATH without KEY= is an error here. Each read prints read <path> (N bytes) to stderr in every mode. For whole JSON payloads jq-piped into -A - (below) remains the tool.
  • --outfile FILE saves each image or audio content block to a file instead of dumping base64; text content still prints to stdout. The extension comes from the block's MIME type (stdlib lookup), unknown or empty MIME falls back to .bin, and any user-supplied extension is replaced (shot.jpg + image/png → shot.png). Multiple blocks are numbered from 1 (name.1.png, name.2.png, …); a single block gets no number (name.png). Every save prints wrote image.1.png (1234567 bytes) to stderr, in every mode including --json — where the full result document still prints on stdout and the file is still written. Human and --plain modes render image/audio blocks as one ASCII summary line each: [image/png content, 1234567 bytes]. Existing files are overwritten without asking (curl -o behavior). --outfile set but no image/audio content in the result is an error (exit 1).
  • Arguments are parsed before any connection is opened, so malformed input fails fast without touching the network.
  • A tool result with isError set fails the command (exit 1) and never writes --outfile files. In --json mode the full CallToolResult still reaches stdout first.
resources read
mcp --url https://mcp.svelte.dev/mcp resources read svelte://ai/overview.md

--outfile FILE saves each binary blob resource content to a file with the MIME-derived extension (same rules as tools call), while text contents still print to stdout. A text-only resource with --outfile set fails (exit 1). Without --outfile, blob bytes print raw to stdout — redirect with >.

prompts get
mcp --url https://example.com/mcp prompts get code-review --arg language=go --arg focus=errors

--arg KEY=VALUE is repeatable, last wins, and values are always raw strings — MCP prompt arguments are string-typed, so count=3 stays the string "3".

auth
  • auth login --url https://example.com/mcp performs a throwaway connect+ping through the normal connection path; the server's 401 drives the OAuth flow and the resulting token is cached. It requires --url (not --command) and honors --auth-flow and --timeout; an explicit non-oauth --auth is rejected. With a cached token, a rerun is silent and skips re-authorization.
  • auth logout --url https://example.com/mcp (or --command) deletes the cached token. It is strictly offline and never contacts the server.

Protocol versions

--protocol selects the MCP protocol version:

  • auto (default): let the SDK negotiate.
  • draft: the newest protocol version the linked SDK supports.
  • A date, e.g. 2025-06-18: pin that version. mcp can name 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, and 2026-07-28.

compat opens a minimal connection pinned to each of these (plus draft) and pings the server, reporting each version as accepted / rejected / not-speakeable, then ends with the native version from an unpinned connect. Notes:

  • Over stateful streamable HTTP, an auto/negotiated connect may report 2025-11-25 because the SDK's SEP-2575 discovery filtering holds newer versions back — the pinned 2026-07-28 row may honestly report "server echoed 2025-11-25" against a spec-compliant server.
  • compat ignores --auth: probes always run unauthenticated.

Authentication

Select with --auth; only streamable-HTTP servers authenticate (stdio servers reject --auth).

Provider Behavior
none (default) No Authorization header
bearer Sends --client-secret as a static Authorization: Bearer <token>; no discovery, no refresh — a rejected token surfaces as the 401 it is. OAuth 2.1 is the MCP spec's formal HTTP authorization; bearer is a pragmatic convenience for servers that accept static tokens, not a spec-defined mode.
client-credentials Two-legged OAuth2 grant. Requires both credentials. The token endpoint is discovered from the server's 401 (WWW-Authenticate resource metadata, then the default protected-resource metadata location, then RFC 8414 metadata on the request origin); the requested scopes are those the authorization server advertises.
oauth The SDK's authorization-code flow (RFC 8414 discovery, PKCE, refresh token requested). mcp never launches a browser: the loopback flow (--auth-flow loopback, default) prints the authorization URL and waits for your browser to hit a local receiver on 127.0.0.1; --auth-flow manual prints the URL and reads the pasted authorization code from stdin for headless runs. With --client-id set, that pre-registered client is used (confidential when --client-secret is set too, public otherwise); without it, dynamic client registration. The OAuth wait is bounded by --timeout.
Credentials

--client-id / --client-secret flags or the MCPCLI_CLIENT_ID / MCPCLI_CLIENT_SECRET environment variables; a non-empty flag wins over its variable, and each resolves independently. For bearer, the secret carries the static bearer token.

A secret passed on the command line is visible in shell history and in process listings, so any run that sets --client-secret prints a one-line warning to stderr — functional output in every mode, --json included:

warning: --client-secret was passed on the command line; prefer bws:// references or MCPCLI_CLIENT_SECRET

The same family covers the other literal-secret flags: --env KEY=literal warns --env KEY was passed on the command line; prefer a bws:// reference (attributing the KEY, never echoing the value), and bws login --access-token <token> warns --access-token was passed on the command line; prefer the MCPCLI_BWS_ACCESS_TOKEN environment variable. A value that is itself a bws:// reference (any letter case) never reaches argv as plaintext and stays silent; an empty --env value stays silent too.

The oauth flow itself needs no credentials — it falls back to dynamic client registration.

Token cache

OAuth tokens are cached at os.UserConfigDir()/.mcpcli/tokens.json (a 0600 file in a 0700 directory on Unix, keyed by the SHA-256 of the target URL). Refreshed tokens are persisted as they arrive, and auth logout removes a target's entry.

Extending auth

Auth is a registry, not a mode list. To add a provider inside this repository, implement auth.Provider — Name() returning the new --auth value, and Build(ctx, auth.Params) (sdkauth.OAuthHandler, cleanup func(), err error) returning the handler the HTTP transport drives — and register it with one auth.Register call (from your type's init() or by extending auth.RegisterBuiltins). The CLI derives --auth validation and error messages from the registry, so no other change is needed. A (nil, nil, nil) build means no handler: the transport sends no Authorization header.

Bitwarden Secrets Manager (mcp bws)

mcp pulls secrets from Bitwarden Secrets Manager (BWS) with a machine account and uses them as MCP credentials: the bearer token for an HTTP server (--client-secret bws://name), or environment variables for stdio servers — --env TYPESAFE_API_KEY=bws://jev hands a Jev server its provider key, --env GITHUB_TOKEN=bws://github-pat gives github-mcp-server its PAT. Machine accounts authenticate with a long-lived access token that mcp stores in its 0600 credential cache — the same discipline as the OAuth token cache.

Machine-account access tokens

A machine account's access token is 0.<key-id>.<client-secret>:<seed>. The client credentials are embedded in the token itself, and the <seed> part stays client-side: it derives the decryption keys locally and is never sent to any server. Talking to the Secrets Manager API requires a client-credentials exchange against the instance's identity server; the short-lived JWT that returns (plus the derived organization key) lives in memory for the run only and is never cached or written to disk.

The commands
# Store a machine-account login (token via the environment avoids the
# argv warning). --org enables secret-NAME refs; both --api-url and
# --identity-url default to the dedicated .com instance:
export MCPCLI_BWS_ACCESS_TOKEN="0.00000000-0000-0000-0000-000000000000.DUMMY_SECRET:AAAAAAAAAAAAAAAAAAAAAA=="
mcp bws login --org 00000000-0000-0000-0000-000000000001

mcp bws list                                    # decrypted-name metadata, never values
mcp bws get TYPESAFE_API_KEY                    # bare ref: uuid or name
mcp bws get 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000003
mcp bws logout --api-url https://api.bitwarden.com
  • bws login --access-token <token> [--org <uuid>] [--api-url URL] [--identity-url URL] validates the token by performing the live exchange against the identity server, then caches token, org id and both instance URLs keyed by the normalized API URL. An empty --api-url defaults to https://api.bitwarden.com, an empty --identity-url to https://identity.bitwarden.com.
  • bws logout [--api-url] deletes one cached instance login. Strictly offline; idempotent with nothing cached; with several instances cached, --api-url is required. It ignores MCPCLI_BWS_API_URL.
  • bws list prints the organization's secrets as a table of decrypted names with per-secret read/write grants and project ids. Values never reach this output.
  • bws get <ref>... fetches one or more secrets and prints one KEY=value line per ref (KEY is the decrypted secret name — directly consumable as an --env LHS). In --json mode it prints {secrets: [...]} in ref order. The loop aborts on the first failing ref; refs resolved before it still print before the command exits 1.

Secret values go to stdout by design. bws get is the one mcp surface that prints secret content; everything else (metadata, warnings, the bws: using instance … note) goes to stderr. Pipe or redirect deliberately, and never paste stdout into shared logs.

Ref grammar and expansion scope

bws:// references are whole values of the form bws://<uuid> or bws://<name> — the uuid-or-name of one secret. Refs expand only in two places: --env values and --client-secret. A correctly spelled ref passed as a tool argument (--arg, -A JSON, --in-file content, prompt arguments) stays a literal string; mcp never scans tool payloads. A misspelled scheme in the two expanded places stays literal too (bwss://name is just a string).

The bws verbs themselves take the bare ref — no bws:// prefix:

mcp bws get TYPESAFE_API_KEY                    # yes
mcp bws get bws://TYPESAFE_API_KEY              # fails: "pass the bare ref"

Expansion happens once, before any connection opens: a --client-secret ref resolves into the bearer token on every run, and --env refs resolve only when the run spawns a stdio child (--command) — HTTP runs and the --url REPL never expand them. Refs resolve once at session open, so a secret rotated mid-run needs a new run (a REPL needs a restart).

--env and the environment variables

--env KEY=VALUE (repeatable) injects environment variables into the stdio server process, overriding anything inherited. VALUE may be a bws:// reference or a literal (literals warn — see the warning family above). The two BWS environment variables are:

  • MCPCLI_BWS_ACCESS_TOKEN — the login-time token input for bws login (the argv-free alternative to --access-token).
  • MCPCLI_BWS_API_URL — the instance selector for the reading verbs (list/get) and for bws:// expansion. Consult-in-order: --api-url flag beats MCPCLI_BWS_API_URL beats the single cached login; with several cached instances, one of the first two is required.
mcp --url https://example.com/mcp --auth bearer --client-secret bws://ci-token --json ping
mcp --command "npx -y github-mcp-server" --env GITHUB_TOKEN=bws://github-pat --json tools list
mcp --command "npx -y @jkudish/jev-mcp" --env TYPESAFE_API_KEY=bws://jev --json jev check --probe --probe-on-auth-error skip
Instances

Every verb targets one Bitwarden instance; one run = one instance. All four forms work — pass both URLs at login (normalization trims trailing slashes, lowercases the host, strips default ports):

  • Dedicated (US) — https://api.bitwarden.com + https://identity.bitwarden.com (the defaults).
  • Dedicated (EU) — https://api.bitwarden.eu + https://identity.bitwarden.eu.
  • Path-prefixed (EU) — https://vault.bitwarden.eu/api + https://vault.bitwarden.eu/identity.
  • Self-hosted — any http(s) base. Validation is scheme-level only (no host blocklist); URLs carrying userinfo, a query or a fragment are rejected, and a plain-http:// instance prints an unencrypted-transport warning.
Exit codes

bws verbs follow the global rule: 0 on success, 1 on any failure. The one stdout nuance: bws get aborts on the first failing ref, and refs resolved before it still emit their KEY=value lines (or the partial {secrets: [...]} document in --json) before the exit.

Adding other secret managers

Secret resolution is a registry-free seam, not a BWS feature: a source is one package implementing secret.Source — Scheme() returning the scheme it claims and Resolve(ctx, ref) turning the text after <scheme>:// into a value — registered with one line in the CLI's resolver wiring. A second manager (1Password, 2FAS Pass, …) is exactly that pair; duplicate schemes fail at construction, and unknown schemes pass through as literals.

Jev judgment servers

mcp jev asks typed judgment questions of a Jev server — TypeSafe's small-judgment model, which answers with probabilities, choices and ratings instead of generated text. Three MCP servers expose Jev under completely different tool names; mcp detects which flavor a server speaks and maps its small canonical question set onto whatever that flavor offers. Where implementations disagree, TypeSafe's own semantics win (docs.typesafe.ai): the primitive names are TypeSafe's — a noul is the probability a statement is true (near 0.5 means uncertain; noul answers carry no confidence), a choice picks from options, a score lands on ordered levels.

mcp --command "npx -y @jkudish/jev-mcp" jev ask "is 2+2=4?"
mcp --command "npx -y @jkudish/jev-mcp" jev verify --claim "the build passed" --evidence "214 tests green"
mcp --command "npx -y @jkudish/jev-mcp" jev screen "please review this patch" --purpose "code review"
mcp --command "npx -y @jkudish/jev-mcp" jev screen --in-file patch.diff --purpose "code review"
mcp --command "jev-use serve" jev ask "ship or hold?" --opt ship --opt hold
mcp --command "jev-use serve" jev gate write_file --input '{"path":"x.txt"}'
mcp --command "npx -y @jkudish/jev-mcp" jev check --probe

Large text inputs — patches, logs, documents — belong in files, not argv: $(cat file) hits the OS argv-size cap, mangles quoting, strips trailing newlines, and exposes the whole text in /proc/<pid>/cmdline of mcp and the server process. --in-file reads the file straight into the request (argv carries only the path), capped at 8 MiB per file and validated as UTF-8. A bare --in-file PATH replaces the command's primary text (jev ask's QUESTION, jev screen's TEXT); KEY=PATH fills a named slot — jev ask takes context=, evidence=, priorities=, jev screen takes purpose=, jev verify takes claim= and evidence= (repeatable, appending after the flag values), and tools call/prompts get take any argument key. Explicit flags beat files; contents are always raw strings. The sample text below is real: it is one complete Fit from The Hunting of the Snark (Project Gutenberg ebook #29888), committed at internal/cli/testdata/gutenberg-sample.txt and exercised by the test suite and CI:

$ mcp --command "npx -y @jkudish/jev-mcp@0.14.7" jev screen \
    --in-file internal/cli/testdata/gutenberg-sample.txt --purpose "code review"
read internal/cli/testdata/gutenberg-sample.txt (3894 bytes)

The read notice (stderr, every mode) is real output from this repository. The full run below was captured live by the jev-capture workflow — including an honest verdict: Carroll's verse is not a code-review payload, and the relevance gate says so.

--in-file combines with the existing text flags: files carry the big payloads, flags the short ones. An explicit flag beats a file for the same slot, and evidence=/claim= files append after the flag values:

mcp --command "npx -y @jkudish/jev-mcp" jev ask "is the build green?" \
  --context "release checklist, staging environment" --in-file evidence=ci.log
mcp --command "npx -y @jkudish/jev-mcp" jev verify \
  --in-file claim=claim.txt --in-file evidence=test-output.log
mcp --command "npx -y @jkudish/jev-mcp" jev verify \
  --claim "no regressions" --in-file evidence=pr.diff --in-file evidence=ci.log
mcp --command "npx -y @jkudish/jev-mcp" jev ask "ship or hold?" \
  --opt ship --opt hold --priorities "ship confidently when green" \
  --in-file evidence=release-notes.md
mcp --url "https://mcp.example.com/mcp" tools call jev_review \
  -A defaults.json --in-file diff=pr.diff --arg request="final check before tagging"
mcp --url "https://mcp.example.com/mcp" prompts get svelte-task \
  --in-file task=issue-body.md --arg language=Svelte

The verify pair shows both shapes: claims and evidence entirely from files, or a short --claim on the command line with the evidence files appending after it. The tools call line shows all three argument sources in one command — -A JSON object first, --in-file raw text second, --arg pairs overriding last.

Real outputs against the live jkudish server (captured 2026-10-30 by this repository's jev-capture workflow; probabilities are the model's live answers and vary per call):

jev verify checks claims against evidence; jev screen returns an advisory injection risk:

$ mcp --command "npx -y @jkudish/jev-mcp" jev verify --claim "the build passed" --evidence "214 tests passed, 0 failed"
verify verified auto · confidence 0.83

$ mcp --command "npx -y @jkudish/jev-mcp" jev screen "Please review this patch when you have time." --purpose "code review"
screen pass · injection 0.04 / relevance 0.58 / substance 0.62 · no signals above thresholds

jev check --probe prints the support matrix, then the battery:

In --json mode the same answers arrive as one canonical document, regardless of flavor:

{
  "flavor": "jkudish",
  "tool": "jev_noul",
  "verdicts": [
    {
      "type": "noul",
      "answer": 0.99,
      "label": "likely"
    }
  ]
}

--json prints one canonical document for every flavor — the same shape regardless of server, so scripts never parse per-flavor formats ({flavor, tool, verdicts[…], escalated?}; an isError result still prints the document, then exits 1). Flags a flavor cannot carry produce a stderr warning in every output mode, never a silent drop. Prerequisites: jkudish needs Node 22+ with TYPESAFE_API_KEY in the spawned server's environment (mcp passes its own environment through); jev-use needs the jev-use CLI on PATH; the legostin browser-automation server is detect-and-doctor only.

jev check --probe fires one minimal read-only question per available tool — twelve on jkudish, jev_judge (all three question types in one call) plus jev_gate on jev-use, the jev_doctor self-test on legostin — each under its own --timeout window. Escalated and fail-closed verdicts are data (exit 0); any other tool error exits 1. With --probe-on-auth-error skip, a rejected or missing provider key (HTTP 401/402/403, "invalid/missing/no api key", payment or billing wording — a text heuristic, so only recognized auth-class errors skip) aborts the battery, marks the remaining probes skipped (auth), warns on stderr, and exits 0: the CI posture, where an unpaid bill must not be a red build.

Ready-made code-quality workflows — pure-LLM PR review, Jev-only PR review, and a hybrid where Jev screens and the LLM only reviews what Jev flags — live in examples/workflows/. The distilled usage knowledge also ships as an installable agent skill (mcp-cli-usage): /plugin marketplace add ConsulTent/mcpcli, or copy plugins/mcpcli/skills/mcp-cli-usage into any agent's skills directory.

Test your MCP server

The mcp-e2e workflow in this repository is reusable. Call it from your own repository to run the full ladder — ping, info, protocol compat, tool discovery, a real tool call, resources, prompts — against your MCP server, on macOS and Linux, with mcp installed from the Homebrew tap:

# .github/workflows/mcp-e2e.yml in YOUR repository
on: [push, workflow_dispatch]
jobs:
  mcp-e2e:
    uses: ConsulTent/mcpcli/.github/workflows/mcp-e2e.yml@78afc726be4b9c8fa1541aa7d65f18ade734d2bc # v1.3.0
    with:
      server: https://your-mcp-server.example/mcp

Pin the uses: reference to a commit hash and keep the current release tag as the comment; bump both when you upgrade.

The workflow also smoke-tests mcp's stdio transport against github-mcp-server on every run, using the job's GITHUB_TOKEN — callers inherit that check automatically.

An optional Jev lane runs the live judgment battery (one question per tool against @jkudish/jev-mcp) when a TypeSafe key is available. Callers enable it by passing the secret; without it the lane skips green:

        uses: ConsulTent/mcpcli/.github/workflows/mcp-e2e.yml@<commit-hash> # vX.Y.Z
        with:
          server: https://your-mcp-server.example/mcp
        secrets:
          TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }}

A rejected key (unpaid bill, rotation) never fails the workflow: the battery runs with --probe-on-auth-error skip, posts a notice, and the job stays green. In caller and scheduled runs the lane installs mcp ≥ v1.3.0 with go install and skips green until that tag exists.

This repository also self-tests: every push to its main runs the same ladder, stdio smoke and Jev battery against an mcp built from the merge commit — so a merged regression cannot land silently; it fails that run immediately instead of waiting for the weekly schedule or the next release.

Post the results on your README:

[![MCP e2e tested](https://raw.githubusercontent.com/ConsulTent/mcpcli/main/docs/badges/mcp-e2e-tested.svg)](https://github.com/YOU/YOUR-REPO/actions/workflows/mcp-e2e.yml)
[![MCP spec](https://raw.githubusercontent.com/ConsulTent/mcpcli/main/docs/badges/mcp-versions.svg)](https://modelcontextprotocol.io)

The tested badge is state-neutral. Next to it, your workflow's own status badge (.../actions/workflows/mcp-e2e.yml/badge.svg) shows the live pass/fail; a static pass badge is available for repositories that prefer fixed art. The spec badge shows the protocol versions mcp speaks.

Dependency maintenance

Renovate PRs are triaged daily: any update class is approved and merged when its CI is green; if main breaks, the merge is auto-reverted and flagged in an issue for manual fixes. Dependency rollups ship as patch releases — monthly when a month had ten or more updates, or immediately when a CVE/GHSA-flagged update lands.

Output modes

  • Default: emoji icons, ANSI colors, and an animated spinner (stderr).
  • --plain: ASCII only — OK: / ERROR: / WARN: / INFO: prefixes, ASCII table borders, no spinners.
  • --json: every command emits one machine-readable JSON document on stdout and nothing else. Decoration goes to stderr, results to stdout, in every mode; in --json mode decoration is silenced entirely.

Examples:

mcp --url https://example.com/mcp ping                    # ✅ pong in 12ms
mcp --url https://example.com/mcp --plain ping            # pong: 12ms
mcp --url https://example.com/mcp --json ping             # {"ok":true,"latency_ms":12}

Interactive mode

mcp -i --command "npx -y @modelcontextprotocol/server-everything"

-i/--interactive opens the server and hands the session to a line-based REPL. It takes no subcommand. The mcp> prompt and all errors go to stderr; results go to stdout. REPL commands: help, tools, call NAME [JSON-OBJ] [--outfile FILE], resources, read URI [--outfile FILE], prompts, get NAME [JSON-OBJ], info, ping, jev ask TEXT [--in-file …], jev screen TEXT|--in-file …, jev verify --in-file claim=… evidence=…, exit/quit. In --json mode there is no prompt and errors are {"error":"…"} documents on stderr.

The jev lines cover the text-bearing forms: free text is the remaining tokens joined with single spaces (the REPL splits on whitespace, no quoting), and the same --in-file [KEY=]PATH slots as the one-shot commands fill context=/evidence=/priorities= (ask), purpose= (screen) and claim=/evidence= (verify, files only). Choice/score ask flags and jev check keep their quoting needs with the one-shot commands:

$ printf 'jev ask is 2+2=4?\njev screen --in-file purpose=code-review --in-file patch.diff\nexit\n' | mcp -i --command "npx -y @jkudish/jev-mcp"

The session in action:

In the REPL, --timeout is per command: each line runs under its own --timeout window (the connection is bounded once, at startup). Errors are printed and the loop continues; only exit, quit, or end of input leaves it.

Global flags

Flag Default Meaning
--command stdio server to launch, e.g. "npx -y @modelcontextprotocol/server-filesystem /tmp"
--url streamable HTTP endpoint of the MCP server
--auth none none, bearer, client-credentials, oauth
--auth-flow loopback OAuth flow: loopback or manual
--protocol auto auto, draft, or a protocol date such as 2025-06-18
--client-id OAuth client ID (env MCPCLI_CLIENT_ID)
--client-secret OAuth client secret (env MCPCLI_CLIENT_SECRET); also the bearer token
--env environment variable for stdio servers as KEY=VALUE (repeatable; VALUE may be a bws:// secret reference)
--timeout 30s timeout for network operations
--json false machine-readable JSON output
--plain false plain ASCII output, no emoji/colors/spinners
--trace false per-call round-trip timing report on stderr (see Round-trip timing)
--verbose false implies --trace; adds boot, client-internal time, and totals
-i, --interactive false start the interactive REPL

Round-trip timing (--trace)

--trace prints a per-call timing report on stderr after the result — which call was slow, how much traffic each direction carried, and (with --verbose) where the time went: process boot vs wire vs mcp's own work. stdout is never touched, so pipes and --json parsing stay clean; in --json mode the report is one structured trace document on stderr (rtt_ms, req_bytes, resp_bytes per call). Real capture against the jkudish server over stdio:

$ mcp --command "npx -y @jkudish/jev-mcp@0.14.7" --trace --verbose tools list
connect
┌───────────────┬──────┬────────────┬────┬──────┐
│CALL           │TIME  │BAR         │SENT│RECV  │
├───────────────┼──────┼────────────┼────┼──────┤
│boot (discover)│1.091s│▓▓▓▓▓▓▓▓▓▓▓▓│249B│206B  │
│tools/list     │13ms  │▓░░░░░░░░░░░│249B│23.7KB│
└───────────────┴──────┴────────────┴────┴──────┘
totals: wire 1.134s · internal 31ms · sent 498B · recv 23.9KB

Rendered:

The boot row is the connection handshake — on stdio it includes the server command's own startup (here npx resolving and booting the package, just over a second), because the child boots while the handshake waits. Bars scale against the run's slowest call. --plain swaps to an all-ASCII table without bars. compat gets one section per protocol probe. Traffic sizes are marshaled payload approximations (the few bytes of JSON-RPC frame overhead are not counted). Failed calls keep their row with a ❌ marker (! in --plain) and the error itself still reports through the normal error path.

Exit codes

0 on success, 1 on any failure (connect failure, bad input, tool isError, missing credentials, …). One exception: jev check --probe --probe-on-auth-error skip exits 0 when the provider rejects its key — the skipped battery is reported as data (see Jev judgment servers).

Known limitations

  • REPL input is split on whitespace; quoting is not supported, so a JSON-OBJ argument must be a single whitespace-free JSON object (e.g. call echo {"msg":"hi"}), and --outfile paths must likewise be whitespace-free.
  • Prompt arguments are strings per the MCP spec: --arg values are never JSON-decoded, and the REPL's get accepts only scalar (string/number/boolean) values.
  • stdio servers cannot authenticate (--auth is rejected with --command).
  • Some discovery-native servers (e.g. mcp.svelte.dev) do not implement the ping method on 2026-07-28 sessions: mcp ping then verifies liveness with the best declared-capability list request instead (tools/list → resources/list → prompts/list) and names the method it used (alive via tools/list, "via" in JSON). A server declaring neither ping nor any listable capability fails with a matching error; auth login verifies by the connect itself in that case.
  • compat runs unauthenticated and, over stateful streamable HTTP, its negotiated ("native") version may lag the server's newest supported version due to the SDK's SEP-2575 discovery filtering (see Protocol versions).
  • No browser is ever launched: the loopback OAuth flow prints the URL for you to open in your own browser; use --auth-flow manual where no browser is available.
  • Jev in the REPL covers the text-bearing forms only (jev ask/screen/verify with free text and --in-file slots — choice/score ask flags and jev check need quoting, so they stay one-shot); legostin is detect-and-doctor only (its tools drive Chrome and publish no schemas); the auth-class skip is a text heuristic — only recognized rejections/absences (401/402/403 token-bounded, "invalid/missing/no api key", payment/billing wording) skip, everything else still fails; jev gate --input on the command line is visible in process listings like any argument — use --input - (stdin) for sensitive tool arguments.
  • BWS secret references and mcp bws (see Bitwarden Secrets Manager):
    • a misspelled scheme stays a literal value — bwss://name expands to itself and nothing reports the misspelling;
    • refs resolve once at session open: a rotated secret needs a new run, and the REPL needs a restart;
    • multi-line secret values spill across KEY=value lines in bws get's human output;
    • a decrypted secret name that contains =, is empty, or carries a newline/CR breaks the KEY=value one-line premise;
    • exotic bytes beyond NUL (which is rejected) may misbehave downstream in exec environments or HTTP headers;
    • --plain governs mcp's decoration, never secret bytes — a secret VALUE is printed exactly as decrypted;
    • --env is validated on every command but expanded and injected only for stdio children — never on the bws verbs, compat, auth login, or HTTP runs / the --url REPL;
    • an organization with more secrets than one list page fails loud on the response's continuationToken (pagination is unsupported);
    • two secrets whose decrypted names collide emit duplicate KEY=value lines (env-file consumers apply them silently last-wins).

License

Copyright ConsulTent Pte. Ltd., all Rights Reserved. — https://consultent.ltd. All code is licensed under the GNU AGPL-3.0-or-later.

Directories

Path Synopsis
cmd
mcp command
Command mcp is an MCP (Model Context Protocol) client and inspector.
Command mcp is an MCP (Model Context Protocol) client and inspector.
internal
auth
Package auth provides the mcp auth provider registry and the built-in providers: none, bearer, client-credentials, and oauth.
Package auth provides the mcp auth provider registry and the built-in providers: none, bearer, client-credentials, and oauth.
bws
Package bws is a thin pure-Go REST client for Bitwarden Secrets Manager (BWS) machine accounts — the first secret.Source implementation.
Package bws is a thin pure-Go REST client for Bitwarden Secrets Manager (BWS) machine accounts — the first secret.Source implementation.
cli
Package cli assembles the mcp command tree.
Package cli assembles the mcp command tree.
connection
Package connection resolves MCP protocol versions and opens client sessions to MCP servers over stdio or streamable HTTP.
Package connection resolves MCP protocol versions and opens client sessions to MCP servers over stdio or streamable HTTP.
format
Package format turns MCP SDK result types into human- or machine-readable output.
Package format turns MCP SDK result types into human- or machine-readable output.
jev
Package jev adapts one canonical Jev question model onto the tool surfaces of the known Jev MCP servers ("flavors"), which share no tool naming.
Package jev adapts one canonical Jev question model onto the tool surfaces of the known Jev MCP servers ("flavors"), which share no tool naming.
secret
Package secret resolves secret references of the form <scheme>://<ref> against pluggable sources — the seam that lets mcpcli pull credentials from Bitwarden Secrets Manager (bws://) today and other secret managers later.
Package secret resolves secret references of the form <scheme>://<ref> against pluggable sources — the seam that lets mcpcli pull credentials from Bitwarden Secrets Manager (bws://) today and other secret managers later.
trace
Package trace collects round-trip timing for one mcp run: connection phases, every request/response call with approximate payload sizes, and totals.
Package trace collects round-trip timing for one mcp run: connection phases, every request/response call with approximate payload sizes, and totals.
ui
Package ui is mcp's light output layer: three decoration modes (Rich, Plain, JSON) over the go-gitmoji-cli UI stack (bubbletea, bubbles, lipgloss).
Package ui is mcp's light output layer: three decoration modes (Rich, Plain, JSON) over the go-gitmoji-cli UI stack (bubbletea, bubbles, lipgloss).
version
Package version holds mcp's version.
Package version holds mcp's version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL