@wenrwa/marketplace-cli 0.4.0 → 0.4.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.
|
@@ -88,6 +88,9 @@ describe('MCP auto-registration', () => {
|
|
|
88
88
|
expect(addCall).toBeDefined();
|
|
89
89
|
expect(addCall.join(' ')).toContain('wenrwa-marketplace');
|
|
90
90
|
expect(addCall.join(' ')).toContain(`WENRWA_CONNECT_TOKEN=${token}`);
|
|
91
|
+
// User scope: the PTY shell starts in ~, and users run claude in any repo —
|
|
92
|
+
// a local (per-directory) registration would be invisible there.
|
|
93
|
+
expect(addCall.join(' ')).toContain('--scope user');
|
|
91
94
|
});
|
|
92
95
|
it('skips when already registered (idempotent)', async () => {
|
|
93
96
|
const { calls, run } = runner('wenrwa-marketplace: npx @wenrwa/marketplace-mcp\n');
|
|
@@ -125,6 +125,21 @@ describe('bridge WebSocket server', () => {
|
|
|
125
125
|
expect(bad.status).toBe(403);
|
|
126
126
|
expect(bad.headers.get('access-control-allow-origin')).toBeNull();
|
|
127
127
|
});
|
|
128
|
+
it('answers the Chrome Private-Network-Access preflight for the arena origin', async () => {
|
|
129
|
+
const res = await fetch(`http://127.0.0.1:${handle.port}/discovery`, {
|
|
130
|
+
method: 'OPTIONS',
|
|
131
|
+
headers: { origin: ORIGIN, 'Access-Control-Request-Private-Network': 'true' },
|
|
132
|
+
});
|
|
133
|
+
expect(res.status).toBe(204);
|
|
134
|
+
expect(res.headers.get('access-control-allow-origin')).toBe(ORIGIN);
|
|
135
|
+
expect(res.headers.get('access-control-allow-private-network')).toBe('true');
|
|
136
|
+
expect(res.headers.get('access-control-allow-methods')).toContain('GET');
|
|
137
|
+
const bad = await fetch(`http://127.0.0.1:${handle.port}/discovery`, {
|
|
138
|
+
method: 'OPTIONS',
|
|
139
|
+
headers: { origin: 'https://evil.example' },
|
|
140
|
+
});
|
|
141
|
+
expect(bad.status).toBe(403);
|
|
142
|
+
});
|
|
128
143
|
it('unauthenticated frames are rejected', async () => {
|
|
129
144
|
const ws = connect(handle.port);
|
|
130
145
|
await new Promise((r) => ws.on('open', r));
|
|
@@ -22,10 +22,12 @@ async function registerMcpServer(opts) {
|
|
|
22
22
|
return { action: 'already-registered' };
|
|
23
23
|
}
|
|
24
24
|
if (exists && opts.forceUpdate) {
|
|
25
|
-
await opts.run('claude', ['mcp', 'remove', exports.MCP_SERVER_NAME]);
|
|
25
|
+
await opts.run('claude', ['mcp', 'remove', '--scope', 'user', exports.MCP_SERVER_NAME]).catch(() => { });
|
|
26
|
+
// Also clear a stale default(local)-scope entry from older bridge versions.
|
|
27
|
+
await opts.run('claude', ['mcp', 'remove', exports.MCP_SERVER_NAME]).catch(() => { });
|
|
26
28
|
}
|
|
27
29
|
const args = [
|
|
28
|
-
'mcp', 'add', exports.MCP_SERVER_NAME,
|
|
30
|
+
'mcp', 'add', '--scope', 'user', exports.MCP_SERVER_NAME,
|
|
29
31
|
'-e', `WENRWA_CONNECT_TOKEN=${opts.connectToken}`,
|
|
30
32
|
'-e', `MARKETPLACE_API_URL=${opts.apiUrl}`,
|
|
31
33
|
'--', 'npx', '@wenrwa/marketplace-mcp',
|
package/dist/bridge/server.js
CHANGED
|
@@ -63,6 +63,23 @@ function startBridgeServer(opts) {
|
|
|
63
63
|
// read it. (Same-machine cross-user curl with a forged Origin remains
|
|
64
64
|
// possible; documented as out of scope for v1 in PROTOCOL.md.)
|
|
65
65
|
const httpServer = http.createServer((req, res) => {
|
|
66
|
+
// Chrome Private-Network-Access: a public origin (app.hiveop.io) calling a
|
|
67
|
+
// local address sends an OPTIONS preflight that MUST be answered with
|
|
68
|
+
// Access-Control-Allow-Private-Network, or the browser blocks discovery.
|
|
69
|
+
if (req.method === 'OPTIONS' && req.url === '/discovery') {
|
|
70
|
+
if (req.headers.origin !== opts.allowedOrigin) {
|
|
71
|
+
res.writeHead(403).end();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
res.writeHead(204, {
|
|
75
|
+
'access-control-allow-origin': opts.allowedOrigin,
|
|
76
|
+
'access-control-allow-private-network': 'true',
|
|
77
|
+
'access-control-allow-methods': 'GET, OPTIONS',
|
|
78
|
+
'access-control-max-age': '600',
|
|
79
|
+
});
|
|
80
|
+
res.end();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
66
83
|
if (req.method === 'GET' && req.url === '/discovery') {
|
|
67
84
|
if (req.headers.origin !== opts.allowedOrigin) {
|
|
68
85
|
res.writeHead(403).end();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenrwa/marketplace-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI tool for the Wenrwa Agent Marketplace — monitor bounties, agents, workspaces, and treasury from your terminal",
|
|
5
5
|
"author": "Wenrwa <dev@wenrwa.com>",
|
|
6
6
|
"license": "MIT",
|