Loading...
Loading...
Universal CLI client for Model Context Protocol (MCP) with persistent sessions, OAuth, tasks, and JSON output for shell scripting
npx skill4agent add aradotso/mcp-skills mcpc-mcp-clientSkill by ara.so — MCP Skills collection.
mcpcjqxargs# Install globally via npm
npm install -g @apify/mcpc
# Or with Bun
bun install -g @apify/mcpc
# Verify installation
mcpc --version# Install dependencies
sudo apt-get install libsecret-1-0 gnome-keyring
# Run with keychain
dbus-run-session -- bash -c "echo -n 'password' | gnome-keyring-daemon --unlock && mcpc ..."# List all active sessions and OAuth profiles
mcpc
mcpc --json # JSON output for scripting
# Connect to remote MCP server (HTTPS)
mcpc connect mcp.apify.com @apify
mcpc connect https://mcp.example.com @example
# Connect to local MCP server via config file
mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./mcp-config.json:my-server @local
# Show session info (capabilities, tools overview)
mcpc @apify
# Close a session
mcpc close @apify
# Restart session (loses state)
mcpc restart @apify
# Interactive shell
mcpc @apify shell# Login with OAuth and save profile
mcpc login mcp.apify.com
mcpc login mcp.apify.com --profile production
# Use saved profile when connecting
mcpc connect mcp.apify.com @apify --profile production
# Logout (delete OAuth profile)
mcpc logout mcp.apify.com
mcpc logout mcp.apify.com --profile production# Search tools and instructions across all sessions
mcpc grep "search"
mcpc grep "actor" --json
# Search within a single session
mcpc @apify grep "web scraping"
# Search with regex
mcpc grep "search|find" -E
# Case-sensitive search
mcpc grep "Search" --case-sensitive
# Limit results
mcpc grep "data" -m 10
# Search resources and prompts
mcpc grep "config" --resources --prompts// List all tools
mcpc @apify tools-list
mcpc --json @apify tools-list // JSON output
// Get tool details and schema
mcpc @apify tools-get search-actors
// Call tool with key:=value arguments
mcpc @apify tools-call search-actors keywords:="web scraper"
mcpc @apify tools-call search-actors keywords:="web scraper" limit:=5
// Call with JSON object
mcpc @apify tools-call search-actors '{"keywords":"web scraper","limit":5}'
// Call with stdin
echo '{"keywords":"web scraper","limit":5}' | mcpc @apify tools-call search-actors
cat args.json | mcpc @apify tools-call search-actors
// Force string type with JSON quotes
mcpc @apify tools-call get-item id:='"123"' flag:='"true"'
// Complex nested arguments
mcpc @apify tools-call create-actor 'config:={"timeout":300,"memory":512}'key:=valuename:=hello"hello"id:='"123"'"123":="query:=${VAR}"// List resources
mcpc @apify resources-list
// Read resource
mcpc @apify resources-read file:///path/to/resource
// Subscribe to resource updates
mcpc @apify resources-subscribe file:///config.json
// Unsubscribe
mcpc @apify resources-unsubscribe file:///config.json
// List resource templates
mcpc @apify resources-templates-list// List prompts
mcpc @apify prompts-list
// Get prompt with arguments
mcpc @apify prompts-get analyze-data dataset:="sales-2024"
mcpc @apify prompts-get analyze-data '{"dataset":"sales-2024","format":"csv"}'
// Pipe arguments
echo '{"dataset":"sales-2024"}' | mcpc @apify prompts-get analyze-data// List tasks
mcpc @apify tasks-list
// Get task status
mcpc @apify tasks-get task-12345
// Get task result (waits for completion)
mcpc @apify tasks-result task-12345
// Cancel task
mcpc @apify tasks-cancel task-12345// Ping server
mcpc @apify ping
// Set logging level
mcpc @apify logging-set-level debug
mcpc @apify logging-set-level info--json# Get session list as JSON
mcpc --json | jq '.sessions[] | select(.status == "connected")'
# Extract tool names
mcpc --json @apify tools-list | jq -r '.tools[].name'
# Filter tools by category
mcpc --json @apify tools-list | jq '.tools[] | select(.description | contains("search"))'
# Call tool and parse result
RESULT=$(mcpc --json @apify tools-call search-actors keywords:="crawler")
echo "$RESULT" | jq '.content[0].text'
# Chain multiple operations
mcpc --json @apify tools-list | \
jq -r '.tools[].name' | \
xargs -I {} mcpc --json @apify tools-get {}
# Batch process with jq + xargs
echo '["actor1","actor2","actor3"]' | \
jq -r '.[]' | \
xargs -I {} mcpc --json @apify tools-call get-actor actorId:="{}"{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
},
"postgres": {
"command": "node",
"args": ["/path/to/postgres-server/dist/index.js"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./config.json:postgres @db# Use in MCP config files
export DATABASE_URL="postgresql://user:pass@localhost/db"
export API_KEY="your-api-key"
# mcpc options via env
export MCPC_TIMEOUT=600
export MCPC_MAX_CHARS=10000# Request timeout
mcpc @apify tools-call long-task --timeout 600
# Truncate output
mcpc @apify tools-call verbose-tool --max-chars 5000
# Skip TLS verification (self-signed certs)
mcpc connect https://localhost:3000 @local --insecure
# Debug logging
mcpc --verbose @apify tools-call search-actors keywords:="test"
# Use specific OAuth profile
mcpc connect mcp.apify.com @apify --profile stagingBash()mcpc// Agent tool definition
const bashTool = {
name: "bash",
description: "Execute bash commands. mcpc is available for MCP operations.",
parameters: {
command: { type: "string", description: "Bash command to execute" }
}
};
// Agent can now use MCP naturally
await bash("mcpc connect mcp.apify.com @apify");
await bash("mcpc @apify grep 'web scraping'");
await bash("mcpc --json @apify tools-call search-actors keywords:='crawler' | jq -r '.content[0].text'");mcpc# Agent 1: Create session
mcpc connect mcp.apify.com @shared
# Agent 2: Use same session
mcpc @shared tools-list
# Agent 3: Call tools
mcpc @shared tools-call search-actors keywords:="data"# Start proxy in trusted environment
mcpc connect mcp.apify.com @apify
# Share session name with agent, not credentials
# Agent uses proxy without OAuth access
mcpc @apify tools-call search-actors keywords:="test"# 1. Connect to server
mcpc connect mcp.apify.com @apify
# 2. Search for relevant tools
mcpc @apify grep "search"
# 3. Get tool details
mcpc @apify tools-get search-actors
# 4. Call tool
mcpc @apify tools-call search-actors keywords:="web crawler"#!/bin/bash
set -e
# Connect if not already connected
mcpc connect mcp.apify.com @apify 2>/dev/null || true
# Search for actors
ACTORS=$(mcpc --json @apify tools-call search-actors keywords:="crawler")
# Extract actor IDs
echo "$ACTORS" | jq -r '.content[0].text | fromjson | .items[].id' | while read -r ID; do
# Get details for each actor
mcpc --json @apify tools-call get-actor actorId:="$ID"
done# Connect to multiple servers
mcpc connect mcp.apify.com @apify
mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./config.json:database @db
# Search across all
mcpc grep "search" --json | jq -r '.results[] | "\(.session): \(.item.name)"'
# Coordinate operations
DATA=$(mcpc --json @fs tools-call read-file path:="/data/input.json")
RESULT=$(echo "$DATA" | mcpc @apify tools-call process-data)
echo "$RESULT" | mcpc @db tools-call store-result# Start broad, refine as needed
mcpc grep "actor" --json | jq -r '.results[].item.name' | head -3
# Get details only for relevant tools
mcpc @apify tools-get search-actors
# Call with minimal context
mcpc @apify tools-call search-actors keywords:="web scraping"# Check session status
mcpc
mcpc --json | jq '.sessions[] | {name, status}'
# Restart crashed session
mcpc restart @apify
# Clean stale sessions
mcpc clean sessions
# Debug connection
mcpc --verbose connect mcp.apify.com @apify# Re-authenticate
mcpc logout mcp.apify.com
mcpc login mcp.apify.com
# Use different profile
mcpc login mcp.apify.com --profile staging
mcpc connect mcp.apify.com @apify --profile staging
# Check saved profiles
mcpc --json | jq '.profiles'
# Linux: verify keychain
secret-tool search service mcpc
# Clean credentials
mcpc clean profiles# Get tool schema first
mcpc @apify tools-get search-actors
# Validate arguments
echo '{"keywords":"test"}' | jq . # Validate JSON
# Debug with verbose
mcpc --verbose @apify tools-call search-actors keywords:="test"
# Check argument parsing
mcpc @apify tools-call test-tool \
string:="hello" \
number:=42 \
bool:=true \
obj:='{"key":"value"}' \
arr:='[1,2,3]'# Increase timeout
mcpc @apify tools-call long-task --timeout 600
# For async tasks, use tasks-result
TASK_ID=$(mcpc --json @apify tools-call start-task | jq -r '.taskId')
mcpc @apify tasks-result "$TASK_ID" # Waits for completion# If keychain fails, mcpc falls back to ~/.mcpc/credentials
# Force keychain with gnome-keyring
dbus-run-session -- bash -c "
echo -n 'password' | gnome-keyring-daemon --unlock
mcpc login mcp.apify.com
"
# Check file-based credentials (mode 0600)
ls -la ~/.mcpc/credentials# Clean specific resources
mcpc clean sessions # Close all sessions
mcpc clean profiles # Delete OAuth profiles
mcpc clean logs # Remove old log files
mcpc clean all # Everything
# Manual cleanup
rm -rf ~/.mcpc/sessions/*
rm -rf ~/.mcpc/logs/*# Per-command timeout
mcpc @apify tools-call slow-operation --timeout 900
# Truncate verbose output
mcpc @apify tools-call get-logs --max-chars 10000
# Combine options
mcpc --json --verbose --timeout 600 @apify tools-call complex-task# Subscribe to config changes
mcpc @apify resources-subscribe config://app-settings
# Monitor in background, process updates
mcpc @apify resources-subscribe config://app-settings &
# Updates arrive asynchronously
# Unsubscribe when done
mcpc @apify resources-unsubscribe config://app-settingsmcpc @apify shell
# Inside shell:
# > help
# > tools-list
# > tools-call search-actors keywords:="crawler"
# > exitexit~/.mcpc/credentials0600--insecure"${VAR_NAME}"~/.mcpc/credentials