Skip to main content
Glama
NGROK.md2.89 kB
# ngrok 設定例 ## 基本的な使い方 ### 1. ngrokのインストール ```bash # macOS brew install ngrok # Linux curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \ sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \ sudo tee /etc/apt/sources.list.d/ngrok.list && \ sudo apt update && sudo apt install ngrok ``` ### 2. ngrok認証トークンの設定 ```bash ngrok config add-authtoken YOUR_AUTHTOKEN ``` ### 3. MCPサーバーの起動(HTTPモード) ```bash # 認証なし MCP_MODE=http MCP_HTTP_PORT=3000 npm start:http # 認証あり(推奨) MCP_MODE=http MCP_HTTP_PORT=3000 MCP_API_KEY=your-secret-key npm start:http:auth ``` ### 4. ngrokトンネルの作成 ```bash # 別のターミナルで実行 ngrok http 3000 ``` ngrokが起動すると以下のような情報が表示されます: ``` Forwarding https://xxxx-xx-xx-xx-xx.ngrok-free.app -> http://localhost:3000 ``` ## OpenAIでの使用 ### 1. OpenAI GPTs設定 - https://platform.openai.com/playground にアクセス - Custom GPT設定で以下を追加: ```json { "openapi": "3.0.0", "info": { "title": "Universal MCP Server", "version": "1.0.0" }, "servers": [ { "url": "https://your-ngrok-url.ngrok-free.app" } ], "paths": { "/health": { "get": { "summary": "Health check", "responses": { "200": { "description": "OK" } } } } } } ``` ### 2. 認証ヘッダー(APIキーを設定した場合) ``` Authorization: Bearer your-secret-key ``` ## セキュリティ推奨事項 1. **必ずAPIキーを設定する** ```bash export MCP_API_KEY=$(openssl rand -hex 32) ``` 2. **ngrok固定ドメイン使用(有料プラン)** - 無料プランではURLが毎回変わります - 固定ドメインがあると設定が楽です 3. **IP制限(ngrok有料プラン)** ```bash ngrok http 3000 --cidr-allow 1.2.3.4/32 ``` 4. **HTTPSのみ使用** - ngrokは自動的にHTTPSを提供します ## トラブルシューティング ### ポートが既に使用中 ```bash # 別のポートを使用 MCP_HTTP_PORT=3001 npm start:http ngrok http 3001 ``` ### 接続テスト ```bash # ヘルスチェック curl https://your-ngrok-url.ngrok-free.app/health # 認証あり curl -H "Authorization: Bearer your-api-key" \ https://your-ngrok-url.ngrok-free.app/info ``` ## 本番環境での使用 本番環境では以下を推奨します: 1. 専用のVPS/クラウドサーバー 2. リバースプロキシ(Nginx/Caddy) 3. SSL証明書(Let's Encrypt) 4. ファイアウォール設定 5. レート制限 6. 監視・アラート ngrokは開発・デモ用途に最適ですが、本番環境では適切なインフラを構築してください。

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Amana03/universal-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server