mcpstore-gateway 1.1.0 → 1.2.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.
- package/dist/index.d.ts +5 -1
- package/dist/index.js +67 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* MCP Store Gateway
|
|
3
|
+
* MCP Store Gateway v1.2.0
|
|
4
4
|
*
|
|
5
5
|
* A single MCP server that gives Claude Code access to ALL your installed MCPs
|
|
6
6
|
* from mcpclaudecode.com. Install MCPs on the website, they appear here instantly.
|
|
7
7
|
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Hosted MCPs: tools proxied through our backend (e.g. AI Brain)
|
|
10
|
+
* - External MCPs: auto-configured in ~/.mcp.json (e.g. GitHub, Playwright)
|
|
11
|
+
*
|
|
8
12
|
* Setup (one command, that's it):
|
|
9
13
|
* npx mcpstore-gateway --setup YOUR_API_KEY
|
|
10
14
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* MCP Store Gateway
|
|
3
|
+
* MCP Store Gateway v1.2.0
|
|
4
4
|
*
|
|
5
5
|
* A single MCP server that gives Claude Code access to ALL your installed MCPs
|
|
6
6
|
* from mcpclaudecode.com. Install MCPs on the website, they appear here instantly.
|
|
7
7
|
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Hosted MCPs: tools proxied through our backend (e.g. AI Brain)
|
|
10
|
+
* - External MCPs: auto-configured in ~/.mcp.json (e.g. GitHub, Playwright)
|
|
11
|
+
*
|
|
8
12
|
* Setup (one command, that's it):
|
|
9
13
|
* npx mcpstore-gateway --setup YOUR_API_KEY
|
|
10
14
|
*
|
|
@@ -18,6 +22,63 @@ import * as path from "node:path";
|
|
|
18
22
|
import * as os from "node:os";
|
|
19
23
|
const GATEWAY_URL = process.env.MCPSTORE_GATEWAY_URL ||
|
|
20
24
|
"https://rshsqjofouqyhzvzezos.supabase.co/functions/v1";
|
|
25
|
+
// Prefix for auto-managed MCP entries in .mcp.json
|
|
26
|
+
const MANAGED_PREFIX = "mcpstore-";
|
|
27
|
+
async function syncExternalMcps(apiKey) {
|
|
28
|
+
try {
|
|
29
|
+
// 1. Fetch installed external MCPs from the API
|
|
30
|
+
const res = await fetch(`${GATEWAY_URL}/gateway-sync`, {
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Bearer ${apiKey}`,
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (!res.ok)
|
|
37
|
+
return; // Silently fail — sync is best-effort
|
|
38
|
+
const data = (await res.json());
|
|
39
|
+
const installedSlugs = new Set(data.external_mcps.map((m) => m.slug));
|
|
40
|
+
// 2. Read current ~/.mcp.json
|
|
41
|
+
const mcpJsonPath = path.join(os.homedir(), ".mcp.json");
|
|
42
|
+
let config = {};
|
|
43
|
+
if (fs.existsSync(mcpJsonPath)) {
|
|
44
|
+
try {
|
|
45
|
+
config = JSON.parse(fs.readFileSync(mcpJsonPath, "utf-8"));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return; // Don't mess with a broken config
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!config.mcpServers) {
|
|
52
|
+
config.mcpServers = {};
|
|
53
|
+
}
|
|
54
|
+
let changed = false;
|
|
55
|
+
// 3. Add new external MCPs (prefixed with mcpstore-)
|
|
56
|
+
for (const mcp of data.external_mcps) {
|
|
57
|
+
const key = `${MANAGED_PREFIX}${mcp.slug}`;
|
|
58
|
+
if (!config.mcpServers[key]) {
|
|
59
|
+
config.mcpServers[key] = mcp.config;
|
|
60
|
+
changed = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// 4. Remove uninstalled MCPs (only those with our prefix)
|
|
64
|
+
for (const key of Object.keys(config.mcpServers)) {
|
|
65
|
+
if (key.startsWith(MANAGED_PREFIX)) {
|
|
66
|
+
const slug = key.slice(MANAGED_PREFIX.length);
|
|
67
|
+
if (!installedSlugs.has(slug)) {
|
|
68
|
+
delete config.mcpServers[key];
|
|
69
|
+
changed = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 5. Write back if changed
|
|
74
|
+
if (changed) {
|
|
75
|
+
fs.writeFileSync(mcpJsonPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Sync is best-effort, never block the server from starting
|
|
80
|
+
}
|
|
81
|
+
}
|
|
21
82
|
// ---------------------------------------------------------------------------
|
|
22
83
|
// Setup mode: auto-configure .mcp.json
|
|
23
84
|
// ---------------------------------------------------------------------------
|
|
@@ -111,25 +172,15 @@ async function callTool(apiKey, toolName, args) {
|
|
|
111
172
|
return data.result ?? data;
|
|
112
173
|
}
|
|
113
174
|
async function runServer(apiKey) {
|
|
175
|
+
// Sync external MCPs to ~/.mcp.json before starting
|
|
176
|
+
await syncExternalMcps(apiKey);
|
|
114
177
|
const server = new McpServer({
|
|
115
178
|
name: "MCP Store",
|
|
116
|
-
version: "1.
|
|
179
|
+
version: "1.2.0",
|
|
117
180
|
});
|
|
118
|
-
|
|
119
|
-
let toolsCacheTime = 0;
|
|
120
|
-
const CACHE_TTL_MS = 60_000;
|
|
121
|
-
async function getTools() {
|
|
122
|
-
const now = Date.now();
|
|
123
|
-
if (toolsCache && now - toolsCacheTime < CACHE_TTL_MS) {
|
|
124
|
-
return toolsCache;
|
|
125
|
-
}
|
|
126
|
-
toolsCache = await fetchTools(apiKey);
|
|
127
|
-
toolsCacheTime = now;
|
|
128
|
-
return toolsCache;
|
|
129
|
-
}
|
|
130
|
-
// Register tools
|
|
181
|
+
// Register hosted tools (proxied through our backend)
|
|
131
182
|
try {
|
|
132
|
-
const tools = await
|
|
183
|
+
const tools = await fetchTools(apiKey);
|
|
133
184
|
if (tools.length === 0) {
|
|
134
185
|
server.tool("mcpstore__info", "No MCPs installed yet. Visit https://www.mcpclaudecode.com/browse to install MCPs.", {}, async () => ({
|
|
135
186
|
content: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcpstore-gateway",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "MCP Store Gateway — One MCP server for all your installed MCPs from mcpclaudecode.com",
|
|
5
5
|
"keywords": ["mcp", "claude", "claude-code", "ai", "gateway", "marketplace"],
|
|
6
6
|
"license": "MIT",
|