Skip to content

Conversation

andrea9293
Copy link
Contributor

Introduce Salesforce CLI authentication as a new method for connecting to Salesforce, enhancing flexibility for users. Update the README to acknowledge contributions

@andrea9293 andrea9293 requested a review from tsmztech as a code owner September 9, 2025 07:55
@tsmztech
Copy link
Owner

tsmztech commented Sep 9, 2025

Hi @andrea9293 👋
Thanks for working on the Salesforce CLI authentication support - this is a great feature addition that many users will find valuable!
I've been testing your PR locally and encountered an issue I'd like to get your input on:

Environment:
Build: ✅ Successful (npm install && npm run build complete without errors)
Configuration: Using the new Salesforce CLI authentication method

Issue:
When executing MCP tools/requests, they appear to hang indefinitely:

Tool execution starts but never completes
No data is returned from any requests
No timeout occurs - requests just continue running
This happens consistently across multiple different tool calls

Questions:
Were you able to test this locally with actual Salesforce CLI authentication? If so, what was your testing setup?
Which Salesforce CLI commands/authentication flows did you test with? (e.g., sf org login web, sf org login jwt, etc.)
Do you have any debugging steps you'd recommend? Are there any logs or environment variables I should check?
Are there any specific Salesforce CLI configuration requirements? (versions, org setup, etc.)

I'd love to help troubleshoot this and get it working properly, as CLI auth would be a fantastic addition to the project!
My current setup for reference:

"salesforce": { 
  "command": "node", 
  "args": ["local_path/mcp-server-salesforce/dist/index.js"], 
  "env": { 
     "SALESFORCE_CONNECTION_TYPE": "Salesforce_CLI"
  } 
}

Thanks for your time and contribution! 🚀

@andrea9293
Copy link
Contributor Author

i've just tested on vs code on windows

image

This is my setup and the request must be done in the workspace with the Salesforce project

{
    "servers": {
        "saleforce-mcp-server": {
			"type": "stdio",
			"command": "node",
			"args": [
				"C:\\path-to\\mcp-server-salesforce\\dist\\index.js"
			],
			"env": {
                "SALESFORCE_CONNECTION_TYPE": "Salesforce_CLI"
            }
		}
    }
}

here are the logs (obfuscated of sensitive information)

2025-09-10 10:05:57.520 [warning] Failed to parse message: "Connecting to Salesforce using Salesforce CLI authentication\n"
2025-09-10 10:05:57.520 [warning] Failed to parse message: "Executing Salesforce CLI command: sf org display --json in directory: path/with/your/salesforce/project"
2025-09-10 10:06:07.220 [warning] [server stderr] [Salesforce CLI] STDOUT: {
2025-09-10 10:06:07.220 [warning] [server stderr]   "status": 0,
2025-09-10 10:06:07.221 [warning] [server stderr]   "result": {
2025-09-10 10:06:07.221 [warning] [server stderr]     "id": "AAA",
2025-09-10 10:06:07.221 [warning] [server stderr]     "devHubId": "AAA",
2025-09-10 10:06:07.221 [warning] [server stderr]     "apiVersion": "65.0",
2025-09-10 10:06:07.222 [warning] [server stderr]     "accessToken": "AAA",
2025-09-10 10:06:07.222 [warning] [server stderr]     "instanceUrl": "https://AAA.scratch.my.salesforce.com",
2025-09-10 10:06:07.222 [warning] [server stderr]     "username": "[email protected]",
2025-09-10 10:06:07.223 [warning] [server stderr]     "clientId": "PlatformCLI",
2025-09-10 10:06:07.223 [warning] [server stderr]     "password": "AAA",
2025-09-10 10:06:07.223 [warning] [server stderr]     "status": "Active",
2025-09-10 10:06:07.224 [warning] [server stderr]     "expirationDate": "2025-09-26",
2025-09-10 10:06:07.224 [warning] [server stderr]     "createdBy": "[email protected]",
2025-09-10 10:06:07.224 [warning] [server stderr]     "edition": "Developer",
2025-09-10 10:06:07.224 [warning] [server stderr]     "namespace": "AAA",
2025-09-10 10:06:07.225 [warning] [server stderr]     "orgName": "AAA",
2025-09-10 10:06:07.225 [warning] [server stderr]     "createdDate": "2025-08-27T08:49:35.000+0000",
2025-09-10 10:06:07.225 [warning] [server stderr]     "signupUsername": "[email protected]",
2025-09-10 10:06:07.225 [warning] [server stderr]     "alias": "AAAScratchAI"
2025-09-10 10:06:07.226 [warning] [server stderr]   },
2025-09-10 10:06:07.226 [warning] [server stderr]   "warnings": [
2025-09-10 10:06:07.226 [warning] [server stderr]     "This command will expose sensitive information that allows for subsequent activity using your current authenticated session.\nSharing this information is equivalent to logging someone in under the current credential, resulting in unintended access and escalation of privilege.\nFor additional information, please review the authorization section of the https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm."
2025-09-10 10:06:07.227 [warning] [server stderr]   ]
2025-09-10 10:06:07.227 [warning] [server stderr] }
2025-09-10 10:06:07.227 [warning] [server stderr] 
2025-09-10 10:06:07.228 [warning] Failed to parse message: "Connected to Salesforce org: [email protected] (AAAScratchAI)\n"

@tsmztech tsmztech merged commit a23b908 into tsmztech:main Sep 12, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants