Skip to main content
Glama
synabreu

Hello Plugins

by synabreu

Hello, Plugins! — Python OpenAI Plugin

hello_plugins ツールを呼び出すと、正確に Hello, Plugins! を返す、最小限の OpenAI Plugin の例です。

OpenAI Plugin は Skill、MCP サーバー、またはその両方で構成できます。このプロジェクトは実行コードが必要な最小の形なので、Python MCP サーバーを 1 つだけ使用します。OpenAI API を直接呼び出さないため、OPENAI_API_KEY も必要ありません。

プロジェクト構造

hello-plugins-python/
├── server.py          # MCP 서버와 hello_plugins 도구
├── test_server.py     # 반환 문자열 테스트
├── requirements.txt  # 고정된 Python 의존성
├── pyproject.toml
├── Dockerfile
└── README.md

Related MCP server: hello-mcp

Windows 11 / PowerShell での実行

Python 3.10 以上が必要です。

cd hello-plugins-python
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
python server.py

実行後の MCP Streamable HTTP アドレスは次のとおりです。

http://localhost:8000/mcp

PowerShell の実行ポリシーが原因で仮想環境のアクティブ化がブロックされる場合は、現在のターミナルでのみ次のコマンドを先に実行します。

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

macOS / Linux での実行

cd hello-plugins-python
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python server.py

テスト

python -m pytest -q
python verify_mcp.py

期待される結果:

1 passed
MCP verification passed: Hello, Plugins!

MCP Inspector での確認

Node.js がインストールされている場合は、次を実行します。

npx @modelcontextprotocol/inspector

Inspector で Transport に Streamable HTTP を選択し、URL に http://localhost:8000/mcp を入力します。接続後 hello_plugins ツールを呼び出すと、次の文字列が返されます。

Hello, Plugins!

ChatGPT Work に個人用 Plugin として接続

ChatGPT はローカル PC の localhost に直接アクセスできないため、テストするには /mcp エンドポイントを公開 HTTPS アドレスにデプロイするか、OpenAI Secure MCP Tunnel を使用する必要があります。

  1. サーバーを公開 HTTPS 環境にデプロイします。

  2. ChatGPT で Settings → Security and login → Developer mode をオンにします。

  3. Plugins 画面で + を押し、https://YOUR-DOMAIN/mcp を入力します。

  4. 作成された個人用 Plugin をインストールします。

  5. ChatGPT Work のチャットで @Hello Plugins を選択し、「プラグインの挨拶を出力して」とリクエストします。

Docker での実行

docker build -t hello-plugins .
docker run --rm -p 8000:8000 hello-plugins

核心コード

@mcp.tool(
    name="hello_plugins",
    description="Return the exact greeting 'Hello, Plugins!'. This tool is read-only.",
)
def hello_plugins() -> str:
    return "Hello, Plugins!"

参考

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal Model Context Protocol server that facilitates network-based client connections using Streamable HTTP transport. It provides a greeting tool and is optimized for consistent deployment across local environments, Docker, and Kubernetes.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal learning-focused MCP server that demonstrates core primitives like tools and resources through simple greeting functions. It provides a foundational example for connecting AI models to external data using both Streamable HTTP and stdio transports.
    10 npm
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal MCP server offering a hello_world tool that returns a greeting and current UTC time via streamable HTTP.
    -
  • A
    license
    A
    quality
    A
    maintenance
    A minimal MCP server that provides health/status checks and multilingual greetings via the server_info and greet tools.
    2
    MIT