MCP Client

mcp-sh

By madene

a shell script that turn any MCP Server into CLI. No more MCP vs CLI fight !

Views
2
Repository stars
4
Platforms
macOS, Linux
Workspace
CLI
Share resource
Capabilities & compatibility

Platforms

macOS, Linux

System requirements

Tool Purpose
------ ---------
bash ≥ 3.2 Shell
curl HTTP requests
jq JSON parsing
openssl PKCE code challenge (OAuth 2.1 only)
python3 URL encoding + OAuth callback server (OAuth 2.1 only)
macOS ships with all of these. On Linux: apt install curl jq openssl python3 / yum install ...

Connection & setup

Configuration guide

A pure-Bash CLI to interact with any remote MCP (Model Context Protocol) server over HTTP. No Node.js. No Go. No install. Just curl + jq — already on every macOS and most Linux boxes.

List tools, inspect schemas, and call tools directly from your terminal — with full support for OAuth 2.1 PKCE, Bearer, API key, Basic, and client-credentials auth out of the box.

$ ./mcp.sh --profile deepwiki --list_tools

Found 3 tool(s) on https://mcp.deepwiki.com/mcp:

  read_wiki_structure
    Get a list of documentation topics for a GitHub repository.
  read_wiki_contents
    View documentation about a GitHub repository.
  ask_question
    Ask any question about a GitHub repository and get an AI-powered response.

Most MCP clients require Node.js or a compiled Go binary. mcp-sh is a single .sh file:

  • Zero install — works on any machine with bash, curl, and jq
  • All auth methods — Bearer, API key, Basic, OAuth 2.0 client credentials, OAuth 2.1 PKCE (browser flow)
  • Named profiles — one config file, switch servers with --profile
  • CI-friendly — every value overridable via environment variable
  • No more MCP vs CLI fights - use CLI if you want with a MCP server behind the scene, no dedicated software

Credentials live in ~/.config/mcp-sh/config — an INI file with named profiles. The file is never touched by git and should be chmod 600.

mkdir -p ~/.config/mcp-sh
chmod 700 ~/.config/mcp-sh
touch ~/.config/mcp-sh/config
chmod 600 ~/.config/mcp-sh/config
[profile-name]
url           = https://mcp.example.com/mcp
auth_method   = bearer          # see Auth Methods below
token         = sk-...
extra_headers = X-Custom: value  # pipe-separate for multiples: H1: v1|H2: v2

Some servers (Atlassian, and any strict Streamable HTTP implementation) require an initialize → notifications/initialized handshake before accepting other requests, and return a Mcp-Session-Id header that must be included in subsequent calls.

mcp-sh handles this automatically: it sends initialize on startup, captures the session ID from response headers, and includes Mcp-Session-Id in every subsequent request. Servers that don't require this (SSE-based servers, local servers) ignore the extra step transparently.

Server URL Auth Free
DeepWiki https://mcp.deepwiki.com/mcp none ✅
Exa https://mcp.exa.ai/mcp api_key (x-api-key) ✅ free tier
Firecrawl https://mcp.firecrawl.dev/{KEY}/sse bearer ✅ 500 credits
Tavily https://mcp.tavily.com/mcp/ bearer ✅ free tier
GitHub Copilot https://api.githubcopilot.com/mcp/ bearer (PAT) ✅
Atlassian Rovo https://mcp.atlassian.com/v1/mcp oauth2_pkce ✅
README

mcp-sh

A pure-Bash CLI to interact with any remote MCP (Model Context Protocol) server over HTTP. No Node.js. No Go. No install. Just curl + jq — already on every macOS and most Linux boxes.

List tools, inspect schemas, and call tools directly from your terminal — with full support for OAuth 2.1 PKCE, Bearer, API key, Basic, and client-credentials auth out of the box.

$ ./mcp.sh --profile deepwiki --list_tools

Found 3 tool(s) on https://mcp.deepwiki.com/mcp:

  read_wiki_structure
    Get a list of documentation topics for a GitHub repository.
  read_wiki_contents
    View documentation about a GitHub repository.
  ask_question
    Ask any question about a GitHub repository and get an AI-powered response.

Why mcp-sh?

Most MCP clients require Node.js or a compiled Go binary. mcp-sh is a single .sh file:

  • Zero install — works on any machine with bash, curl, and jq
  • All auth methods — Bearer, API key, Basic, OAuth 2.0 client credentials, OAuth 2.1 PKCE (browser flow)
  • Named profiles — one config file, switch servers with --profile
  • CI-friendly — every value overridable via environment variable
  • No more MCP vs CLI fights - use CLI if you want with a MCP server behind the scene, no dedicated software

Requirements

Tool Purpose
bash ≥ 3.2 Shell
curl HTTP requests
jq JSON parsing
openssl PKCE code challenge (OAuth 2.1 only)
python3 URL encoding + OAuth callback server (OAuth 2.1 only)

macOS ships with all of these. On Linux: apt install curl jq openssl python3 / yum install ...

Installation

git clone https://github.com/yourname/mcp-sh
cd mcp-sh
chmod +x mcp.sh

Optionally add to your PATH:

ln -s "$PWD/mcp.sh" /usr/local/bin/mcp

Quick start

# No config needed — pass everything inline
./mcp.sh --url https://mcp.deepwiki.com/mcp --auth none --list_tools

# Or set up a profile (recommended)
./mcp.sh --profile deepwiki --list_tools
./mcp.sh --profile deepwiki --describe ask_question
./mcp.sh --profile deepwiki --execute ask_question \
  --payload '{"repoName":"anthropics/anthropic-sdk-python","question":"How does streaming work?"}'

Configuration

Credentials live in ~/.config/mcp-sh/config — an INI file with named profiles. The file is never touched by git and should be chmod 600.

mkdir -p ~/.config/mcp-sh
chmod 700 ~/.config/mcp-sh
touch ~/.config/mcp-sh/config
chmod 600 ~/.config/mcp-sh/config

Profile resolution order

--profile flag  >  $MCP_PROFILE env var  >  "default" profile

Value resolution order (per field)

CLI flag  >  environment variable  >  config file  >  error

Config file format

[profile-name]
url           = https://mcp.example.com/mcp
auth_method   = bearer          # see Auth Methods below
token         = sk-...
extra_headers = X-Custom: value  # pipe-separate for multiples: H1: v1|H2: v2

none — no authentication

For local servers or open public endpoints.

[local]
url         = http://localhost:3000/mcp
auth_method = none
./mcp.sh --profile local --list_tools
# or inline, no config needed:
./mcp.sh --url http://localhost:3000/mcp --auth none --list_tools

Live public example — DeepWiki (GitHub repo Q&A;, no signup):

[deepwiki]
url         = https://mcp.deepwiki.com/mcp
auth_method = none
./mcp.sh --profile deepwiki --execute ask_question \
  --payload '{
    "repoName": "modelcontextprotocol/python-sdk",
    "question": "What transports are supported?"
  }'

MCP session handshake

Some servers (Atlassian, and any strict Streamable HTTP implementation) require an initialize → notifications/initialized handshake before accepting other requests, and return a Mcp-Session-Id header that must be included in subsequent calls.

mcp-sh handles this automatically: it sends initialize on startup, captures the session ID from response headers, and includes Mcp-Session-Id in every subsequent request. Servers that don't require this (SSE-based servers, local servers) ignore the extra step transparently.

Tested public MCP servers

Server URL Auth Free
DeepWiki https://mcp.deepwiki.com/mcp none ✅
Exa https://mcp.exa.ai/mcp api_key (x-api-key) ✅ free tier
Firecrawl https://mcp.firecrawl.dev/{KEY}/sse bearer ✅ 500 credits
Tavily https://mcp.tavily.com/mcp/ bearer ✅ free tier
GitHub Copilot https://api.githubcopilot.com/mcp/ bearer (PAT) ✅
Atlassian Rovo https://mcp.atlassian.com/v1/mcp oauth2_pkce ✅
Related resources