mcpField
M
mcp-client

mcp-client

github.com/coleam00エージェントワークフロー837138 回インストール40 週間前に更新
リポジトリ

mcp-client について

mcp-clientは、MCPサーバーへの接続と操作を行う汎用スキルです。大量のツール定義を最初からコンテキストに読み込まず、必要に応じてスキーマを取得でき、サーバーの確認やツールの調査、実行に対応します。

主な機能

  1. 01ツールスキーマのオンデマンド取得
  2. 02設定済みMCPサーバーの一覧表示
  3. 03ツールとパラメータスキーマの確認
  4. 04引数を指定したツール呼び出し
  5. 05複数のトランスポート設定に対応

活用シーン

  1. 01設定済みMCPサーバーの確認
  2. 02サーバーが提供するツールと引数の確認
  3. 03Zapierなど設定済みサーバーのツール呼び出し
  4. 04ローカルstdioまたはリモートMCPサーバーへの接続

MCP 対応

設定に基づいてMCPサーバーに接続し、コマンド実行のstdio、SSE、Streamable HTTPなどのトランスポートを利用します。ツールスキーマの確認とツールの呼び出しが可能です。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/coleam00/second-brain-skills --skill mcp-client

インストール後、Claude Code で/mcp-clientを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
example-mcp-config.json
mcp-servers.md
python-mcp-sdk.md
scripts/
mcp_client.py

詳細

Universal MCP クライアント

プログレッシブディスクロージャーを利用して、あらゆる MCP サーバーに接続できます。最初から何千ものトークンをコンテキストに詰め込むのではなく、必要に応じてツールスキーマを読み込みます。

スキルの場所

このスキルは次の場所にあります:.claude/skills/mcp-client/

スクリプトのパス: .claude/skills/mcp-client/scripts/mcp_client.py

設定

スクリプトは、次の順序で設定を検索します。

  1. MCP_CONFIG_PATH 環境変数(カスタムパス)
  2. references/mcp-config.json(このスキルの設定ファイル。推奨)
  3. プロジェクトルートの .mcp.json
  4. ~/.claude.json

設定ファイル: .claude/skills/mcp-client/references/mcp-config.json

このファイルを編集して、API キーを追加してください。サンプルファイル(example-mcp-config.json)は、参照用のテンプレートとして残してあります。

ユーザーから Zapier API キーがまだ提供されていない場合は、ユーザーに確認してください。

コマンドの実行

すべてのコマンドで、.claude/skills/mcp-client/scripts/mcp_client.py のスクリプトを使用します。

# List configured servers
python .claude/skills/mcp-client/scripts/mcp_client.py servers

# List tools from a server
python .claude/skills/mcp-client/scripts/mcp_client.py tools <server_name>

# Call a tool
python .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '{"arg": "value"}'

ワークフロー

  1. 設定ファイルを確認する - servers コマンドを実行します。エラーが発生した場合は、.mcp.json を作成します
  2. サーバーを一覧表示する - 設定されている MCP サーバーを確認します
  3. ツールを一覧表示する - 特定のサーバーからツールスキーマを取得します
  4. ツールを呼び出す - 引数を指定してツールを実行します

コマンドリファレンス

コマンド説明
servers設定済みの MCP サーバーをすべて一覧表示します
tools <server>パラメータースキーマをすべて含むツールの一覧を表示します
call <server> <tool> '<json>'引数を指定してツールを実行します

例:Zapier

# 1. List servers to confirm Zapier is configured
python .claude/skills/mcp-client/scripts/mcp_client.py servers

# 2. List Zapier tools
python .claude/skills/mcp-client/scripts/mcp_client.py tools zapier

# 3. Call a Zapier tool
python .claude/skills/mcp-client/scripts/mcp_client.py call zapier <tool_name> '{"param": "value"}'

例:Sequential Thinking

# 1. List tools
python .claude/skills/mcp-client/scripts/mcp_client.py tools sequential-thinking

# 2. Use sequential thinking
python .claude/skills/mcp-client/scripts/mcp_client.py call sequential-thinking sequentialthinking '{"thought": "Breaking down the problem...", "thoughtNumber": 1, "totalThoughts": 5, "nextThoughtNeeded": true}'

設定形式

設定ファイルの形式(references/mcp-config.json):

{
  "mcpServers": {
    "zapier": {
      "url": "https://mcp.zapier.com/api/v1/connect",
      "api_key": "your-api-key"
    },
    "sequential-thinking": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}

トランスポートの判定:

  • url + api_key → Bearer 認証を使用する FastMCP(Zapier)
  • command + args → stdio(sequential-thinking のようなローカルサーバー)
  • /sse で終わる url → SSE トランスポート
  • /mcp で終わる url → Streamable HTTP

エラー処理

エラーは JSON で返されます。

{"error": "message", "type": "configuration|validation|connection"}
  • configuration - 設定ファイルが見つかりません。.mcp.json を作成してください
  • validation - サーバー名またはツール名が無効です
  • connection - サーバーへの接続に失敗しました

依存関係

pip install mcp fastmcp

参考資料

  • references/example-mcp-config.json - 設定ファイルのテンプレート
  • references/mcp-servers.md - 一般的なサーバー設定
  • references/python-mcp-sdk.md - Python SDK のドキュメント

コメント