ss-mcp-proxy 1.0.0 → 1.0.1
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/index.mjs +1 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const PROXY_BASE = "https://ss-mcp-proxy.example.com";
|
|
5
|
-
// =========================================
|
|
3
|
+
const PROXY_BASE = "http://shadcn-registry-mirror.vercel.app/api/mcp-proxy";
|
|
6
4
|
|
|
7
5
|
const ORIGINAL_HOST = "shadcnstudio.com";
|
|
8
6
|
const _fetch = globalThis.fetch;
|
|
@@ -10,12 +8,10 @@ const _fetch = globalThis.fetch;
|
|
|
10
8
|
globalThis.fetch = async function (input, init) {
|
|
11
9
|
const url = typeof input === "string" ? new URL(input) : new URL(input.url);
|
|
12
10
|
|
|
13
|
-
// 只拦截 shadcnstudio.com,其余请求原样放行
|
|
14
11
|
if (url.hostname !== ORIGINAL_HOST) {
|
|
15
12
|
return _fetch(input, init);
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
// 替换为目标代理地址
|
|
19
15
|
const proxy = new URL(PROXY_BASE);
|
|
20
16
|
url.hostname = proxy.hostname;
|
|
21
17
|
url.protocol = proxy.protocol;
|
|
@@ -24,5 +20,4 @@ globalThis.fetch = async function (input, init) {
|
|
|
24
20
|
return _fetch(url.toString(), init);
|
|
25
21
|
};
|
|
26
22
|
|
|
27
|
-
// 启动原包(fetch 已被劫持,所有请求自动走代理)
|
|
28
23
|
await import("shadcn-studio-mcp/build/index.js");
|