Skip to main content

CLI for managing and interacting with MCP (Model Context Protocol) servers

Project description

mcpctl

CLI for managing and interacting with MCP (Model Context Protocol) servers.

Installation

# From PyPI
pip install mcpctl

# With Redis support
pip install mcpctl[redis]

# With semantic search support
pip install mcpctl[semantic]

# For development
git clone https://github.com/thehumanworks/mcpctl
cd mcpctl
pip install -e .

Quick Start

# Add an HTTP server
mcpctl registry add myserver --transport http --url https://mcp.example.com

# Add a stdio server
mcpctl registry add local-server --transport stdio --cmd "npx my-mcp-server"

# List registered servers
mcpctl registry list

# Ping a server
mcpctl ping myserver

# List available tools
mcpctl tools myserver

# Call a tool
mcpctl call myserver my_tool --arg key=value --arg data:='{"nested": true}'

Environment Variables

Registry Storage

By default, mcpctl uses in-memory storage (non-persistent). Configure persistent storage with:

Variable Description
MCPCTL_REGISTRY_DISK_PATH Path to directory for disk-based storage
MCPCTL_REGISTRY_REDIS_URL Redis URL for distributed storage (supports redis:// and rediss:// for SSL)
# Use disk storage
export MCPCTL_REGISTRY_DISK_PATH=~/.mcpctl

# Use Redis
export MCPCTL_REGISTRY_REDIS_URL=redis://localhost:6379/0

# Use Redis with SSL
export MCPCTL_REGISTRY_REDIS_URL=rediss://user:pass@redis.example.com:6379/0

Authentication

For servers using Bearer token authentication, set the token in an environment variable and reference it when adding the server:

export MY_API_TOKEN=sk-xxx
mcpctl registry add myserver --transport http --url https://api.example.com --bearer-env MY_API_TOKEN

Commands

Registry Management

# Add a server
mcpctl registry add <name> --transport <http|stdio> [options]

# HTTP transport options
--url <url>              # Server URL (required for http)
--oauth                  # Enable OAuth authentication
--bearer-env <var>       # Environment variable containing Bearer token

# Stdio transport options
--cmd <command>          # Command to run (required for stdio)
--cmd-args <args>        # Additional arguments (can be repeated)
--env <KEY=VALUE>        # Environment variables for the process
--cwd <path>             # Working directory

# List all servers
mcpctl registry list

# Show server config
mcpctl registry get <name>

# Remove a server
mcpctl registry delete <name>

Server Operations

# Test server connectivity
mcpctl ping <server>

# Authenticate (for OAuth servers)
mcpctl auth <server>

Tools

# List all tools
mcpctl tools <server>

# Show tool details
mcpctl tools <server> <tool_name>

# List as JSON
mcpctl tools <server> --json-out

# Call a tool
mcpctl call <server> <tool> [--arg key=value] [--arg key:=json]

Argument Syntax

  • key=value - Auto-detects type (int, float, bool, null, string)
  • key:=json - Explicit JSON parsing for objects/arrays
# String
--arg name=John

# Number (auto-detected)
--arg count=42

# Boolean
--arg enabled=true

# Explicit JSON object
--arg config:='{"timeout": 30}'

# Explicit JSON array
--arg items:='["a", "b", "c"]'

Resources

# List resources
mcpctl resources <server> --list

# List resource templates
mcpctl resources <server> --templates

# Read a resource
mcpctl resources <server> --uri <uri>

Prompts

# List prompts
mcpctl prompts <server> --list

# Get prompt details
mcpctl prompts <server> --name <prompt_name>

Discovery

# Discover tools across all servers
mcpctl discover

# Search for specific tools
mcpctl discover --query "search term"

Transport Types

HTTP

For remote MCP servers accessible via HTTP/HTTPS:

mcpctl registry add remote --transport http --url https://mcp.example.com

With OAuth:

mcpctl registry add oauth-server --transport http --url https://mcp.example.com --oauth
mcpctl auth oauth-server  # Complete OAuth flow

With Bearer token:

export API_KEY=your-token
mcpctl registry add api-server --transport http --url https://api.example.com --bearer-env API_KEY

Stdio

For local MCP servers that communicate via stdin/stdout:

# Simple command
mcpctl registry add local --transport stdio --cmd "my-mcp-server"

# With arguments
mcpctl registry add local --transport stdio --cmd my-mcp --cmd-args --port --cmd-args 8080

# Command with spaces (auto-split)
mcpctl registry add local --transport stdio --cmd "npx @modelcontextprotocol/server-filesystem /tmp"

# With environment variables
mcpctl registry add local --transport stdio --cmd my-mcp --env API_KEY=secret --env DEBUG=1

# With working directory
mcpctl registry add local --transport stdio --cmd ./server.py --cwd /path/to/project

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpctl-0.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcpctl-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file mcpctl-0.1.0.tar.gz.

File metadata

  • Download URL: mcpctl-0.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mcpctl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c7b0eaed4be028c01c94fae96d7108948effd6af8a6d156558c7cc030316d19
MD5 9363e0ea2e6db0d4d0f5b5dc474342c5
BLAKE2b-256 f8f19413174d10485c3834232231268fdfc33d4d0306afa3eca4b1c1c91fe74e

See more details on using hashes here.

File details

Details for the file mcpctl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcpctl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mcpctl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63e3b580a136a53fdbf4f08b9a9cf4165fcd9024bdd9cef26f92de990de30e7c
MD5 84a7baff60eb9cbddd2b8eb5ee95cf24
BLAKE2b-256 3ae3ca84cfdc79743a1dcdb59f3bcd9ffcca771b37c19460e788ae6421592db1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page