ss-mcp-proxy 1.0.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.
Files changed (2) hide show
  1. package/index.mjs +28 -0
  2. package/package.json +13 -0
package/index.mjs ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ====== 修改此处为你自己的代理地址 ======
4
+ const PROXY_BASE = "https://ss-mcp-proxy.example.com";
5
+ // =========================================
6
+
7
+ const ORIGINAL_HOST = "shadcnstudio.com";
8
+ const _fetch = globalThis.fetch;
9
+
10
+ globalThis.fetch = async function (input, init) {
11
+ const url = typeof input === "string" ? new URL(input) : new URL(input.url);
12
+
13
+ // 只拦截 shadcnstudio.com,其余请求原样放行
14
+ if (url.hostname !== ORIGINAL_HOST) {
15
+ return _fetch(input, init);
16
+ }
17
+
18
+ // 替换为目标代理地址
19
+ const proxy = new URL(PROXY_BASE);
20
+ url.hostname = proxy.hostname;
21
+ url.protocol = proxy.protocol;
22
+ url.port = proxy.port;
23
+
24
+ return _fetch(url.toString(), init);
25
+ };
26
+
27
+ // 启动原包(fetch 已被劫持,所有请求自动走代理)
28
+ await import("shadcn-studio-mcp/build/index.js");
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "ss-mcp-proxy",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "shadcn-studio MCP proxy wrapper",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "ss-mcp-proxy": "index.mjs"
9
+ },
10
+ "dependencies": {
11
+ "shadcn-studio-mcp": "*"
12
+ }
13
+ }