@openweave/weave-link 0.2.0 → 0.5.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/auth.d.ts +59 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +130 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +247 -0
- package/dist/cli.js.map +1 -0
- package/dist/http-transport.d.ts +67 -0
- package/dist/http-transport.d.ts.map +1 -0
- package/dist/http-transport.js +359 -0
- package/dist/http-transport.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/claude-desktop.d.ts +49 -0
- package/dist/installer/claude-desktop.d.ts.map +1 -0
- package/dist/installer/claude-desktop.js +169 -0
- package/dist/installer/claude-desktop.js.map +1 -0
- package/dist/installer/config-generator.d.ts +47 -0
- package/dist/installer/config-generator.d.ts.map +1 -0
- package/dist/installer/config-generator.js +90 -0
- package/dist/installer/config-generator.js.map +1 -0
- package/dist/installer/cursor.d.ts +52 -0
- package/dist/installer/cursor.d.ts.map +1 -0
- package/dist/installer/cursor.js +165 -0
- package/dist/installer/cursor.js.map +1 -0
- package/dist/installer/index.d.ts +11 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +14 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/mcp-server.d.ts +75 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +364 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/tools.d.ts +42 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +230 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +86 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HTTP Transport — M9: Remote WeaveLink
|
|
4
|
+
*
|
|
5
|
+
* Provides an HTTP server with JSON-RPC-style endpoints and
|
|
6
|
+
* optional Server-Sent Events (SSE) for push notifications.
|
|
7
|
+
*
|
|
8
|
+
* Endpoints:
|
|
9
|
+
* GET / → server info (no auth)
|
|
10
|
+
* GET /health → liveness check (no auth)
|
|
11
|
+
* GET /tools → list available tools (auth optional)
|
|
12
|
+
* POST /tools/call → invoke a tool (auth required)
|
|
13
|
+
* GET /events → SSE stream (auth required)
|
|
14
|
+
*
|
|
15
|
+
* Zero runtime dependencies — uses Node built-ins only.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.HttpTransport = void 0;
|
|
19
|
+
const node_http_1 = require("node:http");
|
|
20
|
+
const mcp_server_1 = require("./mcp-server");
|
|
21
|
+
const auth_1 = require("./auth");
|
|
22
|
+
/** Maximum number of concurrent SSE clients (VULN-011) */
|
|
23
|
+
const MAX_SSE_CLIENTS = 100;
|
|
24
|
+
/** Maximum request body size in bytes — 1 MB (VULN-010) */
|
|
25
|
+
const MAX_BODY_BYTES = 1_048_576;
|
|
26
|
+
// ──────────────────────────────────────────────────────────
|
|
27
|
+
// WeaveLink HTTP Transport
|
|
28
|
+
// ──────────────────────────────────────────────────────────
|
|
29
|
+
class HttpTransport {
|
|
30
|
+
server = null;
|
|
31
|
+
weaveLinkServer;
|
|
32
|
+
auth;
|
|
33
|
+
config;
|
|
34
|
+
sseClients = new Map();
|
|
35
|
+
startTime = null;
|
|
36
|
+
constructor(weaveLinkServer, auth, config) {
|
|
37
|
+
this.weaveLinkServer = weaveLinkServer || new mcp_server_1.WeaveLinkServer();
|
|
38
|
+
// VULN-009: auth is enabled by default — callers must explicitly disable it for local stdio use
|
|
39
|
+
this.auth = auth || new auth_1.AuthManager({ enabled: true });
|
|
40
|
+
this.config = {
|
|
41
|
+
port: config?.port ?? 3001,
|
|
42
|
+
host: config?.host ?? '127.0.0.1',
|
|
43
|
+
// VULN-008: CORS off by default — callers must opt-in with a specific origin
|
|
44
|
+
cors: config?.cors ?? false,
|
|
45
|
+
verbose: config?.verbose ?? false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// ── Lifecycle ─────────────────────────────────────────────
|
|
49
|
+
/**
|
|
50
|
+
* Start listening on the configured port.
|
|
51
|
+
*/
|
|
52
|
+
async start() {
|
|
53
|
+
await this.weaveLinkServer.initialize();
|
|
54
|
+
// VULN-009: refuse to start if auth is on but no keys are configured
|
|
55
|
+
if (this.auth.isEnabled() && this.auth.getKeyCount() === 0) {
|
|
56
|
+
throw new Error('[WeaveLink] Cannot start HTTP server: auth is enabled but no API keys are configured. ' +
|
|
57
|
+
'Provide at least one key via AuthManager or set WEAVE_API_KEY.');
|
|
58
|
+
}
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
this.server = (0, node_http_1.createServer)((req, res) => this.dispatch(req, res));
|
|
61
|
+
this.server.on('error', (err) => reject(err));
|
|
62
|
+
this.server.listen(this.config.port, this.config.host, () => {
|
|
63
|
+
this.startTime = new Date();
|
|
64
|
+
if (this.config.verbose) {
|
|
65
|
+
console.log(`[WeaveLink] HTTP transport listening on http://${this.config.host}:${this.config.port}`);
|
|
66
|
+
}
|
|
67
|
+
resolve();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Stop the server and disconnect all SSE clients.
|
|
73
|
+
*/
|
|
74
|
+
async stop() {
|
|
75
|
+
// Close all SSE connections
|
|
76
|
+
for (const client of this.sseClients.values()) {
|
|
77
|
+
client.res.end();
|
|
78
|
+
}
|
|
79
|
+
this.sseClients.clear();
|
|
80
|
+
return new Promise((resolve, reject) => {
|
|
81
|
+
if (!this.server)
|
|
82
|
+
return resolve();
|
|
83
|
+
this.server.close((err) => {
|
|
84
|
+
if (err)
|
|
85
|
+
reject(err);
|
|
86
|
+
else
|
|
87
|
+
resolve();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
isRunning() {
|
|
92
|
+
return this.server?.listening ?? false;
|
|
93
|
+
}
|
|
94
|
+
getPort() {
|
|
95
|
+
return this.config.port;
|
|
96
|
+
}
|
|
97
|
+
getConnectedClients() {
|
|
98
|
+
return this.sseClients.size;
|
|
99
|
+
}
|
|
100
|
+
// ── Request dispatcher ────────────────────────────────────
|
|
101
|
+
dispatch(req, res) {
|
|
102
|
+
if (this.config.cors) {
|
|
103
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
104
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
105
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-API-Key');
|
|
106
|
+
}
|
|
107
|
+
// Preflight
|
|
108
|
+
if (req.method === 'OPTIONS') {
|
|
109
|
+
res.writeHead(204);
|
|
110
|
+
res.end();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const url = new URL(req.url ?? '/', `http://${this.config.host}`);
|
|
114
|
+
const path = url.pathname;
|
|
115
|
+
// Public endpoints (no auth)
|
|
116
|
+
if (path === '/' && req.method === 'GET') {
|
|
117
|
+
// MCP Streamable HTTP: if client wants SSE, serve events stream
|
|
118
|
+
if (req.headers['accept']?.includes('text/event-stream')) {
|
|
119
|
+
return this.auth.middleware(req, res, () => this.handleSSE(req, res));
|
|
120
|
+
}
|
|
121
|
+
return this.handleInfo(req, res);
|
|
122
|
+
}
|
|
123
|
+
if (path === '/health' && req.method === 'GET')
|
|
124
|
+
return this.handleHealth(req, res);
|
|
125
|
+
// MCP Streamable HTTP — JSON-RPC 2.0 on POST /
|
|
126
|
+
if (path === '/' && req.method === 'POST') {
|
|
127
|
+
return this.auth.middleware(req, res, () => this.handleMCPRPC(req, res));
|
|
128
|
+
}
|
|
129
|
+
// Protected endpoints
|
|
130
|
+
if (path === '/tools' && req.method === 'GET') {
|
|
131
|
+
return this.auth.middleware(req, res, () => this.handleListTools(req, res));
|
|
132
|
+
}
|
|
133
|
+
if (path === '/tools/call' && req.method === 'POST') {
|
|
134
|
+
return this.auth.middleware(req, res, () => this.handleCallTool(req, res));
|
|
135
|
+
}
|
|
136
|
+
if (path === '/events' && req.method === 'GET') {
|
|
137
|
+
return this.auth.middleware(req, res, () => this.handleSSE(req, res));
|
|
138
|
+
}
|
|
139
|
+
// 404
|
|
140
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
141
|
+
res.end(JSON.stringify({ error: `Not found: ${req.method} ${path}` }));
|
|
142
|
+
}
|
|
143
|
+
// ── Route handlers ────────────────────────────────────────
|
|
144
|
+
handleInfo(_req, res) {
|
|
145
|
+
const info = this.weaveLinkServer.getServerInfo();
|
|
146
|
+
this.json(res, 200, {
|
|
147
|
+
...info,
|
|
148
|
+
transport: 'http',
|
|
149
|
+
uptime_ms: this.startTime ? Date.now() - this.startTime.getTime() : 0,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
handleHealth(_req, res) {
|
|
153
|
+
this.json(res, 200, {
|
|
154
|
+
status: 'ok',
|
|
155
|
+
timestamp: new Date().toISOString(),
|
|
156
|
+
sse_clients: this.sseClients.size,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
handleListTools(_req, res) {
|
|
160
|
+
const tools = this.weaveLinkServer.listTools();
|
|
161
|
+
this.json(res, 200, { tools, count: tools.length });
|
|
162
|
+
}
|
|
163
|
+
// ── MCP Streamable HTTP (JSON-RPC 2.0) ───────────────────
|
|
164
|
+
// Handles the protocol used by VS Code Copilot and other MCP clients
|
|
165
|
+
// that POST JSON-RPC messages to the server root endpoint.
|
|
166
|
+
handleMCPRPC(req, res) {
|
|
167
|
+
res.setHeader('Access-Control-Expose-Headers', 'mcp-session-id');
|
|
168
|
+
this.readBody(req)
|
|
169
|
+
.then(async (body) => {
|
|
170
|
+
let rpc;
|
|
171
|
+
try {
|
|
172
|
+
rpc = JSON.parse(body);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
this.jsonRPC(res, null, null, { code: -32700, message: 'Parse error' });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const { method, params = {}, id = null } = rpc;
|
|
179
|
+
// ── initialize ─────────────────────────────────────
|
|
180
|
+
if (method === 'initialize') {
|
|
181
|
+
const info = this.weaveLinkServer.getServerInfo();
|
|
182
|
+
this.jsonRPC(res, id, {
|
|
183
|
+
protocolVersion: '2024-11-05',
|
|
184
|
+
capabilities: { tools: {} },
|
|
185
|
+
serverInfo: { name: info.name, version: info.version },
|
|
186
|
+
});
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// ── notifications/initialized (no response needed) ──
|
|
190
|
+
if (method === 'notifications/initialized') {
|
|
191
|
+
res.writeHead(202);
|
|
192
|
+
res.end();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// ── ping ────────────────────────────────────────────
|
|
196
|
+
if (method === 'ping') {
|
|
197
|
+
this.jsonRPC(res, id, {});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// ── tools/list ──────────────────────────────────────
|
|
201
|
+
if (method === 'tools/list') {
|
|
202
|
+
const tools = this.weaveLinkServer.listTools().map((t) => ({
|
|
203
|
+
name: t.name,
|
|
204
|
+
description: t.description,
|
|
205
|
+
inputSchema: t.inputSchema,
|
|
206
|
+
}));
|
|
207
|
+
this.jsonRPC(res, id, { tools });
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
// ── tools/call ──────────────────────────────────────
|
|
211
|
+
if (method === 'tools/call') {
|
|
212
|
+
const toolName = params['name'];
|
|
213
|
+
const toolArgs = (params['arguments'] ?? {});
|
|
214
|
+
if (!toolName) {
|
|
215
|
+
this.jsonRPC(res, id, null, { code: -32602, message: 'Missing params.name' });
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const result = await this.weaveLinkServer.callTool(toolName, toolArgs);
|
|
219
|
+
// Notify SSE clients
|
|
220
|
+
this.broadcast({ event: 'tool_called', data: { tool: toolName, timestamp: new Date().toISOString() } });
|
|
221
|
+
this.jsonRPC(res, id, result);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
// Unknown method
|
|
225
|
+
this.jsonRPC(res, id, null, { code: -32601, message: `Method not found: ${method}` });
|
|
226
|
+
})
|
|
227
|
+
.catch((err) => {
|
|
228
|
+
const e = err;
|
|
229
|
+
if (e.statusCode === 413) {
|
|
230
|
+
this.jsonRPC(res, null, null, { code: -32600, message: 'Payload too large' });
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
this.jsonRPC(res, null, null, { code: -32603, message: `Internal error: ${e.message}` });
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
handleCallTool(req, res) {
|
|
238
|
+
this.readBody(req)
|
|
239
|
+
.then(async (body) => {
|
|
240
|
+
let parsed;
|
|
241
|
+
try {
|
|
242
|
+
parsed = JSON.parse(body);
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
this.json(res, 400, { error: 'Invalid JSON body' });
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const { tool, args = {} } = parsed;
|
|
249
|
+
if (!tool || typeof tool !== 'string') {
|
|
250
|
+
this.json(res, 400, { error: 'Missing required field: tool' });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const result = await this.weaveLinkServer.callTool(tool, args);
|
|
254
|
+
// Notify SSE clients of the tool invocation
|
|
255
|
+
this.broadcast({
|
|
256
|
+
event: 'tool_called',
|
|
257
|
+
data: { tool, timestamp: new Date().toISOString() },
|
|
258
|
+
});
|
|
259
|
+
this.json(res, 200, result);
|
|
260
|
+
})
|
|
261
|
+
.catch((err) => {
|
|
262
|
+
const e = err;
|
|
263
|
+
if (e.statusCode === 413) {
|
|
264
|
+
this.json(res, 413, { error: 'Payload too large — request body must not exceed 1 MB' });
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this.json(res, 500, { error: `Internal error: ${e.message}` });
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
handleSSE(req, res) {
|
|
272
|
+
// VULN-011: cap concurrent SSE connections to prevent memory exhaustion
|
|
273
|
+
if (this.sseClients.size >= MAX_SSE_CLIENTS) {
|
|
274
|
+
res.writeHead(503, { 'Content-Type': 'application/json' });
|
|
275
|
+
res.end(JSON.stringify({ error: 'SSE connection limit reached — try again later' }));
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const clientId = `client-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
279
|
+
res.writeHead(200, {
|
|
280
|
+
'Content-Type': 'text/event-stream',
|
|
281
|
+
'Cache-Control': 'no-cache',
|
|
282
|
+
Connection: 'keep-alive',
|
|
283
|
+
'X-Accel-Buffering': 'no', // Disable nginx buffering
|
|
284
|
+
});
|
|
285
|
+
// Send a welcome event
|
|
286
|
+
this.sendSSE(res, 'connected', { clientId, serverTime: new Date().toISOString() });
|
|
287
|
+
this.sseClients.set(clientId, { id: clientId, res });
|
|
288
|
+
// Remove client on disconnect
|
|
289
|
+
req.on('close', () => {
|
|
290
|
+
this.sseClients.delete(clientId);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
// ── SSE helpers ───────────────────────────────────────────
|
|
294
|
+
sendSSE(res, event, data) {
|
|
295
|
+
const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
296
|
+
res.write(payload);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Broadcast a message to all connected SSE clients.
|
|
300
|
+
*/
|
|
301
|
+
broadcast(message) {
|
|
302
|
+
if (this.sseClients.size === 0)
|
|
303
|
+
return;
|
|
304
|
+
const payload = `event: ${message.event}\ndata: ${JSON.stringify(message.data)}\n\n`;
|
|
305
|
+
const toRemove = [];
|
|
306
|
+
for (const [id, client] of this.sseClients) {
|
|
307
|
+
try {
|
|
308
|
+
client.res.write(payload);
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
// Client disconnected but didn't fire 'close' — clean up
|
|
312
|
+
toRemove.push(id);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
for (const id of toRemove) {
|
|
316
|
+
this.sseClients.delete(id);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// ── Utility ───────────────────────────────────────────────
|
|
320
|
+
// VULN-010: enforce a 1 MB body limit to prevent memory exhaustion DoS
|
|
321
|
+
readBody(req) {
|
|
322
|
+
return new Promise((resolve, reject) => {
|
|
323
|
+
const chunks = [];
|
|
324
|
+
let totalBytes = 0;
|
|
325
|
+
req.on('data', (chunk) => {
|
|
326
|
+
totalBytes += chunk.byteLength;
|
|
327
|
+
if (totalBytes > MAX_BODY_BYTES) {
|
|
328
|
+
req.destroy();
|
|
329
|
+
const err = Object.assign(new Error('Payload too large'), { statusCode: 413 });
|
|
330
|
+
return reject(err);
|
|
331
|
+
}
|
|
332
|
+
chunks.push(chunk);
|
|
333
|
+
});
|
|
334
|
+
req.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
|
|
335
|
+
req.on('error', reject);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
json(res, status, data) {
|
|
339
|
+
const body = JSON.stringify(data);
|
|
340
|
+
res.writeHead(status, {
|
|
341
|
+
'Content-Type': 'application/json',
|
|
342
|
+
'Content-Length': Buffer.byteLength(body),
|
|
343
|
+
});
|
|
344
|
+
res.end(body);
|
|
345
|
+
}
|
|
346
|
+
jsonRPC(res, id, result, error) {
|
|
347
|
+
const payload = error
|
|
348
|
+
? { jsonrpc: '2.0', error, id }
|
|
349
|
+
: { jsonrpc: '2.0', result, id };
|
|
350
|
+
const body = JSON.stringify(payload);
|
|
351
|
+
res.writeHead(200, {
|
|
352
|
+
'Content-Type': 'application/json',
|
|
353
|
+
'Content-Length': Buffer.byteLength(body),
|
|
354
|
+
});
|
|
355
|
+
res.end(body);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
exports.HttpTransport = HttpTransport;
|
|
359
|
+
//# sourceMappingURL=http-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.js","sourceRoot":"","sources":["../src/http-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAAiG;AACjG,6CAA+C;AAC/C,iCAAqC;AAmBrC,0DAA0D;AAC1D,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,2DAA2D;AAC3D,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,6DAA6D;AAC7D,2BAA2B;AAC3B,6DAA6D;AAE7D,MAAa,aAAa;IAChB,MAAM,GAAkB,IAAI,CAAC;IAC7B,eAAe,CAAkB;IACjC,IAAI,CAAc;IAClB,MAAM,CAAgC;IACtC,UAAU,GAA2B,IAAI,GAAG,EAAE,CAAC;IAC/C,SAAS,GAAgB,IAAI,CAAC;IAEtC,YACE,eAAiC,EACjC,IAAkB,EAClB,MAA4B;QAE5B,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,IAAI,4BAAe,EAAE,CAAC;QAChE,gGAAgG;QAChG,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,kBAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,IAAI;YAC1B,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,WAAW;YACjC,6EAA6E;YAC7E,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,KAAK;YAC3B,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,KAAK;SAClC,CAAC;IACJ,CAAC;IAED,6DAA6D;IAE7D;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,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C,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF;AAzYD,sCAyYC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,18 @@
|
|
|
2
2
|
* WeaveLink - MCP Server
|
|
3
3
|
* Model Context Protocol server for integrating WeaveGraph with AI clients
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { ALL_TOOLS, getTool, TOOL_SAVE_NODE, TOOL_QUERY_GRAPH, TOOL_SUPPRESS_ERROR, TOOL_UPDATE_ROADMAP, TOOL_GET_SESSION_CONTEXT, TOOL_GET_NEXT_ACTION, TOOL_LIST_ORPHANS, } from './tools';
|
|
7
|
+
export { WeaveLinkServer } from './mcp-server';
|
|
8
|
+
export { AuthManager, generateApiKey } from './auth';
|
|
9
|
+
export type { AuthConfig, AuthResult } from './auth';
|
|
10
|
+
export { HttpTransport } from './http-transport';
|
|
11
|
+
export type { HttpTransportConfig } from './http-transport';
|
|
12
|
+
export { ConfigGenerator } from './installer/config-generator';
|
|
13
|
+
export type { WeaveLinkConfig, MCPClientEntry, MCPClientsConfig } from './installer/config-generator';
|
|
14
|
+
export { ClaudeDesktopInstaller } from './installer/claude-desktop';
|
|
15
|
+
export type { InstallResult } from './installer/claude-desktop';
|
|
16
|
+
export { CursorInstaller } from './installer/cursor';
|
|
17
|
+
export type { CursorInstallResult, CursorScope } from './installer/cursor';
|
|
18
|
+
export declare const version = "0.2.0";
|
|
6
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3E,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* WeaveLink - MCP Server
|
|
3
4
|
* Model Context Protocol server for integrating WeaveGraph with AI clients
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.version = exports.CursorInstaller = exports.ClaudeDesktopInstaller = exports.ConfigGenerator = exports.HttpTransport = exports.generateApiKey = exports.AuthManager = exports.WeaveLinkServer = exports.TOOL_LIST_ORPHANS = exports.TOOL_GET_NEXT_ACTION = exports.TOOL_GET_SESSION_CONTEXT = exports.TOOL_UPDATE_ROADMAP = exports.TOOL_SUPPRESS_ERROR = exports.TOOL_QUERY_GRAPH = exports.TOOL_SAVE_NODE = exports.getTool = exports.ALL_TOOLS = void 0;
|
|
22
|
+
// Core MCP server
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
var tools_1 = require("./tools");
|
|
25
|
+
Object.defineProperty(exports, "ALL_TOOLS", { enumerable: true, get: function () { return tools_1.ALL_TOOLS; } });
|
|
26
|
+
Object.defineProperty(exports, "getTool", { enumerable: true, get: function () { return tools_1.getTool; } });
|
|
27
|
+
Object.defineProperty(exports, "TOOL_SAVE_NODE", { enumerable: true, get: function () { return tools_1.TOOL_SAVE_NODE; } });
|
|
28
|
+
Object.defineProperty(exports, "TOOL_QUERY_GRAPH", { enumerable: true, get: function () { return tools_1.TOOL_QUERY_GRAPH; } });
|
|
29
|
+
Object.defineProperty(exports, "TOOL_SUPPRESS_ERROR", { enumerable: true, get: function () { return tools_1.TOOL_SUPPRESS_ERROR; } });
|
|
30
|
+
Object.defineProperty(exports, "TOOL_UPDATE_ROADMAP", { enumerable: true, get: function () { return tools_1.TOOL_UPDATE_ROADMAP; } });
|
|
31
|
+
Object.defineProperty(exports, "TOOL_GET_SESSION_CONTEXT", { enumerable: true, get: function () { return tools_1.TOOL_GET_SESSION_CONTEXT; } });
|
|
32
|
+
Object.defineProperty(exports, "TOOL_GET_NEXT_ACTION", { enumerable: true, get: function () { return tools_1.TOOL_GET_NEXT_ACTION; } });
|
|
33
|
+
Object.defineProperty(exports, "TOOL_LIST_ORPHANS", { enumerable: true, get: function () { return tools_1.TOOL_LIST_ORPHANS; } });
|
|
34
|
+
var mcp_server_1 = require("./mcp-server");
|
|
35
|
+
Object.defineProperty(exports, "WeaveLinkServer", { enumerable: true, get: function () { return mcp_server_1.WeaveLinkServer; } });
|
|
36
|
+
// M9 · Remote WeaveLink
|
|
37
|
+
var auth_1 = require("./auth");
|
|
38
|
+
Object.defineProperty(exports, "AuthManager", { enumerable: true, get: function () { return auth_1.AuthManager; } });
|
|
39
|
+
Object.defineProperty(exports, "generateApiKey", { enumerable: true, get: function () { return auth_1.generateApiKey; } });
|
|
40
|
+
var http_transport_1 = require("./http-transport");
|
|
41
|
+
Object.defineProperty(exports, "HttpTransport", { enumerable: true, get: function () { return http_transport_1.HttpTransport; } });
|
|
42
|
+
// M8 · Client Integrations
|
|
43
|
+
var config_generator_1 = require("./installer/config-generator");
|
|
44
|
+
Object.defineProperty(exports, "ConfigGenerator", { enumerable: true, get: function () { return config_generator_1.ConfigGenerator; } });
|
|
45
|
+
var claude_desktop_1 = require("./installer/claude-desktop");
|
|
46
|
+
Object.defineProperty(exports, "ClaudeDesktopInstaller", { enumerable: true, get: function () { return claude_desktop_1.ClaudeDesktopInstaller; } });
|
|
47
|
+
var cursor_1 = require("./installer/cursor");
|
|
48
|
+
Object.defineProperty(exports, "CursorInstaller", { enumerable: true, get: function () { return cursor_1.CursorInstaller; } });
|
|
49
|
+
exports.version = '0.2.0';
|
|
6
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,kBAAkB;AAClB,0CAAwB;AACxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAChB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,iHAAA,wBAAwB,OAAA;AACxB,6GAAA,oBAAoB,OAAA;AACpB,0GAAA,iBAAiB,OAAA;AAEnB,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AAExB,wBAAwB;AACxB,+BAAqD;AAA5C,mGAAA,WAAW,OAAA;AAAE,sGAAA,cAAc,OAAA;AAEpC,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAGtB,2BAA2B;AAC3B,iEAA+D;AAAtD,mHAAA,eAAe,OAAA;AAExB,6DAAoE;AAA3D,wHAAA,sBAAsB,OAAA;AAE/B,6CAAqD;AAA5C,yGAAA,eAAe,OAAA;AAGX,QAAA,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Desktop Installer — M8: Client Integrations
|
|
3
|
+
*
|
|
4
|
+
* Locates the Claude Desktop MCP config file on the current OS,
|
|
5
|
+
* reads it, injects the WeaveLink `mcpServers` entry, and writes
|
|
6
|
+
* the result back to disk.
|
|
7
|
+
*
|
|
8
|
+
* Claude Desktop config paths:
|
|
9
|
+
* Windows : %APPDATA%\Claude\claude_desktop_config.json
|
|
10
|
+
* macOS : ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
11
|
+
* Linux : ~/.config/Claude/claude_desktop_config.json
|
|
12
|
+
*/
|
|
13
|
+
import { MCPClientsConfig, WeaveLinkConfig } from './config-generator';
|
|
14
|
+
export interface InstallResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
configPath: string;
|
|
17
|
+
message: string;
|
|
18
|
+
/** The final JSON written to disk (for inspection/logging) */
|
|
19
|
+
configWritten?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class ClaudeDesktopInstaller {
|
|
22
|
+
/**
|
|
23
|
+
* Resolve Claude Desktop's config file path for the current OS.
|
|
24
|
+
*/
|
|
25
|
+
static getConfigPath(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Check whether the Claude Desktop config directory exists.
|
|
28
|
+
* Returns `true` if Claude Desktop appears to be installed.
|
|
29
|
+
*/
|
|
30
|
+
static isInstalled(configPath?: string): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Read the current Claude Desktop config.
|
|
33
|
+
* Returns an empty `{ mcpServers: {} }` structure if the file doesn't exist yet.
|
|
34
|
+
*/
|
|
35
|
+
static readConfig(configPath?: string): Promise<MCPClientsConfig>;
|
|
36
|
+
/**
|
|
37
|
+
* Install (or update) the WeaveLink entry in Claude Desktop's config.
|
|
38
|
+
*
|
|
39
|
+
* @param config Optional WeaveLink connection config.
|
|
40
|
+
* @param mode 'stdio' (default) or 'http'.
|
|
41
|
+
* @param configPath Override the config file path (useful for testing).
|
|
42
|
+
*/
|
|
43
|
+
static install(config?: WeaveLinkConfig, mode?: 'stdio' | 'http', configPath?: string): Promise<InstallResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Remove the WeaveLink entry from Claude Desktop's config.
|
|
46
|
+
*/
|
|
47
|
+
static uninstall(configPath?: string): Promise<InstallResult>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=claude-desktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-desktop.d.ts","sourceRoot":"","sources":["../../src/installer/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAmB,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;IAgB9B;;;OAGG;WACU,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU/D;;;OAGG;WACU,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAUvE;;;;;;OAMG;WACU,OAAO,CAClB,MAAM,CAAC,EAAE,eAAe,EACxB,IAAI,GAAE,OAAO,GAAG,MAAgB,EAChC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,CAAC;IAgCzB;;OAEG;WACU,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAkCpE"}
|