@snokam/mcp-salesforce 1.104.2 → 1.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -4
- package/package.json +1 -1
- package/src/index.ts +8 -4
package/dist/index.js
CHANGED
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
//
|
|
5
|
+
// Auth: prefer a ready per-business OAuth access token (provisioned by the
|
|
6
|
+
// platform); fall back to the client-credentials flow with a connected app's
|
|
7
|
+
// consumer key/secret. Instance URL comes from the OAuth response (or env).
|
|
8
|
+
const SF_ACCESS_TOKEN = process.env.SALESFORCE_ACCESS_TOKEN;
|
|
6
9
|
const SF_CONSUMER_KEY = process.env.SALESFORCE_CONSUMER_KEY;
|
|
7
10
|
const SF_CONSUMER_SECRET = process.env.SALESFORCE_CONSUMER_SECRET;
|
|
8
|
-
const SF_INSTANCE_URL = "https://snokam.my.salesforce.com";
|
|
11
|
+
const SF_INSTANCE_URL = process.env.SALESFORCE_INSTANCE_URL || "https://snokam.my.salesforce.com";
|
|
9
12
|
const SF_API_VERSION = "v62.0";
|
|
10
|
-
let accessToken = null;
|
|
13
|
+
let accessToken = SF_ACCESS_TOKEN ?? null;
|
|
11
14
|
async function getAccessToken() {
|
|
12
15
|
if (accessToken) {
|
|
13
16
|
return accessToken;
|
|
14
17
|
}
|
|
15
18
|
if (!SF_CONSUMER_KEY || !SF_CONSUMER_SECRET) {
|
|
16
|
-
throw new Error("
|
|
19
|
+
throw new Error("Set SALESFORCE_ACCESS_TOKEN, or SALESFORCE_CONSUMER_KEY + SALESFORCE_CONSUMER_SECRET");
|
|
17
20
|
}
|
|
18
21
|
const params = new URLSearchParams({
|
|
19
22
|
client_id: SF_CONSUMER_KEY,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,13 +3,17 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// Auth: prefer a ready per-business OAuth access token (provisioned by the
|
|
7
|
+
// platform); fall back to the client-credentials flow with a connected app's
|
|
8
|
+
// consumer key/secret. Instance URL comes from the OAuth response (or env).
|
|
9
|
+
const SF_ACCESS_TOKEN = process.env.SALESFORCE_ACCESS_TOKEN;
|
|
7
10
|
const SF_CONSUMER_KEY = process.env.SALESFORCE_CONSUMER_KEY;
|
|
8
11
|
const SF_CONSUMER_SECRET = process.env.SALESFORCE_CONSUMER_SECRET;
|
|
9
|
-
const SF_INSTANCE_URL =
|
|
12
|
+
const SF_INSTANCE_URL =
|
|
13
|
+
process.env.SALESFORCE_INSTANCE_URL || "https://snokam.my.salesforce.com";
|
|
10
14
|
const SF_API_VERSION = "v62.0";
|
|
11
15
|
|
|
12
|
-
let accessToken: string | null = null;
|
|
16
|
+
let accessToken: string | null = SF_ACCESS_TOKEN ?? null;
|
|
13
17
|
|
|
14
18
|
async function getAccessToken(): Promise<string> {
|
|
15
19
|
if (accessToken) {
|
|
@@ -18,7 +22,7 @@ async function getAccessToken(): Promise<string> {
|
|
|
18
22
|
|
|
19
23
|
if (!SF_CONSUMER_KEY || !SF_CONSUMER_SECRET) {
|
|
20
24
|
throw new Error(
|
|
21
|
-
"
|
|
25
|
+
"Set SALESFORCE_ACCESS_TOKEN, or SALESFORCE_CONSUMER_KEY + SALESFORCE_CONSUMER_SECRET"
|
|
22
26
|
);
|
|
23
27
|
}
|
|
24
28
|
|