mcp-cli
A Go CLI tool for querying Model Context Protocol (MCP) servers with a natural-language question and printing plain-text answers to stdout.
Installation
go install github.com/groovy-sky/mcp-cli@latest
Or build from source:
git clone https://github.com/groovy-sky/mcp-cli.git
cd mcp-cli
go build -o mcp-cli .
Usage
mcp-cli --server URL --question TEXT [--timeout DURATION]
| Flag |
Description |
Default |
--server |
Absolute HTTP/HTTPS URL of the MCP server (required) |
|
--question |
Natural-language question to send (required) |
|
--timeout |
Request timeout, e.g. 30s, 2m (must be > 0) |
45s |
Example – Microsoft Learn MCP
mcp-cli \
--server https://learn.microsoft.com/api/mcp \
--question "explain what is Azure Container App"
Pipe output to another command
mcp-cli \
--server https://learn.microsoft.com/api/mcp \
--question "what is Azure Kubernetes Service?" | less
mcp-cli \
--server https://learn.microsoft.com/api/mcp \
--question "list Azure storage account types" > answer.txt
How it works
- Connects to the MCP server using the Streamable HTTP transport.
- Lists available tools and selects one that accepts a single query/question/search/prompt/text argument, preferring tools with semantically relevant names/descriptions.
- Calls the selected tool with the supplied question.
- Prints extracted text content to stdout (errors and diagnostics go to stderr).
License
MIT – see LICENSE.