Awesome
MCP CLI client
A simple CLI program to run LLM prompt and implement Model Context Protocol (MCP) client.
You can use any MCP-compatible servers from the convenience of your terminal.
This act as alternative client beside Claude Desktop. Additionally you can use any LLM provider like OpenAI, Groq, or local LLM model via llama.
Usage
Basic Usage
$ llm What is the capital city of North Sumatra?
The capital city of North Sumatra is Medan.
You can omit the quotes, but be careful with bash special characters like &
, |
, ;
that might be interpreted by your shell.
You can also pipe input from other commands or files:
$ echo "What is the capital city of North Sumatra?" | llm
The capital city of North Sumatra is Medan.
$ cat instructions.txt | llm
The capital city of North Sumatra is Medan.
Triggering a tool
$ llm What is the top article on hackernews today?
================================== Ai Message ==================================
Tool Calls:
brave_web_search (call_eXmFQizLUp8TKBgPtgFo71et)
Call ID: call_eXmFQizLUp8TKBgPtgFo71et
Args:
query: site:news.ycombinator.com
count: 1
Brave Search MCP Server running on stdio
================================== Ai Message ==================================
Tool Calls:
fetch (call_xH32S0QKqMfudgN1ZGV6vH1P)
Call ID: call_xH32S0QKqMfudgN1ZGV6vH1P
Args:
url: https://news.ycombinator.com/
================================= Tool Message =================================
Name: fetch
[TextContent(type='text', text='Contents [REDACTED]]
================================== Ai Message ==================================
The top article on Hacker News today is:
### [Why pipes sometimes get "stuck": buffering](https://jvns.ca)
- **Points:** 31
- **Posted by:** tanelpoder
- **Posted:** 1 hour ago
You can view the full list of articles on [Hacker News](https://news.ycombinator.com/)
Continuation
Add a c
prefix to your message to continue the last conversation.
$ llm asldkfjasdfkl
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?
$ llm c what did i say previously?
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!
Setup
-
Clone the repository:
pip install git+https://github.com/adhikasp/mcp-client-cli.git
-
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-4o-mini", "api_key": "your-openai-api-key", "temperature": 0.7 }, "mcpServers": { "fetch": { "command": "uvx", "args": ["mcp-server-fetch"] }, "brave-search": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-brave-search"], "env": { "BRAVE_API_KEY": "your-brave-api-key" } }, "youtube": { "command": "uvx", "args": ["--from", "git+https://github.com/adhikasp/mcp-youtube", "mcp-youtube"] } } }
-
Run the CLI:
llm "What is the capital city of North Sumatra?"
Contributing
Feel free to submit issues and pull requests for improvements or bug fixes.