mcpField
M
mcp-server-test

mcp-server-test

本地服务
github.com/i-icc开发工具080 周前更新

关于 mcp-server-test

用于测试 MCP 服务的 Python 项目记录,内容聚焦于使用 pyenv 配置环境并排查客户端启动失败的问题。适合正在配置本地 MCP 服务的开发者参考。

主要功能

  1. 01记录 Python 环境配置
  2. 02展示 MCP 服务启动配置
  3. 03说明 python 命令路径排查

适用场景

  1. 01使用 pyenv 配置 Python 环境
  2. 02配置客户端启动本地服务
  3. 03排查 spawn python ENOENT 错误

MCP 相关

示例配置 MCP 客户端通过 Python 命令启动本地服务;文档未说明服务暴露的工具或资源。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 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"
            ]
        }
    }
}

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。