Skip to main content
Glama

MCP Chat

MCP Chat は、Anthropic API を通じて AI モデルとの対話型チャット機能を実現するコマンドラインインターフェースアプリケーションです。このアプリケーションは、ドキュメント取得、コマンドベースのプロンプト、および MCP (Model Control Protocol) アーキテクチャによる拡張可能なツール統合をサポートしています。

前提条件

  • Python 3.9+

  • Anthropic API Key

Related MCP server: mcp_starter_project

セットアップ

ステップ 1: 環境変数の設定

  1. プロジェクトルートにある .env ファイルを作成または編集し、以下の変数が正しく設定されていることを確認します:

ANTHROPIC_API_KEY=""  # Enter your Anthropic API secret key

ステップ 2: 依存関係のインストール

オプション 1: uv を使用したセットアップ (推奨)

uv は高速な Python パッケージインストーラー兼リゾルバーです。

  1. uv がまだインストールされていない場合は、インストールします:

pip install uv
  1. 仮想環境を作成して有効化します:

uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. 依存関係をインストールします:

uv pip install -e .
  1. プロジェクトを実行します

uv run main.py

オプション 2: uv を使用しないセットアップ

  1. 仮想環境を作成して有効化します:

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. 依存関係をインストールします:

pip install anthropic python-dotenv prompt-toolkit "mcp[cli]==1.8.0"
  1. プロジェクトを実行します

python main.py

使用方法

基本的な対話

メッセージを入力して Enter キーを押すだけで、モデルとチャットできます。

ドキュメント取得

@ 記号の後にドキュメント ID を続けて使用すると、クエリにドキュメントの内容を含めることができます:

> Tell me about @deposition.md

コマンド

/ プレフィックスを使用して、MCP サーバーで定義されたコマンドを実行します:

> /summarize deposition.md

Tab キーを押すとコマンドが自動補完されます。

開発

新しいドキュメントの追加

mcp_server.py ファイルを編集して、docs ディクショナリに新しいドキュメントを追加します。

MCP 機能の実装

MCP 機能を完全に実装するには:

  1. mcp_server.py の TODO を完了します

  2. mcp_client.py の不足している機能を実装します

リンターと型チェック

リンターや型チェックは実装されていません。

Available Tools

2 tools
edit_documentA

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

Inputs: doc_id (required), new_str (required), old_str (required).

read_doc_contentsA

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

Inputs: doc_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools are clearly distinct: one reads document contents, the other modifies them. There is no overlap or ambiguity between the operations.

    Naming Consistency4/5

    Both tools use a verb_noun pattern and snake_case, but one uses 'doc_contents' and the other uses 'document', which is a minor inconsistency. A more consistent pair would be read_document/edit_document.

    Tool Count3/5

    Two tools is a thin surface and falls at the borderline for a useful server. The tools are focused, but the count feels minimal for a standalone document-related MCP server.

    Completeness2/5

    The tool surface covers reading and editing documents but lacks create, delete, list, and search capabilities. This leaves significant lifecycle gaps that agents may need to work around.

    Related MCP Connectors

    Related MCP Servers