Skip to main content
Glama

ChatWithMCP

A command-line chat client for Claude (Anthropic) with integration for custom and external MCP servers. The chat runs directly in the terminal, calls tools automatically (or after confirmation), and includes a built-in system for generating and evaluating prompt variants.

Features

  • Interactive chat in the terminal (OpenAI-compatible API, openai SDK against Anthropic endpoint)

  • Integration of a local MCP server (mcp-server/) with custom tools

  • Optional integration of the official GitHub MCP Server via Docker

  • Three execution modes for tool calls: auto, approve (confirmation prompt), and plan (plan only, no execution)

  • Streaming responses and extended thinking (optionally enabled)

  • Tools can be enabled/disabled individually or all at once

  • Load files into the chat context via /attach

  • Prompt generation and evaluation via custom MCP tools (see PROMPT_EVALUATION.md)

Related MCP server: MCP Chat

Prerequisites

  • Node.js (ESM/type: module, see package.json)

  • An Anthropic API key

  • Optional: Docker (only for the GitHub MCP server) and a GitHub Personal Access Token

  • Optional: a Tavily API key (for the web_search tool)

Installation

npm install

Configuration

Create a .env file in the project root directory (excluded by .gitignore):

ANTHROPIC_API_KEY=dein-anthropic-api-key
BASE_URL=https://api.anthropic.com/v1
TAVILY_API_KEY=dein-tavily-api-key
GITHUB_PERSONAL_ACCESS_TOKEN=dein-github-token
  • ANTHROPIC_API_KEY / BASE_URL — required for the chat client and the generate_prompts tool

  • TAVILY_API_KEY — only needed for the web_search tool

  • GITHUB_PERSONAL_ACCESS_TOKEN — only needed if the GitHub MCP server (via Docker) is to be used

General settings (model, token limits, base directory for /attach, GitHub toolsets) are in config.mjs.

Usage

Start the chat:

npm start

The local MCP server (mcp-server/server.mjs) is automatically started as a subprocess. The GitHub MCP server is optionally connected via Docker — if that fails, the chat continues without GitHub tools.

The MCP server can also be started independently (e.g., for testing with an MCP inspector):

npm run mcp-server

Commands in the chat

General

  • /system TEXT — set the system prompt

  • /nosystem — remove the system prompt

  • /clear — clear the chat history

  • exit — exit the chat

Tool management

  • /tools — display available tools with status

  • /disable-tool <name> / /enable-tool <name> — enable/disable a single tool

  • /disable-all-tools / /enable-all-tools — enable/disable all tools

Chat options

  • /options — display current settings

  • /enable-streaming / /disable-streaming — toggle streaming (disables all tools during streaming)

  • /enable-thinking / /disable-thinking — toggle extended thinking

Execution mode

  • /plan-mode — the model only provides a plan, does not execute tools

  • /auto-mode — tools are executed without confirmation (default)

  • /auto-approve — confirmation required before each tool call

  • /mode — display the current mode

Files

  • /attach <path> — read a file and add it to the chat history (relative paths are resolved against config.attachBaseDir)

Prompt evaluation

  • /generate-prompts <count> <prompt> [--style=formal|casual|technical|creative|concise]

  • /evaluate-prompts

  • /prompts

  • /clear-prompts

Details in PROMPT_EVALUATION.md.

Available MCP tools

The local MCP server (mcp-server/tools/) provides, among others, the following tools:

Tool

Description

get_current_date / get_current_time

Returns the current date or current time

get_weather

Weather query

web_search

Web search (requires TAVILY_API_KEY)

fetch_page

Loads a web page and converts it to text

read_file / save_to_file

Read or write files

list_directory

List directory contents

ssh_execute

Execute commands on a remote host via SSH

get_network_info

Display the machine's network interfaces, subnets, and DNS servers

discover_network_hosts

Find active hosts on the local IP network via TCP connect scan

generate_prompts / evaluate_prompts

Generate and evaluate prompt variants

The optional GitHub MCP server additionally provides tools for repos, issues, pull requests, and actions (see config.mjsgithub.toolsets).

Project structure

chat.mjs                 CLI-Chat-Client
config.mjs                Konfiguration (Modell, Token-Limits, GitHub-Optionen)
mcp-server/
  server.mjs              MCP-Server (stdio)
  tools/                  Einzelne Tool-Implementierungen
output/                   Ablage für generierte Dateien (z. B. über save_to_file)
PROMPT_EVALUATION.md       Dokumentation des Prompt-Evaluation-Systems

Related MCP Connectors

Related MCP Servers