Sample Model Context Protocol server with a numeric comparison tool

Sample Model Context Protocol server with a numeric comparison tool

mcp-server-client-example•byykitaza

A minimal educational implementation of an MCP server that offers a numeric comparison tool, paired with an MCP client and a Google Gemini chat CLI.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Implements an MCP server that registers and executes tools, including a numeric comparison tool.
  • •The numeric comparison tool compares two numbers to resolve comparisons that AI models often get wrong, such as 9.11 versus 9.9.
  • •Provides an MCP client with bidirectional server communication, connection management via configuration files, and error handling with retry processing.
  • •Includes a chat interface powered by the Google Gemini API that integrates with MCP tools.

BEST FOR

  • •Learning the basics of the Model Context Protocol through a minimal server and client example.
  • •Independent implementations of an MCP server that do not depend on a specific client like Claude Desktop App.
  • •Low-cost validation of MCP usage via Google Gemini using free-tier quotas.

ABOUT MCP-SERVER-CLIENT-EXAMPLE

Sample Model Context Protocol server with a numeric comparison tool is cataloged as an MCP server attributed to ykitaza. A minimal educational implementation of an MCP server that offers a numeric comparison tool, paired with an MCP client and a Google Gemini chat CLI. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Sample Model Context Protocol server with a numeric comparison tool are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What does the numeric comparison tool do?

It compares two numbers to determine which is larger or smaller, addressing comparisons that AI models often get wrong, such as 9.11 versus 9.9.

Which language model does the chat interface use?

The chat interface uses the Google Gemini API for natural language processing and has integration with MCP tools.

Upstream README

View this exact version on GitHub

README.md · a4ae3a6fc7f7 · Fetched 2026-11-13 13:34:53 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

MCP サーバー/クライアント サンプル

🔍 Model Context Protocol(MCP)の実装サンプルプロジェクト

💡 プロジェクトの背景

このプロジェクトは以下の目的で作成されました:

  • MCPの基礎学習: Model Context Protocolの基本概念を理解するための最小限の実装例を提供
  • シンプルな実装: 必要最小限の機能に絞ったMCPサーバーの実装により、プロトコルの本質的な部分に焦点を当てる
  • 独立した実装: Claude Desktop Appなどの特定のクライアントに依存せず、MCPサーバーを自前で実装する方法を示す
  • コストをかけず検証: Google Gemini 経由で MCP を利用することで、コストをかけず(無料枠等の活用可)検証を行うことが可能

このサンプルプロジェクトを通じて、MCPの基本的な仕組みとツール連携の実装方法を学ぶことができます。

🎯 機能概要

このプロジェクトは以下の主要機能を提供します:

MCPサーバー機能

  • 数値比較ツールの提供
    • 2つの数字の大小比較を行うツールを実装します。とても単純ですが、AIが間違えやすい比較問題(9.11と9.9の大小比較等)を解決します。
  • ツールの登録・実行管理

ツール使用前

通常のチャット画面

ツール使用後

数値比較ツールの実行結果

MCPクライアント機能

  • サーバーとの双方向通信
  • 設定ファイルによる接続管理
  • エラーハンドリングとリトライ処理

チャットインターフェース

  • Google Gemini APIによる自然言語処理
  • MCPツールとの連携機能

チャットCLIの利用イメージ

📋 必要要件

  • Bun ランタイム(v1.0.0以上)
  • MCP対応クライアント(例:Claude Desktop App、Cline、Cursor)
  • Gemini API キー(チャットCLI利用時)

🚀 クイックスタート

1. プロジェクトのセットアップ

# 依存関係のインストール
bun install

# 環境変数ファイルの作成
cp .env.example .env

# .envファイルにGemini APIキーを設定
# Google Cloud ConsoleからAPIキーを取得して設定
GEMINI_API_KEY="your-api-key-here"

2. サーバー設定

// server-config.jsonを作成
{
    "my-simple-tool": {
        "command": "bun",
        "args": [
            "run",
            "/absolute/path/to/mcp-server/index.ts"
        ]
    }
}

※ パスは環境に合わせて適切な絶対パスに変更してください。

3. 実行

# チャットCLIの起動
bun run chat

🏗️ システム構成

ディレクトリ構造

src/
├── index.ts                 # チャットCLIのエントリーポイント
├── llm-clients/            # LLMクライアント実装
│   └── gemini.ts           # Google Gemini APIクライアント
├── mcp-client/            # MCPクライアントモジュール
│   ├── client.ts          # MCPツールクライアント実装
│   └── config.ts          # クライアント設定ローダー
└── mcp-server/           # MCPサーバーモジュール
    ├── index.ts          # サーバーのエントリーポイント
    └── tools/            # MCPツール実装
        └── compare-numbers.ts  # 数値比較ツール

コンポーネントの説明

MCPサーバー

  • src/mcp-server/: Model Context Protocol準拠のサーバー実装
  • ツールの登録と実行を管理
  • 数値比較などのツールを提供

MCPクライアント

  • src/mcp-client/: MCPサーバーとの通信を行うクライアントライブラリ
  • サーバー設定の読み込みと接続管理
  • ツールの呼び出しとレスポンス処理

LLMクライアント

  • src/llm-clients/: 言語モデルとの対話を管理
  • Google Gemini APIを使用した自然言語処理
  • MCPツールとの連携機能を実装

データフロー

  1. ユーザーがチャットCLIに入力

    • 質問やコマンドをテキストで入力
    • 入力は日本語で自然な形式が可能
  2. Geminiクライアントが入力を処理

    • 入力テキストを分析
    • ツール使用の必要性を判断
    • 適切なツールとパラメータを選択
  3. 必要に応じてMCPツールを呼び出し

    • MCPクライアントを通じてサーバーと通信
    • ツールに必要なパラメータを渡す
    • 実行結果を受け取る
  4. ツールの実行結果をGeminiに渡して応答を生成

    • ツールの出力を自然言語に変換
    • コンテキストに応じた適切な説明を生成
    • エラー発生時は分かりやすいメッセージを作成
  5. 結果をユーザーに表示

    • 処理結果を日本語で分かりやすく表示
    • エラーが発生した場合は対処方法も提示

⚙️ 設定ガイド

サーバー設定

サーバーの設定は以下の2つのファイルで管理します:

1. 環境変数(.env)

# Google Cloud ConsoleからAPIキーを取得して設定
GEMINI_API_KEY="your-api-key-here"

2. サーバー設定(server-config.json)

// server-config.jsonを作成
{
    "my-simple-tool": {
        "command": "bun",
        "args": [
            "run",
            "/absolute/path/to/mcp-server/index.ts"
        ]
    }
}
設定項目必須デフォルト値説明
command✓-サーバー実行コマンド(bun/node等)
args✓-実行引数(サーバーファイルパス等)
disabled-falseサーバーの無効化フラグ
autoApprove-[]自動承認するツールのリスト
timeout-30000ツール実行のタイムアウト時間(ミリ秒)

⚠️ 重要な注意点

  • サーバーファイルのパスは必ず絶対パスを使用
  • 設定変更後はクライアントの再起動が必要
  • autoApproveの使用は必要最小限に
  • 環境変数は.envファイルで管理し、.gitignoreに追加

基本的な使い方

# チャットの開始
bun run chat

# チャットの終了方法
exit    # 終了
quit    # 終了
終了     # 終了

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Sample Model Context Protocol server with a numeric comparison tool from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-server-client-example)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools