Skip to content
Back to search

mcp-client-cli

A simple CLI to run LLM prompt and implement MCP client.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/adhikasp--mcp-client-cli/badge.svg)](/listings/adhikasp--mcp-client-cli)

HTML

<a href="/listings/adhikasp--mcp-client-cli"><img src="/api/listings/adhikasp--mcp-client-cli/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Install via pip:

   pip install mcp-client-cli

2. Create a `~/.llm/config.json` file to configure your LLM and MCP servers:

   {
     "systemPrompt": "You are an AI assistant helping a software engineer...",
     "llm": {
       "provider": "openai",
       "model": "gpt-4",
       "api_key": "your-openai-api-key",
       "temperature": 0.7,
       "base_url": "https://api.openai.com/v1"  // Optional, for OpenRouter or other providers
     },
     "mcpServers": {
       "fetch": {
         "command": "uvx",
         "args": ["mcp-server-fetch"],
         "requires_confirmation": ["fetch"],
         "enabled": true,  // Optional, defaults to true
         "exclude_tools": []  // Optional, list of tool names to exclude
       },
       "brave-search": {
         "command": "npx",
         "args": ["-y", "@modelcontextprotocol/server-brave-search"],
         "env": {
           "BRAVE_API_KEY": "your-brave-api-key"
         },
         "requires_confirmation": ["brave_web_search"]
       },
       "youtube": {
         "command": "uvx",
         "args": ["--from", "git+https://github.com/adhikasp/mcp-youtube", "mcp-youtube"]
       }
     }
   }

Note: - See [CONFIG.md](CONFIG.md) for complete documentation of the configuration format - Use `requires_confirmation` to specify which tools need user confirmation before execution - The LLM API key can also be set via environment variables `LLM_API_KEY` or `OPENAI_API_KEY` - The config file can be placed in either `~/.llm/config.json` or `$PWD/.llm/config.json` - You can comment the JSON config file with `//` if you like to switch around the configuration

3. Run the CLI:

   llm "What is the capital city of North Sumatra?"

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 229 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # MCP CLI client
  2. A simple CLI program to run LLM prompt and implement [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) client.
  3. You can use any [MCP-compatible servers](https://github.com/punkpeye/awesome-mcp-servers) from the convenience of your terminal.
  4. This act as alternative client beside Claude Desktop. Additionally you can use any LLM provider like OpenAI, Groq, or local LLM model via [llama](https://github.com/ggerganov/llama.cpp).
  5. ![C4 Diagram](https://raw.githubusercontent.com/adhikasp/mcp-client-cli/refs/heads/master/c4_diagram.png)
  6. ## Setup
  7. 1. Install via pip:
  8. ```bash
  9. pip install mcp-client-cli
  10. ```
  11. 2. Create a `~/.llm/config.json` file to configure your LLM and MCP servers:
  12. ```json
  13. {
  14. "systemPrompt": "You are an AI assistant helping a software engineer...",
  15. "llm": {
  16. "provider": "openai",
  17. "model": "gpt-4",
  18. "api_key": "your-openai-api-key",
  19. "temperature": 0.7,
  20. "base_url": "https://api.openai.com/v1" // Optional, for OpenRouter or other providers
  21. },
  22. "mcpServers": {
  23. "fetch": {
  24. "command": "uvx",
  25. "args": ["mcp-server-fetch"],
  26. "requires_confirmation": ["fetch"],
  27. "enabled": true, // Optional, defaults to true
  28. "exclude_tools": [] // Optional, list of tool names to exclude
  29. },
  30. "brave-search": {
  31. "command": "npx",
  32. "args": ["-y", "@modelcontextprotocol/server-brave-search"],
  33. "env": {
  34. "BRAVE_API_KEY": "your-brave-api-key"
  35. },
  36. "requires_confirmation": ["brave_web_search"]
  37. },
  38. "youtube": {
  39. "command": "uvx",
  40. "args": ["--from", "git+https://github.com/adhikasp/mcp-youtube", "mcp-youtube"]
  41. }
  42. }
  43. }
  44. ```
  45. Note:
  46. - See [CONFIG.md](CONFIG.md) for complete documentation of the configuration format
  47. - Use `requires_confirmation` to specify which tools need user confirmation before execution
  48. - The LLM API key can also be set via environment variables `LLM_API_KEY` or `OPENAI_API_KEY`
  49. - The config file can be placed in either `~/.llm/config.json` or `$PWD/.llm/config.json`
  50. - You can comment the JSON config file with `//` if you like to switch around the configuration
  51. 3. Run the CLI:
  52. ```bash
  53. llm "What is the capital city of North Sumatra?"
  54. ```
  55. ## Usage
  56. ### Basic Usage
  57. ```bash
  58. $ llm What is the capital city of North Sumatra?
  59. The capital city of North Sumatra is Medan.
  60. ```
  61. You can omit the quotes, but be careful with bash special characters like `&`, `|`, `;` that might be interpreted by your shell.
  62. You can also pipe input from other commands or files:
  63. ```bash
  64. $ echo "What is the capital city of North Sumatra?" | llm
  65. The capital city of North Sumatra is Medan.
  66. $ echo "Given a location, tell me its capital city." > instructions.txt
  67. $ cat instruction.txt | llm "West Java"
  68. The capital city of West Java is Bandung.
  69. ```
  70. ### Image Input
  71. You can pipe image files to analyze them with multimodal LLMs:
  72. ```bash
  73. $ cat image.jpg | llm "What do you see in this image?"
  74. [LLM will analyze and describe the image]
  75. $ cat screenshot.png | llm "Is there any error in this screenshot?"
  76. [LLM will analyze the screenshot and point out any errors]
  77. ```
  78. ### Using Prompt Templates
  79. You can use predefined prompt templates by using the `p` prefix followed by the template name and its arguments:
  80. ```bash
  81. # List available prompt templates
  82. $ llm --list-prompts
  83. # Use a template
  84. $ llm p review # Review git changes
  85. $ llm p commit # Generate commit message
  86. $ llm p yt url=https://youtube.com/... # Summarize YouTube video
  87. ```
  88. ### Triggering a tool
  89. ```bash
  90. $ llm What is the top article on hackernews today?
  91. ================================== Ai Message ==================================
  92. Tool Calls:
  93. brave_web_search (call_eXmFQizLUp8TKBgPtgFo71et)
  94. Call ID: call_eXmFQizLUp8TKBgPtgFo71et
  95. Args:
  96. query: site:news.ycombinator.com
  97. count: 1
  98. Brave Search MCP Server running on stdio
  99. # If the tool requires confirmation, you'll be prompted:
  100. Confirm tool call? [y/n]: y
  101. ================================== Ai Message ==================================
  102. Tool Calls:
  103. fetch (call_xH32S0QKqMfudgN1ZGV6vH1P)
  104. Call ID: call_xH32S0QKqMfudgN1ZGV6vH1P
  105. Args:
  106. url: https://news.ycombinator.com/
  107. ================================= Tool Message =================================
  108. Name: fetch
  109. [TextContent(type='text', text='Contents [REDACTED]]
  110. ================================== Ai Message ==================================
  111. The top article on Hacker News today is:
  112. ### [Why pipes sometimes get "stuck": buffering](https://jvns.ca)
  113. - **Points:** 31
  114. - **Posted by:** tanelpoder
  115. - **Posted:** 1 hour ago
  116. You can view the full list of articles on [Hacker News](https://news.ycombinator.com/)
  117. ```
  118. To bypass tool confirmation requirements, use the `--no-confirmations` flag:
  119. ```bash
  120. $ llm --no-confirmations "What is the top article on hackernews today?"
  121. ```
  122. To use in bash scripts, add the --no-intermediates, so it doesn't print intermediate messages, only the concluding end message.
  123. ```bash
  124. $ llm --no-intermediates "What is the time in Tokyo right now?"
  125. ```
  126. ### Continuation
  127. Add a `c ` prefix to your message to continue the last conversation.
  128. ```bash
  129. $ llm asldkfjasdfkl
  130. It seems like your message might have been a typo or an error. Could you please clarify or provide more details about what you need help with?
  131. $ llm c what did i say previously?
  132. You previously typed "asldkfjasdfkl," which appears to be a random string of characters. If you meant to ask something specific or if you have a question, please let me know!
  133. ```
  134. ### Clipboard Support
  135. You can use content from your clipboard using the `cb` command:
  136. ```bash
  137. # After copying text to clipboard
  138. $ llm cb
  139. [LLM will process the clipboard text]
  140. $ llm cb "What language is this code written in?"
  141. [LLM will analyze the clipboard text with your question]
  142. # After copying an image to clipboard
  143. $ llm cb "What do you see in this image?"
  144. [LLM will analyze the clipboard image]
  145. # You can combine it with continuation
  146. $ llm cb c "Tell me more about what you see"
  147. [LLM will continue the conversation about the clipboard content]
  148. ```
  149. The clipboard feature works in:
  150. - Native Windows/macOS/Linux environments
  151. - Windows: Uses PowerShell
  152. - macOS: Uses `pbpaste` for text, `pngpaste` for images (optional)
  153. - Linux: Uses `xclip` (required for clipboard support)
  154. - Windows Subsystem for Linux (WSL)
  155. - Accesses the Windows clipboard through PowerShell
  156. - Works with both text and images
  157. - Make sure you have access to `powershell.exe` from WSL
  158. Required tools for clipboard support:
  159. - Windows: PowerShell (built-in)
  160. - macOS:
  161. - `pbpaste` (built-in) for text
  162. - `pngpaste` (optional) for images: `brew install pngpaste`
  163. - Linux:
  164. - `xclip`: `sudo apt install xclip` or equivalent
  165. The CLI automatically detects if the clipboard content is text or image and handles it appropriately.
  166. ### Additional Options
  167. ```bash
  168. $ llm --list-tools # List all available tools
  169. $ llm --list-prompts # List available prompt templates
  170. $ llm --no-tools # Run without any tools
  171. $ llm --force-refresh # Force refresh tool capabilities cache
  172. $ llm --text-only # Output raw text without markdown formatting
  173. $ llm --show-memories # Show user memories
  174. $ llm --model gpt-4 # Override the model specified in config
  175. ```
  176. ## Contributing
  177. Feel free to submit issues and pull requests for improvements or bug fixes.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.