Connect Cursor to MCP
Connect Cursor IDE to Casdoor’s MCP server so you can manage applications, users, and resources from the editor.
Prerequisites
- A running Casdoor instance (HTTPS recommended for production)
- Cursor IDE installed on your computer
- Admin access to your Casdoor instance to create applications
Step 1: Create an application in Casdoor
Create a Casdoor application for Cursor’s OAuth:
-
Log in to your Casdoor admin panel
-
Navigate to Applications and click Add
-
Configure the application with these settings:
-
Name:
cursor-mcp(or your preferred name) -
Display Name:
Cursor IDE MCP Client -
Organization: Select your organization
-
Redirect URIs: Add these OAuth callback URLs:
http://127.0.0.1:*/callback
http://localhost:*/callbackmẹoThe wildcard
*allows Cursor to use any available port for the OAuth callback.
-
-
Grant Types: Enable
Authorization Codeand optionallyRefresh 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 organizationthông tinSee Application categories for Category and Type options.
-
Click Save and note the Client ID for the next step.
Step 2: Configure Cursor MCP settings
Cursor supports MCP server configuration through its settings. You can configure it either through the UI or by directly editing the configuration file.
Option A: Using Cursor Settings UI
- Open Cursor IDE
- Go to Settings (Cmd+, on macOS or Ctrl+, on Windows/Linux)
- Search for "MCP" in the settings search bar
- Click Edit in settings.json to open the MCP configuration file
Option B: Direct File Edit
The MCP configuration file location depends on your operating system:
- macOS:
~/Library/Application Support/Cursor/User/mcp.json - Windows:
%APPDATA%\Cursor\User\mcp.json - Linux:
~/.config/Cursor/User/mcp.json
Add your Casdoor MCP server configuration:
{
"mcpServers": {
"casdoor": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-oauth",
"https://your-casdoor.com/api/mcp"
],
"env": {
"OAUTH_CLIENT_ID": "your-client-id",
"OAUTH_SCOPES": "read:application write:application openid profile email"
}
}
}
}
Replace the following placeholders:
your-casdoor.com→ Your Casdoor instance domainyour-client-id→ The Client ID from Step 1
The @modelcontextprotocol/server-oauth package handles OAuth flows automatically. Cursor will open your browser to complete authentication.
Configuring Scopes
The OAUTH_SCOPES environment variable controls what permissions Cursor's AI 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: Reload Cursor
After saving the configuration:
- Reload Cursor IDE (Cmd+Shift+P or Ctrl+Shift+P → "Developer: Reload Window")
- Alternatively, restart Cursor completely
Cursor will automatically detect and load the new MCP server configuration.
Step 4: Complete the OAuth Flow
When Cursor first connects to your Casdoor MCP server:
- Cursor will automatically open your default web browser
- You'll see the Casdoor login page (if not already logged in)
- After logging in, you'll see a Consent Screen asking you to authorize Cursor
- The consent screen displays the requested scopes (permissions)
- Click Authorize to grant access
- Your browser will redirect to
http://127.0.0.1:<port>/callbackand show a success message - Return to Cursor - the connection is now established
The OAuth token is securely stored by the MCP OAuth helper. You won't need to re-authorize unless you revoke the token or change scopes.
Step 5: Verify the Connection
Test the connection by using Cursor's AI features to interact with Casdoor:
Example prompts to try in Cursor's chat:
- "Using the Casdoor MCP server, list all applications"
- "Show me details about the application named 'my-app' from Casdoor"
- "Create a new Casdoor application called 'test-app' in organization 'my-org'"
Cursor's AI will use the MCP tools to execute these commands. You should see responses with data from your Casdoor instance.
Expected output:
I've queried the Casdoor MCP server and found the following applications:
1. cursor-mcp (Cursor IDE MCP Client)
2. app-built-in (Casdoor)
...