mcpField
M
mcp-server-test

mcp-server-test

ローカル
github.com/i-icc開発ツール080 週間前に更新

mcp-server-test について

MCP サーバーをテストするための Python プロジェクトの記録です。pyenv による環境構築と、クライアントの起動エラーの対処を扱い、ローカルサーバーを設定する開発者向けです。

主な機能

  1. 01Python 環境構築の記録
  2. 02MCP サーバー起動設定
  3. 03Python コマンドパスの調査

活用シーン

  1. 01pyenv で Python 環境を構築
  2. 02クライアントからローカルサーバーを起動
  3. 03spawn python ENOENT エラーの調査

MCP 対応

Python コマンドでローカルサーバーを起動する MCP クライアント設定例があります。公開するツールやリソースは説明されていません。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

README(原文)English

プロジェクトの README より

この README の日本語訳はまだありません。以下は英語の原文です。日本語の紹介はページ上部をご覧ください。

mcp-server-test

MCP サーバーのテスト

公式だと uv を使用して環境構築している

pyenv でやりたい

https://modelcontextprotocol.io/quickstart/server

まずは好きなバージョンのpython をインストール

Python 3.10 or higher installed.

と言われているのでとりあえず 3.11.5 をインストール

global で設定

コードはそのまま

MCPの設定

{
    "mcpServers": {
        "weather": {
            "command": "python",
            "args": [
                "MY-PATH/mcp-server-test/src/main.py"
            ]
        }
    }
}

すると下記のエラーが

2025-04-15T14:13:02.862Z [weather] [info] Initializing server...

2025-04-15T14:13:02.891Z [weather] [error] spawn python ENOENT {"context":"connection","stack":"Error: spawn python ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n    at onErrorNT (node:internal/child_process:483:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}

2025-04-15T14:13:02.891Z [weather] [error] spawn python ENOENT {"stack":"Error: spawn python ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n    at onErrorNT (node:internal/child_process:483:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}

2025-04-15T14:13:02.896Z [weather] [info] Server transport closed

2025-04-15T14:13:02.896Z [weather] [info] Client transport closed

2025-04-15T14:13:02.896Z [weather] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.

2025-04-15T14:13:02.896Z [weather] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}

python コマンドがないとのことなので下記に修正します

$ which python
MY-PATH/.pyenv/shims/python
{
    "mcpServers": {
        "weather": {
            "command": "MY-PATH/.pyenv/shims/python",
            "args": [
                "MY-PATH/mcp-server-test/src/main.py"
            ]
        }
    }
}

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。