I followed Model Context Protocol (MCP) | Cursor Docs to configure an MCP server using Client Credentials OAuth. Does Cursor support token generation using CLIENT_ID and CLIENT_SECRET in auth section of config and token_endpoint present in OAuth discovery response?
Where does the bug appear (feature/product)? - Cursor IDE
Summary
Cursor’s MCP client always uses the authorization code (redirect) flow when connecting to a URL-based MCP server, even when the MCP configuration includes CLIENT_SECRET. It does not use the client credentials grant to obtain an access token directly from the token_endpoint(present in OAuth discovery) using CLIENT_ID and CLIENT_SECRET.
Steps to reproduce
-
Configure a URL-based MCP server in
.cursor/mcp.jsonwith:url: base URL of the MCP server (e.g.https://localhost:8000/mcp/appor a remote URL).authcontaining:CLIENT_IDCLIENT_SECRETscopes(e.g.["read","write"])
Example (with placeholders):
{ "mcpServers": { "my-mcp": { "url": "https://localhost:8000/mcp/app", "auth": { "CLIENT_ID": "your_client_id", "CLIENT_SECRET": "your_client_secret", "scopes": ["read", "write"] } } } } -
Ensure the MCP server (or its auth backend) serves
/.well-known/oauth-authorization-serverwith:
{
"issuer":"``https://localhost:8000``",
"authorization_endpoint":"``https://example.com/auth/api/authorize``", "token_endpoint":"``https://example.com/auth/api/token``", "response_types_supported":["code","token","id_token"], "token_endpoint_auth_methods_supported":["client_secret_basic"], "grant_types_supported":["client_credentials"]
} -
In Cursor, add or reload the MCP server so it connects to the configured URL.
-
Observe Cursor output/logs.
Result: Cursor prepares a redirect to the authorization endpoint and does not call the token endpoint with client credentials.
Expectation
When auth in mcp.json contains both CLIENT_ID and CLIENT_SECRET, and a token_endpoint is available (from the /.well-known/oauth-authorization-server discovery response), Cursor should:
- Use the client credentials grant (RFC 6749 §4.4).
- Request an access token by calling the
token_endpointwithgrant_type=client_credentials, authenticating withCLIENT_IDandCLIENT_SECRET(e.g. HTTP Basic or body parameters). - Use the returned access token for MCP requests to the server.
- Not redirect the user to an authorization URL when a server-to-server credential is already configured.
Actual behavior
- Cursor fetches
/.well-known/oauth-authorization-serverfrom the MCP server URL. - Cursor uses the authorization_endpoint from that discovery response to build an authorization (redirect) request, and logs that it is redirecting the user to the authorization URL.
- The
token_endpointfrom the discovery response is not used to obtain a token withCLIENT_IDandCLIENT_SECRET. - Even with
CLIENT_SECRETpresent inauth, Cursor still initiates the redirect-based flow (e.g. log message: “Redirect to authorization requested {“url”:"https://…….”).
Operating System - MacOS
Version Info:
Version: 2.5.17
VSCode Version: 1.105.1
Commit: 7b98dcb824ea96c9c62362a5e80dbf0d1aae4770
Date: 2026-02-17T05:58:33.110Z
Build Type: Stable
Release Track: Default
Electron: 39.3.0
Chromium: 142.0.7444.265
Node.js: 22.21.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.3.0
Does this stop you from using Cursor? - Sometimes - I can sometimes use Cursor