Toy
概要
FastMCPを利用した、単語内の特定文字の出現回数をカウントするツールと、UUIDv7を生成するツールを提供するシンプルなMCPサーバーです。
count_letters
ツールは、大文字・小文字を区別せずに文字をカウントします。
提供ツール
count_letters
- 機能: 指定された単語 (
word
) の中に、指定された文字 (letter
) が何回出現するかを返します。 - 入力:
word
(文字列): カウント対象の単語。letter
(文字列): カウントする文字。
- 出力:
result
(数値): 文字の出現回数。
リクエスト例 (MCPクライアントから送信される想定):
レスポンス例 (MCPサーバーから返される想定):
generate_uuid7s
- 機能: 指定された数のUUIDv7を生成します。デフォルトは1つです。
- 入力:
count
(数値, オプション): 生成するUUIDの数。デフォルトは1。1以上の整数である必要があります。
- 出力:
result
(文字列のリスト): 生成されたUUIDv7のリスト。
リクエスト例 (MCPクライアントから送信される想定):
レスポンス例 (MCPサーバーから返される想定):
セットアップ
前提条件
- Python 3.13.1
- Make
- uv (Pythonパッケージ管理ツール)
手順
- 仮想環境の作成と依存関係のインストール:
pyproject.toml
にプロジェクトの依存関係が定義されています。以下のコマンドを実行すると、uv
が仮想環境を作成(存在しない場合)し、依存関係を同期します。
使用方法
このMCPサーバー (server.py
) は、標準入出力(stdio)を介してMCPクライアントと通信します。
サーバーを起動するには、プロジェクトのルートディレクトリで以下のコマンドを実行します。
または、仮想環境を有効化 (source .venv/bin/activate
) している場合は、以下でも起動できます。
起動後、MCPクライアントは上記「提供ツール」セクションに記載されたJSON形式でリクエストを標準入力に送信し、結果を標準出力から受け取ります。
Cursor / Windsurf での使用方法
Cursor / Windsurf の設定ファイル (mcp_config.json
など) に以下のように追記することで、このMCPサーバーを利用できます。
注意: args
内の --directory
のパスは、この README.md
があるディレクトリ (プロジェクトのルートディレクトリ) を指すように、ご自身の環境に合わせて適宜修正してください。
開発コマンド (Makefile)
プロジェクトのルートディレクトリで以下の make
コマンドを実行できます。
- フォーマットと静的解析、テストの実行:このコマンドは、Ruffによるコードフォーマットとチェック、Mypyによる型チェック、Pytestによる単体テスト(カバレッジレポート生成を含む)を一括で実行します。
- コードフォーマットとチェック:このコマンドは、Ruffを使用してコードのフォーマットとチェック(自動修正含む)を実行します。
ディレクトリ構成
This server cannot be installed
A simple MCP server that provides two tools: one for counting specific letter occurrences within words and another for generating UUIDv7s.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that enables fetching web content using the Node.js undici library, supporting various HTTP methods, content formats, and request configurations.Last updated -668TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that implements Claude Code-like functionality, allowing the AI to analyze codebases, modify files, execute commands, and manage projects through direct file system interactions.Last updated -174PythonMIT License
- -securityFlicense-qualityA custom MCP server that allows storage, retrieval, and management of text-based information with natural language commands and keyword detection.Last updated -TypeScript
- -securityFlicense-qualityAn MCP server that enables generating scripts based on specified topics and keywords, while also providing functionality to store and summarize notes.Last updated -Python