supersendtx-mcp 0.6.0 → 0.6.3

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.
Files changed (2) hide show
  1. package/dist/index.js +31 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -97,6 +97,7 @@ var ARC_MCP_TALK_GROWTH_TOOL_NAMES = [
97
97
  "get_tracking_snippet",
98
98
  "verify_tracking_install",
99
99
  "list_automations",
100
+ "get_automation",
100
101
  "get_setup_run",
101
102
  "propose_lifecycle_events",
102
103
  "list_plan",
@@ -907,12 +908,21 @@ async function runStdioServer() {
907
908
 
908
909
  // src/oauth-metadata.ts
909
910
  var MCP_HTTP_PATH = "/mcp";
911
+ function appOriginForMcpOrigin(mcpOrigin) {
912
+ try {
913
+ const host = new URL(mcpOrigin).hostname.toLowerCase();
914
+ if (host === "mcp.ranla.ai") return "https://app.ranla.ai";
915
+ if (host === "mcp.supersendtx.com") return "https://app.supersendtx.com";
916
+ } catch {
917
+ }
918
+ return (process.env.SUPERSENDTX_OAUTH_ISSUER?.trim() || process.env.SUPERSENDTX_APP_URL?.trim() || "https://app.supersendtx.com").replace(/\/$/, "");
919
+ }
910
920
  function buildProtectedResourceMetadata(origin) {
911
921
  const resource = `${origin.replace(/\/$/, "")}${MCP_HTTP_PATH}`;
912
- const appOrigin = process.env.SUPERSENDTX_OAUTH_ISSUER?.trim() || process.env.SUPERSENDTX_APP_URL?.trim() || "https://app.supersendtx.com";
922
+ const appOrigin = appOriginForMcpOrigin(origin);
913
923
  return {
914
924
  resource,
915
- authorization_servers: [appOrigin.replace(/\/$/, "")],
925
+ authorization_servers: [appOrigin],
916
926
  scopes_supported: ["full"],
917
927
  bearer_methods_supported: ["header"]
918
928
  };
@@ -923,14 +933,24 @@ function buildWwwAuthenticateChallenge(origin) {
923
933
  }
924
934
 
925
935
  // src/oauth-resolve.ts
926
- function getOAuthResolveUrl() {
927
- const appBase = (process.env.SUPERSENDTX_APP_URL?.trim() || process.env.SUPERSENDTX_OAUTH_ISSUER?.trim() || "https://app.supersendtx.com").replace(/\/$/, "");
928
- return `${appBase}/api/mcp/oauth/resolve`;
936
+ function appOriginForMcpOrigin2(mcpOrigin) {
937
+ if (mcpOrigin) {
938
+ try {
939
+ const host = new URL(mcpOrigin).hostname.toLowerCase();
940
+ if (host === "mcp.ranla.ai") return "https://app.ranla.ai";
941
+ if (host === "mcp.supersendtx.com") return "https://app.supersendtx.com";
942
+ } catch {
943
+ }
944
+ }
945
+ return (process.env.SUPERSENDTX_APP_URL?.trim() || process.env.SUPERSENDTX_OAUTH_ISSUER?.trim() || "https://app.supersendtx.com").replace(/\/$/, "");
946
+ }
947
+ function getOAuthResolveUrl(mcpOrigin) {
948
+ return `${appOriginForMcpOrigin2(mcpOrigin)}/api/mcp/oauth/resolve`;
929
949
  }
930
- async function resolveOAuthAccessToken(accessToken) {
950
+ async function resolveOAuthAccessToken(accessToken, mcpOrigin) {
931
951
  const resolveSecret = process.env.SUPERSENDTX_MCP_RESOLVE_SECRET?.trim() || process.env.SUPERSENDTX_CREDENTIALS_ENCRYPTION_KEY?.trim() || (process.env.NODE_ENV === "production" ? "" : "supersendtx-dev-mcp-resolve");
932
952
  if (!resolveSecret) return null;
933
- const response = await fetch(getOAuthResolveUrl(), {
953
+ const response = await fetch(getOAuthResolveUrl(mcpOrigin), {
934
954
  method: "POST",
935
955
  headers: {
936
956
  authorization: `Bearer ${accessToken}`,
@@ -965,11 +985,11 @@ function getRequestOrigin(req) {
965
985
  const proto = firstHeaderValue(req.headers["x-forwarded-proto"]) || "http";
966
986
  return `${proto}://${host}`;
967
987
  }
968
- async function resolveApiKeyFromAuthorization(authorization, baseUrl) {
988
+ async function resolveApiKeyFromAuthorization(authorization, baseUrl, mcpOrigin) {
969
989
  const bearer = parseBearerToken(authorization);
970
990
  if (!bearer) return null;
971
991
  if (isSuperSendTxApiKey(bearer)) return bearer;
972
- return resolveOAuthAccessToken(bearer);
992
+ return resolveOAuthAccessToken(bearer, mcpOrigin);
973
993
  }
974
994
  async function handleHttpRequest(req, res, options = {}) {
975
995
  const origin = getRequestOrigin(req);
@@ -999,7 +1019,8 @@ async function handleHttpRequest(req, res, options = {}) {
999
1019
  }
1000
1020
  const apiKey = await resolveApiKeyFromAuthorization(
1001
1021
  typeof req.headers.authorization === "string" ? req.headers.authorization : void 0,
1002
- options.baseUrl
1022
+ options.baseUrl,
1023
+ origin
1003
1024
  );
1004
1025
  if (!apiKey) {
1005
1026
  sendJson(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supersendtx-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.6.3",
4
4
  "description": "SuperSend TX MCP server — mail tools plus Arc agent-first tools for Cursor and Claude",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.30.0",
43
- "supersendtx": "0.15.3"
43
+ "supersendtx": "0.15.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "tsup": "^8.5.0",