CLI Reference

Complete command reference for the MCP Client CLI, including all commands, flags, and usage examples.

The MCP Client CLI binary is named mcp. All commands follow the pattern:

mcp <command> [subcommand] [flags] [arguments]

Global Flags

These flags are available on every command:

FlagShortTypeDefaultDescription
--registrystringhttps://registry.mcp-hub.ioRegistry endpoint URL
--cache-dirstring~/.mcp/cacheLocal cache directory
--verbose-vboolfalseEnable verbose (debug) output
--jsonboolfalseOutput in JSON format
--config-cstring~/.mcp/config.yamlPath to configuration file
--timeoutduration5mDefault timeout for operations
--help-hboolShow help for any command

Precedence order: CLI flags override environment variables, which override the configuration file.


mcp run

Execute an MCP server from a package reference.

Synopsis

mcp run <reference> [flags]

The run command resolves a package from the registry, downloads and validates it if not cached, enforces security policies, and launches the MCP server in a sandboxed process with resource limits.

Package Reference Formats

FormatExampleDescription
org/name@versionacme/[email protected]Resolve by semantic version
org/name@sha256:...acme/my-tool@sha256:a1b2c3...Pin to exact content digest
org/name@latestacme/my-tool@latestResolve latest version (not recommended for production)

Flags

FlagTypeDefaultDescription
--min-cert-levelint0Minimum required certification level (0-3)
--allowed-originsstringsOfficial,Verified,CommunityComma-separated list of allowed origin types
--max-memorystring256mMaximum memory limit (e.g., 512m, 1g)
--max-cpufloat1.0Maximum CPU cores
--max-pidsint64Maximum number of child processes
--max-fdsint256Maximum open file descriptors
--networkstringdenyNetwork policy: deny or allow (Linux only)
--timeoutduration5mExecution timeout
--envstringsEnvironment variables to pass (e.g., --env KEY=VALUE)
--env-filestringPath to an environment file
--workdirstringautoWorking directory for the server process
--dry-runboolfalseValidate policies without executing

Examples

# Run with default settings
mcp run acme/[email protected]

# Require Security Certified level
mcp run acme/[email protected] --min-cert-level 2

# Only allow Official and Verified packages
mcp run acme/[email protected] --allowed-origins Official,Verified

# Set resource limits
mcp run acme/[email protected] --max-memory 1g --max-cpu 2.0 --max-pids 128

# Pass environment variables
mcp run acme/[email protected] --env DATABASE_URL=postgres://... --env API_KEY=secret

# Dry run (validate policies only, do not execute)
mcp run acme/[email protected] --dry-run

# Pin to exact digest for reproducibility
mcp run acme/hello-world@sha256:a1b2c3d4e5f67890...

Exit Codes

CodeMeaning
0Server exited cleanly
1General error
2Policy violation (cert level, origin, etc.)
3Sandbox setup failure
4Download or validation failure
124Timeout exceeded
137Killed by resource limit (OOM)

mcp pull

Download a package to the local cache without executing it.

Synopsis

mcp pull <reference> [flags]

The pull command is useful for pre-populating caches in CI/CD environments or for offline use. It downloads the manifest and bundle, validates SHA-256 digests, and stores them in the content-addressed cache.

Flags

FlagTypeDefaultDescription
--forceboolfalseRe-download even if already cached
--verify-onlyboolfalseVerify cached artifact integrity without downloading

Examples

# Pull a specific version
mcp pull acme/[email protected]

# Force re-download
mcp pull acme/[email protected] --force

# Verify an already-cached artifact
mcp pull acme/[email protected] --verify-only

# Pull with JSON output (useful for scripting)
mcp pull acme/[email protected] --json

Output

Resolving acme/[email protected]...
  Manifest:  sha256:a1b2c3d4e5f6...
  Bundle:    sha256:f6e5d4c3b2a1...
  Cert Level: 2 (Security Certified)

Downloading bundle... 2.3 MB
Validating SHA-256 digest... OK

Cached: ~/.mcp/cache/sha256/a1b2c3d4e5f6...

mcp push

Publish an MCP package to MCP Hub for certification.

Synopsis

mcp push <org/name@version> [flags]

The push command packages your MCP server source code, uploads it to MCP Hub, and initiates the certification pipeline. You must be authenticated (mcp login) before pushing.

Flags

FlagTypeDefaultDescription
--sourcestring. (current directory)Path to the MCP server source code
--hubstringhttps://mcp-hub.ioMCP Hub URL (not the registry)
--languagestringauto-detectPrimary language (python, typescript, javascript, go)
--descriptionstringShort description of the MCP server
--excludestringsGlob patterns to exclude from upload

Examples

# Push from current directory
mcp push acme/[email protected]

# Push from a specific directory
mcp push acme/[email protected] --source ./dist

# Push with explicit language
mcp push acme/[email protected] --source ./src --language python

# Push to a local hub instance
mcp push acme/[email protected] --hub http://localhost:8080

# Exclude test files
mcp push acme/[email protected] --exclude "**/*_test.go" --exclude "**/testdata/**"

Output

Packaging acme/[email protected]...
  Source: ./dist (14 files, 45 KB)
  Language: python (auto-detected)

Uploading to https://mcp-hub.io...
  Upload: 45 KB / 45 KB [====================] 100%

Certification initiated.
  Job ID: job-abc123
  Track at: https://mcp-hub.io/mcps/acme/my-tool/versions/1.0.0

Use 'mcp info acme/[email protected]' to check certification status.

mcp info

Display detailed information about a package.

Synopsis

mcp info <reference> [flags]

The info command queries the registry for package metadata including the manifest, certification level, score, origin, tools, resources, and findings summary.

Flags

FlagTypeDefaultDescription
--auth-statusboolfalseShow authentication status instead of package info
--show-findingsboolfalseInclude detailed findings in output

Examples

# Show package information
mcp info acme/[email protected]

# Show detailed findings
mcp info acme/[email protected] --show-findings

# Check auth status
mcp info --auth-status

# JSON output for scripting
mcp info acme/[email protected] --json

Output

Package:       acme/[email protected]
Manifest:      sha256:a1b2c3d4e5f6...
Bundle:        sha256:f6e5d4c3b2a1...
Cert Level:    2 (Security Certified)
Score:         85/100
Origin:        Verified
Language:      Python 3.11
Transport:     STDIO
Published:     2025-01-10T14:30:00Z

Tools:
  - greet          Greet a user by name
  - farewell       Say goodbye to a user

Resources:
  - templates/     Greeting templates directory

Findings Summary:
  Critical: 0  High: 0  Medium: 2  Low: 5

mcp login

Authenticate with the registry.

Synopsis

mcp login [flags]

The login command stores authentication credentials in ~/.mcp/auth.json with 0600 permissions. It supports interactive login (prompts for credentials) and token-based login for CI/CD.

Flags

FlagTypeDefaultDescription
--registrystringfrom configRegistry URL to authenticate with
--tokenstringProvide token directly (non-interactive)
--usernamestringUsername for interactive login

Examples

# Interactive login (prompts for credentials)
mcp login

# Login with a specific registry
mcp login --registry https://registry.mcp-hub.io

# Non-interactive login with token (for CI/CD)
mcp login --token $MCP_REGISTRY_TOKEN

# Login to a local registry
mcp login --registry http://localhost:8081

Token Storage

Auth tokens are stored in ~/.mcp/auth.json:

{
  "registries": {
    "https://registry.mcp-hub.io": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
      "created_at": "2025-01-15T10:00:00Z"
    }
  }
}

The file is created with 0600 permissions (owner read/write only). Tokens are not auto-refreshed; run mcp login again when a token expires.


mcp logout

Remove stored authentication credentials.

Synopsis

mcp logout [flags]

Flags

FlagTypeDefaultDescription
--registrystringallRemove credentials for a specific registry only
--allboolfalseRemove all stored credentials

Examples

# Remove credentials for the default registry
mcp logout

# Remove credentials for a specific registry
mcp logout --registry https://registry.mcp-hub.io

# Remove all stored credentials
mcp logout --all

mcp cache ls

List cached artifacts.

Synopsis

mcp cache ls [flags]

Flags

FlagTypeDefaultDescription
--sortstringtimeSort order: time, size, name
--longboolfalseShow detailed information including digests

Examples

# List cached packages
mcp cache ls

# Detailed listing with digests
mcp cache ls --long

# JSON output
mcp cache ls --json

Output

PACKAGE                        VERSION   SIZE    CACHED
acme/hello-world               1.0.0     2.3 MB  2025-01-15 10:30
acme/data-processor            2.1.0     8.7 MB  2025-01-14 15:45
corp/internal-tool             0.5.2     1.1 MB  2025-01-13 09:20

Total: 3 packages, 12.1 MB

mcp cache rm

Remove cached artifacts.

Synopsis

mcp cache rm [reference|--all] [flags]

Flags

FlagTypeDefaultDescription
--allboolfalseRemove all cached artifacts
--digeststringRemove a specific digest
--older-thandurationRemove artifacts older than the specified duration
--forceboolfalseSkip confirmation prompt

Examples

# Remove a specific package from cache
mcp cache rm acme/[email protected]

# Remove a specific digest
mcp cache rm --digest sha256:a1b2c3d4e5f6...

# Remove all cached artifacts
mcp cache rm --all

# Remove artifacts older than 30 days
mcp cache rm --older-than 720h

# Skip confirmation
mcp cache rm --all --force

mcp doctor

Diagnose system sandbox capabilities and connectivity.

Synopsis

mcp doctor [flags]

The doctor command checks your system for sandbox capabilities, registry connectivity, cache health, and configuration validity. Use it to diagnose issues before running MCP servers.

Flags

FlagTypeDefaultDescription
--registrystringfrom configOverride registry URL to test
--fixboolfalseAttempt to fix detected issues (e.g., create missing directories)

Examples

# Full system diagnostic
mcp doctor

# Test a specific registry
mcp doctor --registry http://localhost:8081

# Attempt to fix detected issues
mcp doctor --fix

# JSON output for automation
mcp doctor --json

Diagnostic Checks

The doctor command evaluates the following:

CheckDescription
PlatformOS, architecture, and Go version
Resource Limitscgroups v2 (Linux), rlimits, Job Objects (Windows)
Network IsolationNetwork namespaces (Linux only)
Filesystem IsolationBind mounts, Landlock (Linux), UNIX perms (macOS)
Subprocess Controlseccomp (Linux)
Registry ConnectivityHTTP(S) connection and latency to registry
Cache DirectoryExistence, permissions, disk space
ConfigurationConfig file syntax and validity
Auth TokensToken presence and file permissions

Exit Codes

CodeMeaning
0All checks passed
1One or more warnings (non-fatal)
2One or more errors (action required)