@shuffleio/shuffle-mcps 0.0.16 → 0.0.18
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/{appsCache-LOBSECTW.mjs → appsCache-CFCVTF7D.mjs} +1 -1
- package/dist/chunk-R3YLER6P.mjs +325 -0
- package/dist/index.d.mts +98 -152
- package/dist/index.d.ts +98 -152
- package/dist/index.js +582 -238
- package/dist/index.mjs +268 -103
- package/package.json +1 -1
- package/dist/chunk-FHIKSRCS.mjs +0 -149
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuffleio/shuffle-mcps",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Turn 3,000+ SaaS tools into MCP servers your agents can use. Headless React component for search, selection, and OAuth handoff.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/dist/chunk-FHIKSRCS.mjs
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// api.ts
|
|
2
|
-
var DEV_BACKEND = "https://tunnel.schemaless.org";
|
|
3
|
-
var PROD_BACKEND = "https://shuffler.io";
|
|
4
|
-
var CLOUD_DOMAINS = ["security.shuffler.io", "shutdown.no"];
|
|
5
|
-
var getEnvVar = (key) => {
|
|
6
|
-
try {
|
|
7
|
-
const meta = new Function("try { return import.meta } catch { return undefined }")();
|
|
8
|
-
return meta?.env?.[key];
|
|
9
|
-
} catch {
|
|
10
|
-
return void 0;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
var isDevEnvironment = () => {
|
|
14
|
-
if (getEnvVar("VITE_SHUFFLE_API_URL")) return false;
|
|
15
|
-
const hostname = typeof window !== "undefined" ? window.location.hostname : "";
|
|
16
|
-
return hostname.includes("lovableproject.com") || hostname.includes("id-preview--");
|
|
17
|
-
};
|
|
18
|
-
var isCloudDomain = () => {
|
|
19
|
-
const hostname = typeof window !== "undefined" ? window.location.hostname : "";
|
|
20
|
-
return CLOUD_DOMAINS.includes(hostname);
|
|
21
|
-
};
|
|
22
|
-
var isCloud = () => isCloudDomain();
|
|
23
|
-
var isOnprem = () => !isDevEnvironment() && !isCloudDomain();
|
|
24
|
-
var getDefaultBaseUrl = () => {
|
|
25
|
-
const envUrl = getEnvVar("VITE_SHUFFLE_API_URL");
|
|
26
|
-
if (envUrl) {
|
|
27
|
-
return envUrl;
|
|
28
|
-
}
|
|
29
|
-
if (isDevEnvironment()) return DEV_BACKEND;
|
|
30
|
-
if (isCloudDomain()) return PROD_BACKEND;
|
|
31
|
-
if (typeof window !== "undefined") {
|
|
32
|
-
return window.location.origin;
|
|
33
|
-
}
|
|
34
|
-
return PROD_BACKEND;
|
|
35
|
-
};
|
|
36
|
-
var _regionUrl = null;
|
|
37
|
-
var _trackedOrgId = null;
|
|
38
|
-
var getTrackedOrgId = () => _trackedOrgId;
|
|
39
|
-
var API_CONFIG = {
|
|
40
|
-
// Shuffle backend URL - uses region URL if set, otherwise default
|
|
41
|
-
get baseUrl() {
|
|
42
|
-
return _regionUrl || getDefaultBaseUrl();
|
|
43
|
-
},
|
|
44
|
-
// API version
|
|
45
|
-
version: "v1",
|
|
46
|
-
// Get API key from localStorage (for local development)
|
|
47
|
-
get apiKey() {
|
|
48
|
-
return localStorage.getItem("shuffle_api_key");
|
|
49
|
-
},
|
|
50
|
-
// Set API key in localStorage
|
|
51
|
-
setApiKey(key) {
|
|
52
|
-
if (key) {
|
|
53
|
-
localStorage.setItem("shuffle_api_key", key);
|
|
54
|
-
} else {
|
|
55
|
-
localStorage.removeItem("shuffle_api_key");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var getApiUrl = (endpoint) => {
|
|
60
|
-
return `${API_CONFIG.baseUrl}${endpoint}`;
|
|
61
|
-
};
|
|
62
|
-
var shuffleFetch = (url, init) => {
|
|
63
|
-
const { headers: extraHeaders, ...rest } = init || {};
|
|
64
|
-
return fetch(url, {
|
|
65
|
-
credentials: "include",
|
|
66
|
-
...rest,
|
|
67
|
-
headers: {
|
|
68
|
-
...getAuthHeader(),
|
|
69
|
-
...extraHeaders
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
var getAuthHeader = (overrideOrgId) => {
|
|
74
|
-
const headers = {};
|
|
75
|
-
const apiKey = API_CONFIG.apiKey;
|
|
76
|
-
if (apiKey) {
|
|
77
|
-
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
78
|
-
}
|
|
79
|
-
const orgId = overrideOrgId ?? _trackedOrgId;
|
|
80
|
-
if (orgId) {
|
|
81
|
-
headers["Org-Id"] = orgId;
|
|
82
|
-
}
|
|
83
|
-
return headers;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// appsCache.ts
|
|
87
|
-
var TTL_MS = 3e4;
|
|
88
|
-
var cache = /* @__PURE__ */ new Map();
|
|
89
|
-
var cacheKey = (o) => `${o.baseUrl}|${o.path || "/api/v1/apps"}|${o.apiKey || ""}|${o.orgId || ""}`;
|
|
90
|
-
var doFetch = async (o) => {
|
|
91
|
-
const headers = {};
|
|
92
|
-
if (o.apiKey) headers["Authorization"] = `Bearer ${o.apiKey}`;
|
|
93
|
-
if (o.orgId) headers["Org-Id"] = o.orgId;
|
|
94
|
-
const response = await fetch(`${o.baseUrl}${o.path || "/api/v1/apps"}`, {
|
|
95
|
-
credentials: "include",
|
|
96
|
-
headers
|
|
97
|
-
});
|
|
98
|
-
if (!response.ok) return [];
|
|
99
|
-
const data = await response.json();
|
|
100
|
-
if (Array.isArray(data)) return data;
|
|
101
|
-
return Array.isArray(data?.data) ? data.data : [];
|
|
102
|
-
};
|
|
103
|
-
var fetchApps = (opts) => {
|
|
104
|
-
const key = cacheKey(opts);
|
|
105
|
-
const entry = cache.get(key) || {};
|
|
106
|
-
if (entry.data && entry.fetchedAt && Date.now() - entry.fetchedAt < TTL_MS) {
|
|
107
|
-
return Promise.resolve(entry.data);
|
|
108
|
-
}
|
|
109
|
-
if (entry.promise) return entry.promise;
|
|
110
|
-
const promise = doFetch(opts).then((data) => {
|
|
111
|
-
cache.set(key, { data, fetchedAt: Date.now() });
|
|
112
|
-
return data;
|
|
113
|
-
}).catch((err) => {
|
|
114
|
-
cache.delete(key);
|
|
115
|
-
throw err;
|
|
116
|
-
});
|
|
117
|
-
cache.set(key, { ...entry, promise });
|
|
118
|
-
return promise;
|
|
119
|
-
};
|
|
120
|
-
var invalidateAppsCache = (opts) => {
|
|
121
|
-
if (!opts) {
|
|
122
|
-
cache.clear();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
cache.delete(cacheKey(opts));
|
|
126
|
-
};
|
|
127
|
-
var fetchAppsViaApiConfig = () => {
|
|
128
|
-
const headers = getAuthHeader();
|
|
129
|
-
const orgId = headers["Org-Id"] || null;
|
|
130
|
-
return fetchApps({
|
|
131
|
-
baseUrl: API_CONFIG.baseUrl,
|
|
132
|
-
apiKey: API_CONFIG.apiKey,
|
|
133
|
-
orgId
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export {
|
|
138
|
-
isCloudDomain,
|
|
139
|
-
isCloud,
|
|
140
|
-
isOnprem,
|
|
141
|
-
getTrackedOrgId,
|
|
142
|
-
API_CONFIG,
|
|
143
|
-
getApiUrl,
|
|
144
|
-
shuffleFetch,
|
|
145
|
-
getAuthHeader,
|
|
146
|
-
fetchApps,
|
|
147
|
-
invalidateAppsCache,
|
|
148
|
-
fetchAppsViaApiConfig
|
|
149
|
-
};
|