Using mcpc to Interact with MCP Servers

VerifiedCaution

Use mcpc to interact with MCP servers from the command line: call tools, read resources, and get prompts. Helps when you need to programmatically access MCP capabilities using shell commands, with support for persistent sessions and JSON output for scripting. Prefer key:=value argument bindings over inline JSON for cleaner commands.

Sby Skills Guide Bot
DevelopmentIntermediate
3/4/2026
Claude CodeCursorWindsurfCopilotCodex
#mcp#cli#tool-calling#automation#api-integration

Recommended for

Automated summary

Explains how to use the mcpc command-line client to call tools, read resources, and fetch prompts from MCP servers, including sessions and authentication.

Strengths

  • Provides a compact command reference for listing and calling tools, resources, and prompts.
  • Prefers key:=value bindings and --json output, making scripting and jq pipelines practical.
  • Covers persistent sessions and live/crashed/expired states to reduce reconnection overhead.
  • Includes a clear trust model for read-only actions versus writes and OAuth.

Limitations

  • Requires mcpc to be installed and target MCP servers to be configured or reachable.
  • OAuth login must be initiated manually in the foreground, so fully automated login is not supported.
  • Expired or crashed sessions may need close/restart and can add friction to scripts.
When to use it

Use when an agent needs to interact with an MCP server from the terminal to discover or call its tools, resources, or prompts.

When not to use it

Avoid when mcpc is unavailable, when the action requires unattended interactive authentication, or when the environment already offers native MCP integration.

Security analysis

Caution
Quality score80/100

Nothing here is destructive, obfuscated, or exfiltrating: no curl|sh, no rm -rf, no base64 payloads, no attempts to disable safety, and the token is only forwarded to the intended server. The skill is essentially CLI documentation with explicit read-only / ask-first / never guardrails. Because it legitimately wields bash, outbound network, OAuth profiles, and write-capable tool calls, 'caution' rather than 'safe' is the accurate rating; the token-on-argv pattern is the main hygiene concern.

Findings
  • •Skill drives a CLI that performs network connections to remote MCP servers and can invoke tools with write side effects (`tools-call`), so execution risk exists but is scoped by the documented trust pattern.
  • •Bearer-token examples pass credentials on the command line (`-H "Authorization: Bearer $TOKEN"`), which can leak into shell history, process listings, or logs even though no exfiltration is intended.
  • •Preflight Python snippet reads `~/.mcpc/profiles.json` from the home directory; read-only and local, but it inspects stored credential/profile metadata.
  • •`Bash(node dist/cli/index.js:*)` allows running a local build script outside the packaged binary, widening the executable surface slightly.
  • •Connecting to arbitrary external servers / `login` flows is described; the skill itself correctly requires human-initiated foreground OAuth and forbids backgrounding or auto-opening browsers.
How this analysis is made

Examples

List MCP tools
Use mcpc to connect to mcp.apify.com as the @apify session, list its available tools, and show the result as JSON.
Call a tool with key:=value
Using mcpc against the @apify session, call the search tool with query:="test" and limit:=5, then pipe the JSON output to jq to extract the first text content.
Read an MCP resource
Connect to localhost:8080 with mcpc and read the resource at the URI returned by resources-list; show me the raw output.

name: using-mcp-tools-with-mcpc description: Use mcpc CLI to interact with MCP servers - call tools, read resources, get prompts. Use when working with Model Context Protocol servers, calling MCP tools, or accessing MCP resources programmatically; prefer key:=value bindings over raw JSON bodies. allowed-tools: Bash(mcpc:) Bash(node dist/cli/index.js:) Read Grep

mcpc: MCP command-line client

Use mcpc to interact with MCP (Model Context Protocol) servers from the command line. This is more efficient than function calling - generate shell commands instead.

Trust pattern

  • Always: Read-only mcpc commands in the sandbox (e.g., tools-list, tools-get, resources-list/read, prompts-list/get, tools-call for read/search-only endpoints), session status checks, and commands that reuse already-created auth profiles.
  • Ask: Anything that writes or needs network/OAuth (login/logout must be human-initiated in the foreground), connecting to new servers, commands that create/update/delete data, helper scripts that write files, or when sandbox blocks the command.
  • Never: Destructive workspace actions (moves/deletes) without explicit user request; connecting to unknown MCP servers without instruction; backgrounding mcpc <server> login or trying to auto-open a browser.

Quick reference

# List sessions and auth profiles
mcpc

# Show server info
mcpc <server>
mcpc @<session>

# Tools
mcpc <target> tools-list
mcpc <target> tools-get <tool-name>
mcpc <target> tools-call <tool-name> key:=value key2:="string value"

# Resources
mcpc <target> resources-list
mcpc <target> resources-read <uri>

# Prompts
mcpc <target> prompts-list
mcpc <target> prompts-get <prompt-name> arg1:=value1

# Sessions (persistent connections)
mcpc <server> connect @<name>
mcpc @<name> <command>
mcpc @<name> close

# Authentication
mcpc <server> login
mcpc <server> logout

Target types

  • mcp.example.com - Direct HTTPS connection to remote server
  • localhost:8080 or 127.0.0.1:8080 - Local HTTP server (http:// is default for localhost)
  • @session-name - Named persistent session (faster, maintains state)
  • config-entry - Entry from config file (with --config)

Passing arguments

Prefer key:=value bindings. Use inline JSON only when needed (e.g., first-arg object or complex arrays):

# String values
mcpc @s tools-call search query:="hello world"

# Numbers, booleans, null (auto-parsed as JSON)
mcpc @s tools-call search query:="hello" limit:=10 enabled:=true

# Complex JSON values
mcpc @s tools-call search config:='{"nested":"value"}' items:='[1,2,3]'

# Force string type with JSON quotes
mcpc @s tools-call search id:='"123"'

# Inline JSON object (if first arg starts with { or [)
mcpc @s tools-call search '{"query":"hello","limit":10}'

# From stdin (auto-detected when piped)
echo '{"query":"hello"}' | mcpc @s tools-call search

JSON output for scripting

Always use --json flag for machine-readable output:

# Get tools as JSON
mcpc --json @apify tools-list

# Call tool and parse result with jq
mcpc --json @apify tools-call search query:="test" | jq '.content[0].text'

# Chain commands
mcpc --json @server1 tools-call get-data | mcpc @server2 tools-call process

Sessions for efficiency

Create sessions for repeated interactions:

# Create session (or reconnect if exists)
mcpc mcp.apify.com connect @apify

# Use session (faster - no reconnection overhead)
mcpc @apify tools-list
mcpc @apify tools-call search query:="test"

# Restart session (useful after server updates)
mcpc @apify restart

# Close when done
mcpc @apify close

Session states:

  • 🟢 live - Bridge running, server might or might not be responding
  • 🟡 crashed - Bridge crashed; auto-restarts on next use
  • 🔴 expired - Server rejected session; needs close and reconnect

Authentication

OAuth (interactive login – human-only, foreground):

  • mcpc <server> login opens the browser; mcpc never opens it itself. Do not background this command or it will miss the localhost callback.
  • Run login once per profile, then reuse the saved credentials in scripts.
  • Re-run login to refresh/change scopes.

Python preflight to enforce “login first” in scripts (no automatic browser launches):

import json, os, sys

server = os.environ.get("MCP_SERVER", "mcp.apify.com")
profile = os.environ.get("MCP_PROFILE", "default")
profiles_path = os.path.join(os.path.expanduser("~"), ".mcpc", "profiles.json")

try:
    data = json.load(open(profiles_path, "r", encoding="utf-8"))
    profiles = data.get("profiles", [])
except FileNotFoundError:
    profiles = []

has_profile = any(p.get("server") == server and p.get("name") == profile for p in profiles)
if not has_profile:
    print(f"No mcpc auth profile '{profile}' for {server}.")
    print(f"Run this yourself (foreground): mcpc {server} login --profile {profile}")
    sys.exit(1)

After the preflight succeeds, scripts may call mcpc --profile <name> ... or rely on the default profile.

Bearer token:

mcpc -H "Authorization: Bearer $TOKEN" mcp.apify.com tools-list
mcpc -H "Authorization: Bearer $TOKEN" mcp.apify.com connect @myserver

Proxy server for AI isolation

Create a proxy MCP server that hides authentication tokens:

# Human creates authenticated session with proxy
mcpc mcp.apify.com connect @ai-proxy --proxy 8080

# AI agent connects to proxy (no access to original tokens)
# Note: localhost defaults to http://
mcpc localhost:8080 tools-list
mcpc 127.0.0.1:8080 connect @sandboxed

Common patterns

List and inspect tools:

mcpc @s tools-list
mcpc @s tools-get tool-name

Call tool and extract text result:

mcpc --json @s tools-call my-tool | jq -r '.content[0].text'

Read resource content:

mcpc @s resources-read "file:///path/to/file"

Use config file for local servers:

mcpc --config .vscode/mcp.json filesystem resources-list

Exit codes

  • 0 - Success
  • 1 - Client error (invalid arguments)
  • 2 - Server error (tool failed)
  • 3 - Network error
  • 4 - Authentication error

Debugging

# Verbose output shows protocol details
mcpc --verbose @s tools-call my-tool

Example script

See docs/examples/company-lookup.sh for a complete example of an AI-generated script that validates prerequisites and calls MCP tools.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/download' --output '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md.part' && mv '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md.part' '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(mcpc:*) Bash(node dist/cli/index.js:*) Read Grep

Original excerpt: Quick reference
# List sessions and auth profiles
mcpc

# Show server info
mcpc <server>
mcpc @<session>

# Tools
mcpc <target> tools-list
mcpc <target> tools-get <tool-name>
mcpc <target> tools-call <tool-name> key:=value key2:="string value"

# Resources
mcpc <target> resources-list
mcpc <target> resources-read <uri>

# Prompts
mcpc <target> prompts-list
mcpc <target> prompts-get <prompt-name> arg1:=value1

# Sessions (persistent connections)
mcpc <server> connect @<name>
mcpc @<name> <command>
mcpc @<name> close

# Authentication
mcpc <server> login
mcpc <server> logout

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && test -s '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/using-mcp-tools-with-mcpc' && cp -R '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i' '.claude/skills/using-mcp-tools-with-mcpc'

Cursor
test -f '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && test -s '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/using-mcp-tools-with-mcpc' && cp -R '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i' '.cursor/skills/using-mcp-tools-with-mcpc'

Codex
test -f '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && test -s '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/using-mcp-tools-with-mcpc' && cp -R '.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i' '.agents/skills/using-mcp-tools-with-mcpc'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i'

openskills read 'using-mcpc-to-interact-with-mcp-servers-mmbizk0i'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/using-mcpc-to-interact-with-mcp-servers-mmbizk0i/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills