ss-mcp-proxy 1.0.0 → 1.0.2

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 +8 -11
  2. 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,19 +8,18 @@ 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
- const proxy = new URL(PROXY_BASE);
20
- url.hostname = proxy.hostname;
21
- url.protocol = proxy.protocol;
22
- url.port = proxy.port;
15
+ // Strip leading /api from path so PROXY_BASE + path is correct
16
+ // e.g. /api/mcp/instructions → /mcp/instructions → PROXY_BASE + /mcp/instructions
17
+ const path = url.pathname.startsWith("/api/")
18
+ ? url.pathname.slice(4)
19
+ : url.pathname;
23
20
 
24
- return _fetch(url.toString(), init);
21
+ const proxyUrl = PROXY_BASE + path + url.search;
22
+ return _fetch(proxyUrl, init);
25
23
  };
26
24
 
27
- // 启动原包(fetch 已被劫持,所有请求自动走代理)
28
25
  await import("shadcn-studio-mcp/build/index.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ss-mcp-proxy",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "shadcn-studio MCP proxy wrapper",
6
6
  "license": "MIT",