Getting this error: Could not connect to your MCP server. Authentication failed.
Streamable HTTP error: Error POSTing to endpoint: {“errors”:[{“message”:“Invalid token”}]}
I have checked everything and it does not work!
Getting this error: Could not connect to your MCP server. Authentication failed.
Streamable HTTP error: Error POSTing to endpoint: {“errors”:[{“message”:“Invalid token”}]}
I have checked everything and it does not work!
Hi @rajnishsongara Welcome!
Salesforce Hosted MCP only accepts a JWT-based access token issued by an External Client App with the mcp_api scope, so a Bearer token from a Connected App, from sf org display, or from an app still carrying the old beta sfap_api scope gets rejected at the gateway with “Invalid token”. Connected Apps are not supported for MCP at all.
In Setup > External Client App Manager, set the OAuth scopes to “Access MCP servers” (mcp_api) and “Perform requests at any time” (refresh_token), then under Security select “Issue JSON Web Token (JWT)-based access tokens for named users” and “Require Proof Key for Code Exchange (PKCE) extension”. A new app can take up to 30 minutes to become active.
Then in the MCP Client Tool node use the MCP OAuth2 credential instead of Bearer, with Grant Type PKCE and:
Authorization URL: https://login.salesforce.com/services/oauth2/authorize
Access Token URL: https://login.salesforce.com/services/oauth2/token
Client ID: <your ECA consumer key>
Client Secret: leave blank
Scope: mcp_api refresh_token
Authentication: Body
Swap both URLs to test.salesforce.com for a sandbox org.
https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/create-external-client-app.html