Complete Setup Guide: Asenion MCP + OpenAI ChatGPT Agent

This guide will help you expose your local MCP server to ChatGPT using ngrok, a secure tunneling service.


Prerequisites

Before you begin, ensure you have:

  • MCP server running on http://127.0.0.1:8001
  • Python 3.11+ installed
  • Internet connection
  • ngrok account (free account works)
  • ChatGPT Subscription with at least the Plus tier

Step 1: Set Up Ngrok

1.1 Create Ngrok Account

  1. Go to https://ngrok.com/
  2. Click Sign up (or Sign in if you have an account)
  3. Create a free account (email signup or GitHub/Google)
  4. Verify your email if required

1.2 Get Your Authtoken

  1. After logging in, go to Your Authtoken page:
    • Dashboard: https://dashboard.ngrok.com/get-started/your-authtoken
    • Or: Dashboard → Your Authtoken in left sidebar
  2. Copy your authtoken (looks like: 2abc123def456ghi789jkl012mno345pq_6r7s8t9u0v1w2x3y4z5a6b7c8d9e0f1g2h)

1.3 Install Ngrok

Option A: Download Binary (Recommended)

  1. Go to https://ngrok.com/download
  2. Download for your OS:
    • Windows: Download ngrok.exe
    • Mac: Download ngrok for macOS
    • Linux: Download ngrok for Linux
  3. Extract the file to a location in your PATH, or to your project directory

Option B: Package Manager

Windows (Chocolatey):

choco install ngrok

Mac (Homebrew):

brew install ngrok/ngrok/ngrok

Linux (Snap):

sudo snap install ngrok

1.4 Configure Ngrok

Windows PowerShell:

ngrok config add-authtoken YOUR_AUTHTOKEN_HERE

Linux/Mac:

ngrok config add-authtoken YOUR_AUTHTOKEN_HERE

Replace YOUR_AUTHTOKEN_HERE with the authtoken you copied from step 1.2.

Expected Output:

Authtoken saved to configuration file: C:\Users\YourName\AppData\Local\ngrok\ngrok.yml

1.5 Verify Installation

ngrok version

Should show ngrok version (e.g., ngrok version 3.x.x).


Step 2: Start Ngrok Tunnel

2.1 Ensure MCP Server is Running

First, make sure your MCP server is running:

# In the main project directory
uvicorn asenion_mcp.app:fastapi_app --port 8001

You should see:

INFO:     Uvicorn running on http://127.0.0.1:8001

2.2 Start Ngrok Tunnel

In a new terminal window, run:

ngrok http 8001

Expected Output:

ngrok                                                                              
                                                                                   
Session Status                online                                               
Account                       Your Name (Plan: Free)                               
Version                       3.x.x                                                 
Region                        United States (us)                                    
Latency                       -                                                     
Web Interface                 http://127.0.0.1:4040                                 
Forwarding                    https://abc123def456.ngrok-free.app -> http://localhost:8001
                                                                                   
Connections                   ttl     opn     rt1     rt5     p50     p90           
                              0       0       0.00    0.00    0.00    0.00          

Important:

  • Keep this terminal window open while using ChatGPT
  • The Forwarding URL is your public ngrok URL
  • The URL format will be: https://[random].ngrok-free.app

2.3 Get Your Ngrok URL

Method 1: From Terminal Output

  • Look for the Forwarding line in the ngrok output
  • Copy the HTTPS URL (e.g., https://abc123def456.ngrok-free.app)

Method 2: From Ngrok Dashboard

  • Open http://127.0.0.1:4040 in your browser
  • You’ll see the ngrok web interface
  • The public URL is shown at the top

Method 3: Via API

Invoke-RestMethod -Uri "http://127.0.0.1:4040/api/tunnels" | ConvertTo-Json

2.4 Your MCP Endpoint URL

Your ChatGPT Connector URL will be:

https://[your-ngrok-url].ngrok-free.app/mcp

Important: The URL must end with /mcp (not just the ngrok URL)

Example:

  • Ngrok URL: https://abc123def456.ngrok-free.app
  • MCP Endpoint: https://abc123def456.ngrok-free.app/mcp

Step 3: Verify Ngrok Tunnel

3.1 Test the Tunnel

Windows PowerShell:

# Test server info through ngrok
$ngrokUrl = "https://YOUR_NGROK_URL.ngrok-free.app"
Invoke-RestMethod -Uri "$ngrokUrl/mcp/tools/get_server_info" -Method POST -ContentType "application/json" -Body '{}'

Linux/Mac:

curl -X POST https://YOUR_NGROK_URL.ngrok-free.app/mcp/tools/get_server_info \
  -H "Content-Type: application/json" \
  -d '{}'

Expected Response:

{
  "name": "asenion-mcp",
  "version": "0.1.1",
  "org_id": "org-123",
  "system_id": "sys-1"
}

If you see this response, ngrok is working correctly!

3.2 View Ngrok Dashboard

Open http://127.0.0.1:4040 in your browser to see:

  • All HTTP requests to your MCP server
  • Request/response details
  • Current public URL
  • Request history

Your Ngrok URL

Note: Your ngrok URL will be different each time you start ngrok (on free plan).

To get your current URL:

  1. Check the ngrok terminal output (see Step 2.2)
  2. Or visit http://127.0.0.1:4040
  3. Or run: Invoke-RestMethod -Uri "http://127.0.0.1:4040/api/tunnels" | ConvertTo-Json

Your ChatGPT Connector URL format:

https://[your-ngrok-url].ngrok-free.app/mcp

Step 4: Setting Up ChatGPT Connector

4.1: Enable Developer Mode in ChatGPT

  1. Open ChatGPT app
  2. Go to SettingsApps & Connectors
  3. Click Advanced settings
  4. Toggle Developer Mode to ON

4.2: Create Connector in ChatGPT

  1. In ChatGPT app, go to SettingsConnectorsCreate
  2. Fill in the form:
    • Connector Name: Asenion MCP (or any name)
    • Description: Governance and compliance policy checking
    • Connector URL: https://YOUR_NGROK_URL.ngrok-free.app/mcp
      • Important:
        • Replace YOUR_NGROK_URL with your actual ngrok URL from Step 2.3
        • Must end with /mcp (not just the ngrok URL)
        • Example: https://abc123def456.ngrok-free.app/mcp
  3. Click Create

4.3: Use the Connector

  1. Start a new chat in ChatGPT
  2. Click the + button near the message input
  3. Select More → Choose your Asenion MCP connector
  4. ChatGPT can now use your governance tools!

Step 5: Testing the Connection

You can test the ngrok URL directly (replace YOUR_NGROK_URL with your actual URL):

Windows PowerShell:

# Set your ngrok URL
$ngrokUrl = "https://YOUR_NGROK_URL.ngrok-free.app"

# Test server info
Invoke-RestMethod -Uri "$ngrokUrl/mcp/tools/get_server_info" -Method POST -ContentType "application/json" -Body '{}'

# Test check_action
$body = @{
    org_id = "org-123"
    system_id = "sys-1"
    action = @{
        type = "send_email"
        destination = "alice@external.com"
        data_classes = @("PII")
        use_case_id = "uc-email-1"
    }
    context = @{
        actor = "test"
        purpose = "testing"
    }
} | ConvertTo-Json -Depth 10

Invoke-RestMethod -Uri "$ngrokUrl/mcp/tools/check_action" -Method POST -ContentType "application/json" -Body $body

Linux/Mac:

# Set your ngrok URL
NGROK_URL="https://YOUR_NGROK_URL.ngrok-free.app"

# Test server info
curl -X POST "$NGROK_URL/mcp/tools/get_server_info" \
  -H "Content-Type: application/json" \
  -d '{}'

# Test check_action
curl -X POST "$NGROK_URL/mcp/tools/check_action" \
  -H "Content-Type: application/json" \
  -d '{
    "org_id": "org-123",
    "system_id": "sys-1",
    "action": {
      "type": "send_email",
      "destination": "alice@external.com",
      "data_classes": ["PII"],
      "use_case_id": "uc-email-1"
    },
    "context": {
      "actor": "test",
      "purpose": "testing"
    }
  }'

Example ChatGPT Questions

Once connected, you can ask ChatGPT:

  • “Can I send customer PII to alice@external.com?”
  • “Check if I’m allowed to share financial data with partner@company.com”
  • “What are the requirements for use case uc-email-1?”
  • “What policies apply to system sys-1?”

ChatGPT will automatically use your MCP tools to answer!

Important Notes

Ngrok URL Changes

  • Free ngrok URLs change when you restart ngrok
  • If the URL changes, you need to:
    1. Get the new URL from ngrok (terminal or dashboard)
    2. Update the connector in ChatGPT with the new URL

Keep Services Running

  • Keep ngrok running: If ngrok stops, ChatGPT won’t be able to connect
  • Keep MCP server running: If the server stops, ngrok will forward to nothing
  • Monitor both: Check both services are running before using ChatGPT

Troubleshooting

“ngrok: command not found”

  • Solution: ngrok is not installed or not in PATH
  • Fix:
    • Download ngrok from https://ngrok.com/download
    • Or add ngrok to your PATH
    • Or use full path: C:\path\to\ngrok.exe http 8001

“authtoken is required”

  • Solution: Ngrok authtoken not configured
  • Fix: Run ngrok config add-authtoken YOUR_AUTHTOKEN
  • Get token: https://dashboard.ngrok.com/get-started/your-authtoken

“Connector not working”

  • Verify ngrok is running:
    • Check terminal where you ran ngrok http 8001
    • Or visit http://127.0.0.1:4040
  • Test the URL directly: See Step 5 above
  • Check URL format: Must end with /mcp (not just ngrok URL)
  • Verify MCP server: Test local server first: http://127.0.0.1:8001/mcp/tools/get_server_info

“Connection timeout”

  • Check MCP server is running:
    Invoke-RestMethod -Uri "http://127.0.0.1:8001/mcp/tools/get_server_info" -Method POST -ContentType "application/json" -Body '{}'
    
  • Verify ngrok is forwarding to port 8001: Check ngrok terminal output
  • Check firewall settings: Windows Firewall may block ngrok
  • Check ngrok dashboard: http://127.0.0.1:4040 shows connection status

“URL changed”

  • Cause: Free ngrok URLs change on restart
  • Solution:
    1. Get new URL from ngrok terminal or http://127.0.0.1:4040
    2. Update connector in ChatGPT with new URL
    3. Or use ngrok reserved domain (paid feature)

“ngrok session expired”

  • Cause: Free ngrok sessions have time limits
  • Solution: Restart ngrok: ngrok http 8001
  • Alternative: Use ngrok paid plan for longer sessions

“Cannot connect to localhost:8001”

  • Cause: MCP server not running
  • Solution: Start MCP server first:
    uvicorn asenion_mcp.app:fastapi_app --port 8001
    
  • Verify: Test local server before starting ngrok

Viewing Ngrok Dashboard

Open in browser: http://127.0.0.1:4040

This shows:

  • All HTTP requests to your MCP server
  • Request/response details (headers, body, status codes)
  • Current public URL (your ngrok URL)
  • Request history and timing
  • Webhook inspector for debugging

Useful for debugging: You can see exactly what ChatGPT is sending to your MCP server!


Quick Reference

Start Everything (3 Terminal Windows)

Terminal 1 - MCP Server:

cd asenion-mcp-main
uvicorn asenion_mcp.app:fastapi_app --port 8001

Terminal 2 - Ngrok:

ngrok http 8001

Terminal 3 - Testing:

# Get your ngrok URL
Invoke-RestMethod -Uri "http://127.0.0.1:4040/api/tunnels" | ConvertTo-Json

# Test the connection
$url = "https://YOUR_NGROK_URL.ngrok-free.app/mcp"
Invoke-RestMethod -Uri "$url/tools/get_server_info" -Method POST -ContentType "application/json" -Body '{}'

Get Your Current Ngrok URL

Method 1 - Dashboard:

  • Visit http://127.0.0.1:4040
  • URL shown at top of page

Method 2 - API:

(Invoke-RestMethod -Uri "http://127.0.0.1:4040/api/tunnels").tunnels[0].public_url

Method 3 - Terminal:

  • Look at ngrok terminal output
  • Find the Forwarding line

Next Steps

  1. Install ngrok and configure authtoken
  2. Start MCP server on port 8001
  3. Start ngrok tunnel (ngrok http 8001)
  4. Get your ngrok URL from terminal or dashboard
  5. Test the connection (Step 5)
  6. Create connector in ChatGPT (Step 4)
  7. Test with a governance question in ChatGPT

Your MCP server is ready for ChatGPT!


Summary Checklist

Use this to verify your setup:

  • Ngrok account created
  • Ngrok authtoken configured
  • Ngrok installed and working (ngrok version)
  • MCP server running on port 8001
  • Ngrok tunnel started (ngrok http 8001)
  • Ngrok URL obtained and tested
  • ChatGPT connector created with correct URL
  • Connection tested successfully

Once all items are checked, you’re ready to use Asenion MCP with ChatGPT!


Table of contents