mcp-client-cli is a simple command-line program for running LLM prompts and implementing a Model Context Protocol (MCP) client. Users can conveniently use any MCP-compatible server in the terminal. It serves as an alternative client to Claude Desktop and supports using any LLM provider, such as OpenAI, Groq, or local LLM models running via llama.
Installation
Install via pip:
pip install mcp-client-cli
Configuration
Create the ~/.llm/config.json file to configure the LLM and MCP servers. The configuration example includes systemPrompt、llm(provider, model, api_key, temperature, base_url) and mcpServers(each server can set command, args, env, requires_confirmation, enabled, exclude_tools).
- Use
requires_confirmationto specify which tools require user confirmation before execution. - The LLM API key can also be set via the environment variable
LLM_API_KEYorOPENAI_API_KEY. - The configuration file can be placed in
~/.llm/config.jsonor$PWD/.llm/config.json. - The JSON configuration file supports using
//comments, making it convenient to switch configurations. - For the complete configuration format documentation, see CONFIG.md.
Usage
Run the CLI:
llm "What is the capital city of North Sumatra?"
Quotes can be omitted, but note that bash special characters such as &、|、; may be interpreted by the shell.
You can also pipe input from other commands or files.
You can pipe in image files for analysis using a multimodal LLM.
Using prompt templates
Use the p prefix, followed by the template name and its parameters, to use a predefined prompt template.
Triggering tools
To bypass the tool confirmation requirement, use the --no-confirmations flag.
To use it in a bash script, add --no-intermediates, so that intermediate messages are not printed, and only the final end message is printed.
Add the c prefix before the message to continue the previous conversation.
Clipboard support
You can use the cb command to use the contents of the clipboard. Clipboard functionality is available for:
- Native Windows/macOS/Linux environments
- Windows: use PowerShell
- macOS: use pbpaste for text, and pngpaste for images (optional)
- Linux: use xclip (required for clipboard support)
- Windows Subsystem for Linux (WSL)
- Access the Windows clipboard via PowerShell
- Supports text and images
- Ensure that powershell.exe can be accessed from WSL
Tools required for clipboard support:
- Windows: PowerShell (built-in)
- macOS: pbpaste (built-in) for text; pngpaste (optional) for images:
brew install pngpaste - Linux:xclip:
sudo apt install xclipor an equivalent command
The CLI automatically detects whether the clipboard content is text or an image and processes it accordingly.
Other options
Issues and pull requests are welcome to improve or fix bugs.