# mcp-client-cli

> MCP Client

This repository provides a CLI client for running LLM prompts and interacting with Model Context Protocol (MCP) servers. It allows users to leverage various LLM providers and MCP-compatible services from their terminal.

## Overview

- **Category:** Developer Tools
- **Language:** Python
- **Stars:** 678
- **Forks:** 38
- **Owner:** adhikasp
- **GitHub:** https://github.com/adhikasp/mcp-client-cli
- **Created:** 2024-11-27T14:21:00+00:00
- **Updated:** 2025-03-28T21:53:40+00:00
- **Source:** https://model-context-protocol.com/clients/cli-llm-prompt-mcp-client-tool

## Setup

## Setup

1. Install via pip:
   ```bash
   pip install mcp-client-cli
   ```

2. Create a `~/.llm/config.json` file to configure your LLM and MCP servers:
   ```json
   {
     "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: 
   - 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:
   ```bash
   llm "What is the capital city of North Sumatra?"
   ```

## Tools

## Available Tools

1.  Basic Usage (Run LLM prompts from the command line, including piping input).
2.  Image Input (Analyze images with multimodal LLMs).
3.  Prompt Templates (Use predefined prompt templates with the `p` prefix).
4.  Tool Triggering (Trigger external tools like brave-search and fetch).
5.  Tool Confirmation (Confirm tool calls before execution or bypass with `--no-confirmations`).
6.  Continuation (Continue the last conversation with the `c` prefix).
7.  Clipboard Support (Use content from your clipboard with the `cb` command).
8.  List Tools (`--list-tools` to list available tools).
9.  No Tools (`--no-tools` to run without any tools).
10. Force Refresh (`--force-refresh` to force refresh tool capabilities cache).
11. Text Only (`--text-only` to output raw text without markdown formatting).
12. Show Memories (`--show-memories` to show user memories).
13. Override Model (`--model` to override the model specified in config).

