Skip to main content
Glama

MCP Chat CLI

Интерфейс чата командной строки, который подключается к серверу MCP с использованием API Anthropic. Создан во время прохождения курса Anthropic Введение в протокол контекста модели (Introduction to Model Context Protocol), дополнен пользовательскими инструментами, ресурсами и подсказками.

Что это такое

MCP (Model Context Protocol) — это открытый стандарт для подключения моделей ИИ к внешним инструментам и источникам данных. Этот проект реализует обе стороны этого соединения — сервер FastMCP, который предоставляет документы в качестве ресурсов и определяет инструменты для их чтения и редактирования, и клиент, который подключается к серверу и делает эти возможности доступными внутри интерфейса чата.

Сервер определяет:

  • Инструменты — чтение и редактирование документов

  • Ресурсы — список всех документов или получение конкретного документа по URI

  • Подсказки — переформатирование документа в markdown или суммаризация его содержимого

Клиент реализует полную сессию клиента MCP, включая вызовы инструментов, чтение ресурсов, получение подсказок и автодополнение команд.

Related MCP server: MCP Chat

Что я проработал

Начиная с начального пакета курса, я реализовал недостающие части с обеих сторон:

  • read_resource, list_prompts и get_prompt на стороне клиента

  • Конечные точки ресурсов (docs://documents и docs://documents/{doc_id}) на стороне сервера

  • Две подсказки (format и summarize), которые инструктируют модель использовать доступные инструменты

Главное, что этот проект прояснил для меня, — это разделение между сервером (который определяет, что доступно) и клиентом (который знает, как это вызвать), а также то, что подсказки — это просто структурированные сообщения, которые дают модели начальный контекст, а не магия.

Предварительные требования

  • Python 3.9+

  • API-ключ Anthropic

Настройка

  1. Клонируйте репозиторий и перейдите в папку проекта.

  2. Создайте виртуальное окружение и активируйте его:

uv venv
.venv\Scripts\activate  # Windows
source .venv/bin/activate  # Mac/Linux
  1. Установите зависимости:

uv pip install -e .
  1. Создайте файл .env в корне проекта:

ANTHROPIC_API_KEY="your-key-here"
  1. Запустите приложение:

uv run main.py

Использование

Введите сообщение для чата. Используйте @doc_id, чтобы включить документ в ваш запрос, и /command, чтобы вызвать подсказку. Клавиша Tab дополняет доступные команды.

> Tell me about @deposition.md
> /summarize report.pdf
> /format plan.md

Чтобы добавить свои собственные документы, отредактируйте словарь docs в mcp_server.py.

Прямое тестирование сервера

mcp dev mcp_server.py

Это откроет инспектор MCP в вашем браузере, где вы сможете протестировать инструменты, ресурсы и подсказки без интерфейса чата.

Структура проекта

mcp_chat_cli/
├── main.py              # entrypoint
├── mcp_server.py        # FastMCP server — tools, resources, prompts
├── mcp_client.py        # MCP client session wrapper
├── core/
│   ├── chat.py          # chat loop logic
│   ├── claude.py        # Anthropic API integration
│   ├── cli.py           # CLI setup and input handling
│   ├── cli_chat.py      # connects CLI and chat
│   └── tools.py         # tool call handling
├── .env                 # API key (not committed)
└── pyproject.toml       # dependencies

Available Tools

2 tools
edit_documentA

Edit a document by replacing a string in the documents content with a new string.

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesId of the document that will be edited
old_strYesThe text to replace. Must match exactly, including whitespace.
new_strYesThe new text to insert in place of the old text.

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must disclose behavioral traits. It only states 'replacing a string' without indicating whether it replaces all occurrences, behavior on missing string, or side effects like auto-save. Missing important mutation details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is concise and front-loaded with the essential action and resource. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple edit tool with fully documented parameters, the description is adequate but lacks details on error handling (e.g., what if old_str not found) and whether it replaces all occurrences or just the first.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the description adds value by clarifying that old_str must match exactly including whitespace. This goes beyond the schema's basic descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (edit), resource (document), and method (string replacement). It effectively distinguishes from the sibling tool 'read_doc_contents' which is read-only.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly state when to use this tool vs alternatives. While the sibling tool name implies a read vs. edit distinction, no further guidance is provided on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_doc_contentsB

Read the contents of a document and return it as a string.

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesId of the document to read

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Only states basic read operation; no mention of error handling, read-only guarantee, or behavior on invalid inputs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no redundant information. Could be improved with additional context without harming conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, description mentions return value as string, which is helpful. Lacks details on error conditions or edge cases, but adequate for a simple read tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single parameter; description does not add additional meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the action (read), resource (document), and output format (string). Distinguishes from sibling tool 'edit_document' which implies modification.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus the sibling 'edit_document'. Does not specify any prerequisites or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv0.1.0
    • First observededit_document
    • First observedread_doc_contents

TDQS

A3.5/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one reads document contents, the other edits by replacing text. There is no functional overlap.

Naming Consistency5/5

Both tool names follow the verb_noun pattern (edit_document, read_doc_contents), with consistent snake_case and clear action-object structure.

Tool Count3/5

With only two tools, the server feels thin for a document utility, though it could be a minimal implementation. It falls into the borderline category (1-2 tools).

Completeness2/5

The server lacks basic CRUD operations like create and delete documents. While read and edit are provided, agents cannot create new documents or remove them, which are significant gaps.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A command-line interface application for interactive chat with AI models via the Anthropic API. It supports document retrieval, command-based prompts, and extensible tool integrations through the MCP architecture.
    -
  • F
    license
    A
    quality
    C
    maintenance
    Enables interactive chat with a local LLM using MCP architecture for document management, including tools to read, edit, and format documents.
    2
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides document management capabilities including reading, editing, and summarizing documents through a CLI chat interface powered by Claude AI.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cslylla/mcp_chat_cli'

If you have feedback or need assistance with the MCP directory API, please join our Discord server