ChatGPT Integration Steps
✅ IMPORTANT: OAuth Storage Now Enabled!
Your server now has persistent OAuth storage that saves:
- ✅ Registered OAuth clients
- ✅ Authorization codes
- ✅ Access tokens
See OAUTH_STORAGE_SETUP.md for details on the OAuth implementation.
✅ IMPORTANT: Use This URL
When adding the app in ChatGPT, try these URLs in order:
Option 1: Plugin Manifest (Try This First):
https://mcp.sqltrainer.com/.well-known/ai-plugin.json
Option 2: OpenAPI Spec:
https://mcp.sqltrainer.com/openapi.json
Option 3: Base Domain (for MCP):
https://mcp.sqltrainer.com
Current Status ✅
Your server is properly configured and accessible:
- Plugin Manifest: https://mcp.sqltrainer.com/.well-known/ai-plugin.json ✅ TRY THIS FIRST!
- OpenAPI Spec: https://mcp.sqltrainer.com/openapi.json ✅
- Server URL: https://mcp.sqltrainer.com ✅
- MCP Endpoint: https://mcp.sqltrainer.com/mcp ✅ Working
- Search API: https://mcp.sqltrainer.com/api/search ✅ Working
- OAuth Metadata: https://mcp.sqltrainer.com/.well-known/oauth-protected-resource ✅ Working
- Client Registration: https://mcp.sqltrainer.com/register ✅ Working
All endpoints now support both GET and POST methods!
Why the App Isn’t Created Yet
ChatGPT has successfully:
- ✅ Discovered your OAuth metadata
- ✅ Registered as a client (you see the 201 response in logs)
But the app won’t appear in ChatGPT until you manually add it in the ChatGPT interface.
Steps to Add Your App in ChatGPT
Option 1: Add via ChatGPT Settings
-
Open ChatGPT (https://chat.openai.com)
-
Go to Settings:
- Click your profile picture (bottom left)
- Click “Settings”
-
Navigate to Apps/Extensions:
- Look for “Apps” or “Extensions” or “Integrations” section
- This may also be under “Beta features” or “Labs”
-
Add New App:
- Click “Add App” or “Connect App” or similar button
- Enter your server URL:
https://mcp.sqltrainer.com
-
ChatGPT Will:
- Discover your OAuth endpoints automatically
- Use the already-registered client credentials
- Connect to your MCP endpoint
- Show your tools:
corpus_searchandopen_connectors
Option 2: Use Custom GPT Builder (RECOMMENDED)
-
Create a Custom GPT:
- Go to https://chat.openai.com/gpts/editor
- Click “Create a GPT”
-
Configure Actions:
- Click “Configure” tab (top)
- Scroll down to “Actions” section
- Click “Create new action”
-
Import OpenAPI Schema:
- Click “Import from URL”
- Try these URLs in order:
https://mcp.sqltrainer.com/.well-known/ai-plugin.json(Plugin format)https://mcp.sqltrainer.com/openapi.json(OpenAPI format)
- Click “Import”
-
Configure OAuth (should auto-configure from the spec):
- Authentication Type: OAuth
- Authorization URL: https://mcp.sqltrainer.com/authorize
- Token URL: https://mcp.sqltrainer.com/token
- Client ID: Use the one from your logs (e.g.,
client_41962f44bcc14cee) - Scope:
corpus:read corpus:search
-
Test the Integration:
- Use the preview panel on the right
- Try: “Search my corpus for information about X”
- You should see the action being called
Option 3: Direct API Key Configuration (if supported)
Some ChatGPT interfaces allow you to add an MCP server directly:
- Look for “MCP Servers” or “Model Context Protocol” settings
- Add server URL:
https://mcp.sqltrainer.com - The OAuth flow will happen automatically
Troubleshooting
If App Still Doesn’t Appear
-
Check ChatGPT Plus/Team/Enterprise Subscription:
- Custom apps/MCP might require a paid subscription
- Free tier may not support custom integrations
-
Verify OAuth Flow:
- Watch your server logs when you try to add the app
- You should see:
- GET to
/.well-known/oauth-protected-resource - POST to
/register(already working) - GET to
/authorize - POST to
/token
- GET to
-
Check for Errors in ChatGPT:
- Look for error messages when adding the app
- Common issues:
- “Invalid OAuth configuration”
- “Could not verify server”
- “Connection failed”
-
Verify HTTPS Certificate:
- Your Cloudflare tunnel should provide valid HTTPS
- Test: https://www.ssllabs.com/ssltest/analyze.html?d=mcp.sqltrainer.com
Expected Behavior After Adding
Once added successfully, you should be able to:
-
Ask ChatGPT questions that trigger your tools:
- “Search my corpus for information about X”
- “What did we decide about Y?”
- “Open connectors”
-
See the Widget:
- ChatGPT should display your custom CorpusIQ widget
- Widget shows search interface and connector management
-
View Tool Calls in Logs:
INFO - Tool call: corpus_search INFO - Search completed: 5 results found
Testing Without ChatGPT
You can test your MCP server using the test scripts:
# Test MCP endpoint
.\test_mcp_proper.ps1
# Test OAuth metadata
Invoke-RestMethod https://mcp.sqltrainer.com/.well-known/oauth-protected-resource
# Test client registration
Invoke-RestMethod https://mcp.sqltrainer.com/register -Method POST -Body '{"client_name":"Test"}' -ContentType "application/json"
Next Steps
- ✅ Your server is ready
- ⏭️ Add the app in ChatGPT interface (see options above)
- ⏭️ Test the integration
- ⏭️ Monitor server logs for any errors
Important URLs
- Server: https://mcp.sqltrainer.com
- MCP Endpoint: https://mcp.sqltrainer.com/mcp
- OAuth Discovery: https://mcp.sqltrainer.com/.well-known/oauth-protected-resource
- Registration: https://mcp.sqltrainer.com/register
- Authorization: https://mcp.sqltrainer.com/authorize
- Token: https://mcp.sqltrainer.com/token
All endpoints are working correctly! ✅