ss-mcp-proxy 1.0.2 → 1.0.4
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/README.md +23 -0
- package/index.mjs +15 -3
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ss-mcp-proxy
|
|
2
|
+
|
|
3
|
+
A thin proxy wrapper around [`shadcn-studio-mcp`](https://www.npmjs.com/package/shadcn-studio-mcp).
|
|
4
|
+
It patches global `fetch` so the MCP server's requests to `shadcnstudio.com`
|
|
5
|
+
are transparently redirected to a registry mirror, then starts the MCP server
|
|
6
|
+
unchanged over stdio.
|
|
7
|
+
|
|
8
|
+
## Configure the mirror
|
|
9
|
+
|
|
10
|
+
The mirror **domain** is configurable via `SS_MIRROR_HOST` (default:
|
|
11
|
+
`proxy.collectui.pro`). Only the host changes; the path `/api/mcp-proxy` is
|
|
12
|
+
preserved.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# default mirror
|
|
16
|
+
node index.mjs
|
|
17
|
+
|
|
18
|
+
# custom mirror
|
|
19
|
+
SS_MIRROR_HOST=my-mirror.example.com node index.mjs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See [`CLAUDE.md`](./CLAUDE.md) for full project status, rewrite rules, and
|
|
23
|
+
secrets handling.
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Mirror host configuration
|
|
5
|
+
//
|
|
6
|
+
// The mirror DOMAIN is extracted as a configurable variable so it can be
|
|
7
|
+
// overridden without touching code. Set `SS_MIRROR_HOST` to point the proxy at
|
|
8
|
+
// a different mirror; only the host changes — the path `/api/mcp-proxy` and
|
|
9
|
+
// the rewrite logic below are preserved from the original.
|
|
10
|
+
//
|
|
11
|
+
// Original mirror host: shadcn-registry-mirror.vercel.app
|
|
12
|
+
// Current mirror host: proxy.collectui.pro (default below)
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const MIRROR_HOST = process.env.SS_MIRROR_HOST || "proxy.collectui.pro";
|
|
15
|
+
const PROXY_BASE = `https://${MIRROR_HOST}/api/mcp-proxy`;
|
|
4
16
|
|
|
5
17
|
const ORIGINAL_HOST = "shadcnstudio.com";
|
|
6
18
|
const _fetch = globalThis.fetch;
|
|
@@ -8,12 +20,12 @@ const _fetch = globalThis.fetch;
|
|
|
8
20
|
globalThis.fetch = async function (input, init) {
|
|
9
21
|
const url = typeof input === "string" ? new URL(input) : new URL(input.url);
|
|
10
22
|
|
|
23
|
+
// Only intercept requests meant for the original upstream host.
|
|
11
24
|
if (url.hostname !== ORIGINAL_HOST) {
|
|
12
25
|
return _fetch(input, init);
|
|
13
26
|
}
|
|
14
27
|
|
|
15
|
-
// Strip leading /api
|
|
16
|
-
// e.g. /api/mcp/instructions → /mcp/instructions → PROXY_BASE + /mcp/instructions
|
|
28
|
+
// Strip the leading "/api" segment, then forward the remainder to the mirror.
|
|
17
29
|
const path = url.pathname.startsWith("/api/")
|
|
18
30
|
? url.pathname.slice(4)
|
|
19
31
|
: url.pathname;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ss-mcp-proxy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "shadcn-studio MCP proxy wrapper",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
8
|
"ss-mcp-proxy": "index.mjs"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.mjs"
|
|
12
|
+
],
|
|
10
13
|
"dependencies": {
|
|
11
14
|
"shadcn-studio-mcp": "*"
|
|
12
15
|
}
|