| name | mcpc-mcp-client |
| description | Universal CLI client for Model Context Protocol (MCP) with persistent sessions, OAuth, tasks, and JSON output for shell scripting |
| triggers | ["how do I use mcpc to connect to an MCP server","set up an MCP client session with mcpc","call MCP tools from the command line","authenticate with OAuth for MCP servers","create a persistent MCP session","search for MCP tools across sessions","use mcpc in code mode for scripting","connect to local MCP server with mcpc"] |
mcpc MCP Client Skill
Skill by ara.so — MCP Skills collection.
Overview
mcpc is a universal command-line client for the Model Context Protocol (MCP) that maps MCP operations to intuitive shell commands. It enables interactive debugging, scripting workflows, and AI agent integration with MCP servers through persistent sessions, OAuth 2.1 authentication, and JSON output mode.
Key capabilities:
- Persistent sessions: Keep multiple stateful MCP connections alive simultaneously
- Full MCP support: Tools, resources, prompts, async tasks, instructions
- OAuth 2.1: Secure authentication with OS keychain credential storage
- Code mode: JSON output for shell pipelines (
jq, xargs, scripting)
- Progressive discovery: Search tools across sessions to save tokens
- MCP proxy: Share sessions across agents while protecting credentials
Installation
npm install -g @apify/mcpc
bun install -g @apify/mcpc
mcpc --version
Linux headless setup (if keychain is needed):
sudo apt-get install libsecret-1-0 gnome-keyring
dbus-run-session -- bash -c "echo -n 'password' | gnome-keyring-daemon --unlock && mcpc ..."
Core Commands
Session Management
mcpc
mcpc --json
mcpc connect mcp.apify.com @apify
mcpc connect https://mcp.example.com @example
mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./mcp-config.json:my-server @local
mcpc @apify
mcpc close @apify
mcpc restart @apify
mcpc @apify shell
Authentication
mcpc login mcp.apify.com
mcpc login mcp.apify.com --profile production
mcpc connect mcp.apify.com @apify --profile production
mcpc logout mcp.apify.com
mcpc logout mcp.apify.com --profile production
Tool Discovery and Search
mcpc grep "search"
mcpc grep "actor" --json
mcpc @apify grep "web scraping"
mcpc grep "search|find" -E
mcpc grep "Search" --case-sensitive
mcpc grep "data" -m 10
mcpc grep "config" --resources --prompts
MCP Operations
Tools
mcpc @apify tools-list
mcpc --json @apify tools-list
mcpc @apify tools-get search-actors
mcpc @apify tools-call search-actors keywords:="web scraper"
mcpc @apify tools-call search-actors keywords:="web scraper" limit:=5
mcpc @apify tools-call search-actors '{"keywords":"web scraper","limit":5}'
echo '{"keywords":"web scraper","limit":5}' | mcpc @apify tools-call search-actors
cat args.json | mcpc @apify tools-call search-actors
mcpc @apify tools-call get-item id:='"123"' flag:='"true"'
mcpc @apify tools-call create-actor 'config:={"timeout":300,"memory":512}'
Argument parsing rules:
key:=value auto-parses: numbers, booleans, objects stay typed
- Invalid JSON becomes a string:
name:=hello → "hello"
- Force string with quotes:
id:='"123"' → "123" (string)
- No spaces around
:=
- Quote shell expansions:
"query:=${VAR}"
Resources
mcpc @apify resources-list
mcpc @apify resources-read file:
mcpc @apify resources-subscribe file:
mcpc @apify resources-unsubscribe file:
mcpc @apify resources-templates-list
Prompts
mcpc @apify prompts-list
mcpc @apify prompts-get analyze-data dataset:="sales-2024"
mcpc @apify prompts-get analyze-data '{"dataset":"sales-2024","format":"csv"}'
echo '{"dataset":"sales-2024"}' | mcpc @apify prompts-get analyze-data
Async Tasks
mcpc @apify tasks-list
mcpc @apify tasks-get task-12345
mcpc @apify tasks-result task-12345
mcpc @apify tasks-cancel task-12345
Server Operations
mcpc @apify ping
mcpc @apify logging-set-level debug
mcpc @apify logging-set-level info
Code Mode (JSON Output)
Use --json flag for shell scripting and pipelines:
mcpc --json | jq '.sessions[] | select(.status == "connected")'
mcpc --json @apify tools-list | jq -r '.tools[].name'
mcpc --json @apify tools-list | jq '.tools[] | select(.description | contains("search"))'
RESULT=$(mcpc --json @apify tools-call search-actors keywords:="crawler")
echo "$RESULT" | jq '.content[0].text'
mcpc --json @apify tools-list | \
jq -r '.tools[].name' | \
xargs -I {} mcpc --json @apify tools-get {}
echo '["actor1","actor2","actor3"]' | \
jq -r '.[]' | \
xargs -I {} mcpc --json @apify tools-call get-actor actorId:="{}"
Configuration
MCP Config File Format
Reference local MCP servers via config files (Claude Desktop format):
{
"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}"
}
}
}
}
Connect to entries:
mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./config.json:postgres @db
Environment Variables
export DATABASE_URL="postgresql://user:pass@localhost/db"
export API_KEY="your-api-key"
export MCPC_TIMEOUT=600
export MCPC_MAX_CHARS=10000
Global Options
mcpc @apify tools-call long-task --timeout 600
mcpc @apify tools-call verbose-tool --max-chars 5000
mcpc connect https://localhost:3000 @local --insecure
mcpc --verbose @apify tools-call search-actors keywords:="test"
mcpc connect mcp.apify.com @apify --profile staging
AI Agent Integration
Bash Tool Pattern
Give agents a single Bash() tool with mcpc in scope:
const bashTool = {
name: "bash",
description: "Execute bash commands. mcpc is available for MCP operations.",
parameters: {
command: { type: "string", description: "Bash command to execute" }
}
};
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'");
Shared Sessions
Multiple agents can share the same mcpc sessions:
mcpc connect mcp.apify.com @shared
mcpc @shared tools-list
mcpc @shared tools-call search-actors keywords:="data"
MCP Proxy Mode
Protect credentials from AI-generated code:
mcpc connect mcp.apify.com @apify
mcpc @apify tools-call search-actors keywords:="test"
Common Patterns
Discovery Workflow
mcpc connect mcp.apify.com @apify
mcpc @apify grep "search"
mcpc @apify tools-get search-actors
mcpc @apify tools-call search-actors keywords:="web crawler"
Scripting Workflow
#!/bin/bash
set -e
mcpc connect mcp.apify.com @apify 2>/dev/null || true
ACTORS=$(mcpc --json @apify tools-call search-actors keywords:="crawler")
echo "$ACTORS" | jq -r '.content[0].text | fromjson | .items[].id' | while read -r ID; do
mcpc --json @apify tools-call get-actor actorId:="$ID"
done
Multi-Server Orchestration
mcpc connect mcp.apify.com @apify
mcpc connect ~/.vscode/mcp.json:filesystem @fs
mcpc connect ./config.json:database @db
mcpc grep "search" --json | jq -r '.results[] | "\(.session): \(.item.name)"'
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
Progressive Tool Discovery
mcpc grep "actor" --json | jq -r '.results[].item.name' | head -3
mcpc @apify tools-get search-actors
mcpc @apify tools-call search-actors keywords:="web scraping"
Troubleshooting
Session Issues
mcpc
mcpc --json | jq '.sessions[] | {name, status}'
mcpc restart @apify
mcpc clean sessions
mcpc --verbose connect mcp.apify.com @apify
Authentication Issues
mcpc logout mcp.apify.com
mcpc login mcp.apify.com
mcpc login mcp.apify.com --profile staging
mcpc connect mcp.apify.com @apify --profile staging
mcpc --json | jq '.profiles'
secret-tool search service mcpc
mcpc clean profiles
Tool Call Issues
mcpc @apify tools-get search-actors
echo '{"keywords":"test"}' | jq .
mcpc --verbose @apify tools-call search-actors keywords:="test"
mcpc @apify tools-call test-tool \
string:="hello" \
number:=42 \
bool:=true \
obj:='{"key":"value"}' \
arr:='[1,2,3]'
Timeout Issues
mcpc @apify tools-call long-task --timeout 600
TASK_ID=$(mcpc --json @apify tools-call start-task | jq -r '.taskId')
mcpc @apify tasks-result "$TASK_ID"
Credentials on Linux
dbus-run-session -- bash -c "
echo -n 'password' | gnome-keyring-daemon --unlock
mcpc login mcp.apify.com
"
ls -la ~/.mcpc/credentials
Clean Up
mcpc clean sessions
mcpc clean profiles
mcpc clean logs
mcpc clean all
rm -rf ~/.mcpc/sessions/*
rm -rf ~/.mcpc/logs/*
Advanced Usage
Custom Timeout and Limits
mcpc @apify tools-call slow-operation --timeout 900
mcpc @apify tools-call get-logs --max-chars 10000
mcpc --json --verbose --timeout 600 @apify tools-call complex-task
Resource Subscriptions
mcpc @apify resources-subscribe config://app-settings
mcpc @apify resources-subscribe config://app-settings &
mcpc @apify resources-unsubscribe config://app-settings
Interactive Shell Commands
mcpc @apify shell
Use arrow keys for history, Ctrl+C to cancel, Ctrl+D or exit to quit.
Security Notes
- OAuth tokens stored in OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service)
- Fallback to
~/.mcpc/credentials (mode 0600) on headless Linux
- Use
--insecure only for self-signed certs in dev environments
- Environment variables in config files:
"${VAR_NAME}"
- Never commit credentials or
~/.mcpc/credentials to version control