Connect ChatGPT to MCP
Connect ChatGPT to Casdoor’s MCP server so you can manage applications, users, and resources from ChatGPT. Requires ChatGPT Plus or Enterprise with MCP support (OpenAI docs).
Prerequisites
- A running Casdoor instance (HTTPS required for ChatGPT integration)
- A ChatGPT Plus or Enterprise account with MCP support
- Admin access to your Casdoor instance to create applications
Step 1: Create an application in Casdoor
Create a Casdoor application for ChatGPT’s OAuth:
-
Log in to your Casdoor admin panel
-
Navigate to Applications and click Add
-
Configure the application with these settings:
-
Name:
chatgpt-mcp(or your preferred name) -
Display Name:
ChatGPT MCP Client -
Organization: Select your organization
-
Redirect URIs: Add the ChatGPT OAuth callback URL:
https://chat.openai.com/auth/callbackwarningChatGPT requires HTTPS for OAuth callbacks. Ensure your Casdoor instance is accessible via HTTPS.
-
:::
-
Grant Types: Enable
Authorization CodeandRefresh Token -
Enable PKCE: Check this option for enhanced security
-
Token Format:
JWT(recommended) -
(Optional) Application Type: Set to
Agent -
(Optional) Category: Set to
MCPfor better organizationінформаціяSee Application categories for Category and Type options.
:::
- Click Save and note the Client ID and Client Secret for the next step.
Step 2: Configure ChatGPT MCP Connection
ChatGPT supports connecting to MCP servers through its settings interface.
Access MCP Settings
- Log in to ChatGPT
- Click on your profile icon in the bottom left
- Go to Settings → Beta Features
- Enable Model Context Protocol (if not already enabled)
- Navigate to Settings → MCP Servers
Add Casdoor MCP Server
-
Click Add Server or + New Server
-
Fill in the server details:
- Server Name:
Casdoor(or your preferred name) - Server URL:
https://your-casdoor.com/api/mcp - Authentication Type: Select
OAuth 2.0 - Client ID: Your Client ID from Step 1
- Client Secret: Your Client Secret from Step 1
- Authorization URL:
https://your-casdoor.com/api/login/oauth/authorize - Token URL:
https://your-casdoor.com/api/login/oauth/access_token - Scopes:
read:application write:application openid profile email
- Server Name:
-
Click Save or Connect
The exact UI and field names may vary depending on ChatGPT's current interface. Refer to ChatGPT's help documentation for the most up-to-date instructions.
Configuring Scopes
The scopes you configure control what permissions ChatGPT has. Common scopes include:
read:application- View applicationswrite:application- Create, update, delete applicationsread:user- View userswrite:user- Create, update, delete usersopenid profile email- Basic user information (required for OAuth)
See Authorization and Scopes for the complete list of available scopes.
Step 3: Complete the OAuth Flow
After adding the server configuration:
- ChatGPT will automatically initiate the OAuth flow
- You'll be redirected to the Casdoor login page (if not already logged in)
- After logging in, you'll see a Consent Screen asking you to authorize ChatGPT
- The consent screen displays the requested scopes (permissions)
- Click Authorize to grant access
- You'll be redirected back to ChatGPT with a success message
- The connection is now established
The OAuth token is securely stored by ChatGPT. You won't need to re-authorize unless you revoke the token or change scopes.
Step 4: Verify the Connection
Test the connection by asking ChatGPT to interact with Casdoor in a new conversation:
Example prompts to try:
- "Using Casdoor, list all applications"
- "Show me details about the application named 'my-app' from Casdoor"
- "Create a new application in Casdoor called 'test-app' in organization 'my-org'"
ChatGPT will use the MCP tools to execute these commands. You should see responses with data from your Casdoor instance.
Expected output for "List all applications":
I've connected to your Casdoor instance and found the following applications:
1. chatgpt-mcp (ChatGPT MCP Client)
- Organization: my-org
- Created: 2024-01-15
2. app-built-in (Casdoor)
- Organization: built-in
- Default application
...
Alternative: Using MCP Proxy (Advanced)
If ChatGPT doesn't support direct MCP server connections or you need more control, you can use an MCP proxy service: