Skip to content

Commit b0aaf5c

Browse files
committed
update readme & scripts to add/remove mcps
1 parent f1135f1 commit b0aaf5c

File tree

4 files changed

+137
-63
lines changed

4 files changed

+137
-63
lines changed

README.md

Lines changed: 15 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,35 @@
11
# mini-mcp-registry
22

3-
A lightweight, self-hosted MCP registry that exposes a filtered subset of the [official MCP registry](https://registry.modelcontextprotocol.io). Deployable to GitHub Pages as a static site.
3+
A lightweight, self-hosted MCP registry proxy that exposes a curated subset of the [official MCP registry](https://registry.modelcontextprotocol.io). Deployed to Vercel.
44

5-
## Copilot MCP Registry URL
5+
## Registry URL
66

77
```
8-
https://vydia.github.io/mini-mcp-registry/allowed-servers
8+
https://mini-mcp-registry.vercel.app
99
```
1010

11-
This endpoint returns only the **official Figma MCP server** (`com.figma.mcp/mcp`) in standard MCP registry format.
11+
Set this as `chat.mcp.gallery.serviceUrl` in VS Code settings to use this registry as your MCP server gallery.
1212

13-
## Running locally
13+
## Managing servers
1414

15-
```bash
16-
npm install
17-
npm run dev
18-
```
19-
20-
The UI will be available at `http://localhost:5173`. It fetches live from the official registry and filters results by preset.
21-
22-
To preview the production build locally:
15+
**Add a server** using its name from the [official registry](https://registry.modelcontextprotocol.io):
2316

2417
```bash
25-
npm run build
26-
npm run preview
18+
npm run add-server -- com.figma.mcp/mcp
2719
```
2820

29-
## How the registry endpoint works
30-
31-
At build time, `scripts/build-registry.mjs` fetches the official Figma server entry from the MCP registry API and writes it to `public/allowed-servers`. Vite copies `public/` into `dist/` unchanged, so the file is served as a static JSON response at `/allowed-servers`.
32-
33-
To regenerate the file manually without a full build:
21+
**Remove a server:**
3422

3523
```bash
36-
node scripts/build-registry.mjs
37-
```
38-
39-
## Adding or changing allowed servers
40-
41-
Edit `scripts/build-registry.mjs`. The relevant section is:
42-
43-
```js
44-
// Fetch a specific server by name + version
45-
const url = 'https://registry.modelcontextprotocol.io/v0.1/servers/com.figma.mcp%2Fmcp/versions/latest';
24+
npm run remove-server -- com.figma.mcp/mcp
4625
```
4726

48-
To allow multiple servers, fetch each one and push them into the `servers` array before writing the file:
27+
Both scripts rebuild the static JSON files automatically. Commit and push to deploy via Vercel.
4928

50-
```js
51-
const figma = await fetchServer('com.figma.mcp%2Fmcp');
52-
const github = await fetchServer('com.github.mcp%2Fgithub');
29+
## Local development
5330

54-
const payload = {
55-
servers: [figma, github],
56-
metadata: { count: 2, nextCursor: null },
57-
};
58-
```
59-
60-
Server names come from the [official registry](https://registry.modelcontextprotocol.io/docs). Use `%2F` to encode the `/` in the server name for the URL.
61-
62-
## Adding UI filter presets
63-
64-
Edit `src/presets.js`:
65-
66-
```js
67-
{
68-
id: 'linear',
69-
label: 'Linear',
70-
search: 'linear',
71-
description: 'MCP servers that integrate with Linear',
72-
},
31+
```bash
32+
npm install
33+
npm run dev # start dev server at http://localhost:5173
34+
npm run build # fetch latest server data + build
7335
```
74-
75-
The `search` value is passed to the registry's `?search=` query param (substring match on server name).
76-
77-
## Deployment
78-
79-
Deploys automatically to GitHub Pages on every push to `main` via `.github/workflows/deploy.yml`.
80-
81-
**One-time setup:** In the GitHub repo go to **Settings → Pages → Source** and select **GitHub Actions**.
82-
83-
The build step (`npm run build`) runs `scripts/build-registry.mjs` first to fetch fresh server data, then builds the Vite app.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "node scripts/build-registry.mjs && vite build",
9+
"add-server": "node scripts/add-server.mjs",
10+
"remove-server": "node scripts/remove-server.mjs",
911
"lint": "eslint .",
1012
"preview": "vite preview"
1113
},

scripts/add-server.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env node
2+
// Usage: node scripts/add-server.mjs <server-name>
3+
// Example: node scripts/add-server.mjs io.github.someone/my-server
4+
//
5+
// Looks up the server in the MCP registry, adds it to ALLOWED_SERVERS,
6+
// and runs the build so the change is ready to push.
7+
8+
import { readFileSync, writeFileSync } from 'fs';
9+
import { execSync } from 'child_process';
10+
import { join, dirname } from 'path';
11+
import { fileURLToPath } from 'url';
12+
13+
const __dirname = dirname(fileURLToPath(import.meta.url));
14+
const BUILD_SCRIPT = join(__dirname, 'build-registry.mjs');
15+
16+
const name = process.argv[2];
17+
if (!name) {
18+
console.error('Usage: node scripts/add-server.mjs <server-name>');
19+
console.error('Example: node scripts/add-server.mjs io.github.someone/my-server');
20+
process.exit(1);
21+
}
22+
23+
// Verify the server exists in the MCP registry
24+
console.log(`Looking up "${name}" in the MCP registry...`);
25+
const encoded = encodeURIComponent(name);
26+
const url = `https://registry.modelcontextprotocol.io/v0.1/servers/${encoded}/versions/latest`;
27+
const res = await fetch(url);
28+
if (!res.ok) {
29+
console.error(`✗ Server not found: ${res.status} ${res.statusText}`);
30+
console.error(` Check https://registry.modelcontextprotocol.io for the correct name.`);
31+
process.exit(1);
32+
}
33+
const data = await res.json();
34+
console.log(`✓ Found: ${data.server.title ?? data.server.name} v${data.server.version}`);
35+
36+
// Add to ALLOWED_SERVERS in build-registry.mjs
37+
const src = readFileSync(BUILD_SCRIPT, 'utf8');
38+
const match = src.match(/const ALLOWED_SERVERS = \[([\s\S]*?)\];/);
39+
if (!match) {
40+
console.error('✗ Could not find ALLOWED_SERVERS in build-registry.mjs');
41+
process.exit(1);
42+
}
43+
44+
const entries = match[1]
45+
.split('\n')
46+
.map(l => l.trim())
47+
.filter(l => l.startsWith("'") || l.startsWith('"'))
48+
.map(l => l.replace(/[',]/g, '').trim());
49+
50+
if (entries.includes(name)) {
51+
console.log(`\n"${name}" is already in ALLOWED_SERVERS. Nothing to do.`);
52+
process.exit(0);
53+
}
54+
55+
entries.push(name);
56+
const newList = entries.map(e => ` '${e}',`).join('\n');
57+
const updated = src.replace(
58+
/const ALLOWED_SERVERS = \[[\s\S]*?\];/,
59+
`const ALLOWED_SERVERS = [\n${newList}\n];`
60+
);
61+
writeFileSync(BUILD_SCRIPT, updated);
62+
console.log(`\n✓ Added "${name}" to ALLOWED_SERVERS`);
63+
64+
// Rebuild
65+
console.log('\nRebuilding registry...');
66+
execSync('node scripts/build-registry.mjs', { stdio: 'inherit', cwd: join(__dirname, '..') });
67+
68+
console.log('\nDone! Commit and push to deploy.');

scripts/remove-server.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env node
2+
// Usage: node scripts/remove-server.mjs <server-name>
3+
// Example: node scripts/remove-server.mjs com.figma.mcp/mcp
4+
5+
import { readFileSync, writeFileSync } from 'fs';
6+
import { execSync } from 'child_process';
7+
import { join, dirname } from 'path';
8+
import { fileURLToPath } from 'url';
9+
10+
const __dirname = dirname(fileURLToPath(import.meta.url));
11+
const BUILD_SCRIPT = join(__dirname, 'build-registry.mjs');
12+
13+
const name = process.argv[2];
14+
if (!name) {
15+
console.error('Usage: node scripts/remove-server.mjs <server-name>');
16+
console.error('Example: node scripts/remove-server.mjs com.figma.mcp/mcp');
17+
process.exit(1);
18+
}
19+
20+
const src = readFileSync(BUILD_SCRIPT, 'utf8');
21+
const match = src.match(/const ALLOWED_SERVERS = \[([\s\S]*?)\];/);
22+
if (!match) {
23+
console.error('✗ Could not find ALLOWED_SERVERS in build-registry.mjs');
24+
process.exit(1);
25+
}
26+
27+
const entries = match[1]
28+
.split('\n')
29+
.map(l => l.trim())
30+
.filter(l => l.startsWith("'") || l.startsWith('"'))
31+
.map(l => l.replace(/[',]/g, '').trim());
32+
33+
if (!entries.includes(name)) {
34+
console.error(`✗ "${name}" is not in ALLOWED_SERVERS.`);
35+
console.log(`\nCurrently allowed servers:\n${entries.map(e => ` - ${e}`).join('\n')}`);
36+
process.exit(1);
37+
}
38+
39+
const updated_entries = entries.filter(e => e !== name);
40+
const newList = updated_entries.map(e => ` '${e}',`).join('\n');
41+
const updated = src.replace(
42+
/const ALLOWED_SERVERS = \[[\s\S]*?\];/,
43+
`const ALLOWED_SERVERS = [\n${newList}\n];`
44+
);
45+
writeFileSync(BUILD_SCRIPT, updated);
46+
console.log(`✓ Removed "${name}" from ALLOWED_SERVERS`);
47+
48+
// Rebuild
49+
console.log('\nRebuilding registry...');
50+
execSync('node scripts/build-registry.mjs', { stdio: 'inherit', cwd: join(__dirname, '..') });
51+
52+
console.log('\nDone! Commit and push to deploy.');

0 commit comments

Comments
 (0)