airweave-mcp-search 0.6.49 ā 0.6.51
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/build/api/airweave-client.d.ts +0 -1
- package/build/api/airweave-client.d.ts.map +1 -1
- package/build/api/airweave-client.js +12 -33
- package/build/api/airweave-client.js.map +1 -1
- package/build/index-http.d.ts +10 -0
- package/build/index-http.d.ts.map +1 -1
- package/build/index-http.js +194 -76
- package/build/index-http.js.map +1 -1
- package/package.json +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"airweave-client.d.ts","sourceRoot":"","sources":["../../src/api/airweave-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5D,qBAAa,cAAc;IAGX,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,MAAM,CAAoB;gBAEd,MAAM,EAAE,cAAc;IAOpC,MAAM,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"airweave-client.d.ts","sourceRoot":"","sources":["../../src/api/airweave-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5D,qBAAa,cAAc;IAGX,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,MAAM,CAAoB;gBAEd,MAAM,EAAE,cAAc;IAOpC,MAAM,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;IA2BzD,OAAO,CAAC,eAAe;CA8C1B"}
|
|
@@ -11,54 +11,36 @@ export class AirweaveClient {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
async search(searchRequest) {
|
|
14
|
+
console.log(`[${new Date().toISOString()}] AirweaveClient.search called with:`, JSON.stringify(searchRequest, null, 2));
|
|
14
15
|
// Mock mode for testing
|
|
15
16
|
if (this.config.apiKey === 'test-key' && this.config.baseUrl.includes('localhost')) {
|
|
16
17
|
return this.getMockResponse(searchRequest);
|
|
17
18
|
}
|
|
18
19
|
try {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
// Use the official SDK for basic search
|
|
28
|
-
const { query, response_type, limit, offset, recency_bias } = searchRequest;
|
|
29
|
-
const response = await this.client.collections.search(this.config.collection, {
|
|
30
|
-
query,
|
|
31
|
-
response_type,
|
|
32
|
-
limit,
|
|
33
|
-
offset,
|
|
34
|
-
recency_bias
|
|
35
|
-
});
|
|
36
|
-
return response;
|
|
37
|
-
}
|
|
20
|
+
// Use the SDK's search method - it handles both basic and advanced parameters
|
|
21
|
+
// The SDK will automatically use GET for basic params and POST for advanced
|
|
22
|
+
console.log(`[${new Date().toISOString()}] Calling SDK search with all params`);
|
|
23
|
+
const response = await this.client.collections.search(this.config.collection, searchRequest);
|
|
24
|
+
console.log(`[${new Date().toISOString()}] Search successful, got ${response.results?.length || 0} results`);
|
|
25
|
+
return response;
|
|
38
26
|
}
|
|
39
27
|
catch (error) {
|
|
40
28
|
// Handle SDK errors and convert to our error format
|
|
29
|
+
console.error(`[${new Date().toISOString()}] Search error:`, error);
|
|
41
30
|
if (error.statusCode) {
|
|
42
|
-
|
|
31
|
+
const errorBody = typeof error.body === 'string' ? error.body : JSON.stringify(error.body);
|
|
32
|
+
throw new Error(`Airweave API error (${error.statusCode}): ${error.message}\nStatus code: ${error.statusCode}\nBody: ${errorBody}`);
|
|
43
33
|
}
|
|
44
34
|
else {
|
|
45
|
-
throw new Error(`Airweave API error: ${error.message}`);
|
|
35
|
+
throw new Error(`Airweave API error: ${error.message || 'Unknown error'}`);
|
|
46
36
|
}
|
|
47
37
|
}
|
|
48
38
|
}
|
|
49
|
-
hasAdvancedParameters(params) {
|
|
50
|
-
return !!(params.score_threshold !== undefined ||
|
|
51
|
-
params.search_method !== undefined ||
|
|
52
|
-
params.expansion_strategy !== undefined ||
|
|
53
|
-
params.enable_reranking !== undefined ||
|
|
54
|
-
params.enable_query_interpretation !== undefined);
|
|
55
|
-
}
|
|
56
39
|
getMockResponse(request) {
|
|
57
40
|
const { query, response_type, limit, offset, recency_bias, score_threshold, search_method, expansion_strategy, enable_reranking, enable_query_interpretation } = request;
|
|
58
41
|
// Generate mock results based on the query
|
|
59
42
|
const mockResults = [];
|
|
60
43
|
const resultCount = Math.min(limit || 100, 5); // Limit to 5 for testing
|
|
61
|
-
const hasAdvancedParams = this.hasAdvancedParameters(request);
|
|
62
44
|
for (let i = 0; i < resultCount; i++) {
|
|
63
45
|
const score = 0.95 - (i * 0.1);
|
|
64
46
|
// Apply score threshold if specified
|
|
@@ -83,16 +65,13 @@ export class AirweaveClient {
|
|
|
83
65
|
search_method: search_method,
|
|
84
66
|
expansion_strategy: expansion_strategy,
|
|
85
67
|
enable_reranking: enable_reranking,
|
|
86
|
-
enable_query_interpretation: enable_query_interpretation
|
|
87
|
-
used_advanced_search: hasAdvancedParams
|
|
68
|
+
enable_query_interpretation: enable_query_interpretation
|
|
88
69
|
}
|
|
89
70
|
}
|
|
90
71
|
});
|
|
91
72
|
}
|
|
92
73
|
return {
|
|
93
74
|
results: mockResults,
|
|
94
|
-
response_type: response_type || "raw",
|
|
95
|
-
status: "success",
|
|
96
75
|
completion: response_type === "completion"
|
|
97
76
|
? `Based on the search results for "${query}", here's a comprehensive summary of the findings...`
|
|
98
77
|
: undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"airweave-client.js","sourceRoot":"","sources":["../../src/api/airweave-client.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,MAAM,OAAO,cAAc;IAGH;IAFZ,MAAM,CAAoB;IAElC,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QACtC,IAAI,CAAC,MA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;qBAC3D;iBACJ;aACJ,CAAC,CAAC;QACP,CAAC;QAED,OAAO;YACH,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,aAAa,KAAK,YAAY;gBACtC,CAAC,CAAC,oCAAoC,KAAK,sDAAsD;gBACjG,CAAC,CAAC,SAAS;SAClB,CAAC;IACN,CAAC;CACJ"}
|
package/build/index-http.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Airweave MCP Server - HTTP/Streamable Transport
|
|
4
|
+
*
|
|
5
|
+
* This is the production HTTP server for cloud-based AI platforms like OpenAI Agent Builder.
|
|
6
|
+
* Uses the modern Streamable HTTP transport (MCP 2025-03-26) instead of deprecated SSE.
|
|
7
|
+
*
|
|
8
|
+
* Endpoint: https://mcp.airweave.ai/mcp
|
|
9
|
+
* Protocol: MCP 2025-03-26 (Streamable HTTP)
|
|
10
|
+
* Authentication: Bearer token, X-API-Key, or query parameter
|
|
11
|
+
*/
|
|
2
12
|
export {};
|
|
3
13
|
//# sourceMappingURL=index-http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-http.d.ts","sourceRoot":"","sources":["../src/index-http.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index-http.d.ts","sourceRoot":"","sources":["../src/index-http.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG"}
|
package/build/index-http.js
CHANGED
|
@@ -1,35 +1,75 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Airweave MCP Server - HTTP/Streamable Transport
|
|
4
|
+
*
|
|
5
|
+
* This is the production HTTP server for cloud-based AI platforms like OpenAI Agent Builder.
|
|
6
|
+
* Uses the modern Streamable HTTP transport (MCP 2025-03-26) instead of deprecated SSE.
|
|
7
|
+
*
|
|
8
|
+
* Endpoint: https://mcp.airweave.ai/mcp
|
|
9
|
+
* Protocol: MCP 2025-03-26 (Streamable HTTP)
|
|
10
|
+
* Authentication: Bearer token, X-API-Key, or query parameter
|
|
11
|
+
*/
|
|
12
|
+
import express from 'express';
|
|
13
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
14
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
15
|
+
import { AirweaveClient } from './api/airweave-client.js';
|
|
16
|
+
import { createSearchTool } from './tools/search-tool.js';
|
|
17
|
+
import { createConfigTool } from './tools/config-tool.js';
|
|
13
18
|
const app = express();
|
|
19
|
+
app.use(express.json({ limit: '10mb' }));
|
|
20
|
+
// Create MCP server instance with tools
|
|
21
|
+
const createMcpServer = (apiKey) => {
|
|
22
|
+
const collection = process.env.AIRWEAVE_COLLECTION || 'default';
|
|
23
|
+
const baseUrl = process.env.AIRWEAVE_BASE_URL || 'https://api.airweave.ai';
|
|
24
|
+
const config = {
|
|
25
|
+
collection,
|
|
26
|
+
baseUrl,
|
|
27
|
+
apiKey // Use the provided API key from the request
|
|
28
|
+
};
|
|
29
|
+
const server = new McpServer({
|
|
30
|
+
name: 'airweave-search',
|
|
31
|
+
version: '2.1.0',
|
|
32
|
+
}, {
|
|
33
|
+
capabilities: {
|
|
34
|
+
tools: {},
|
|
35
|
+
logging: {}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// Create dynamic tool name based on collection
|
|
39
|
+
const toolName = `search-${collection}`;
|
|
40
|
+
// Initialize Airweave client with the request's API key
|
|
41
|
+
const airweaveClient = new AirweaveClient(config);
|
|
42
|
+
// Create tools using shared tool creation functions
|
|
43
|
+
const searchTool = createSearchTool(toolName, collection, airweaveClient);
|
|
44
|
+
const configTool = createConfigTool(toolName, collection, baseUrl, apiKey);
|
|
45
|
+
// Register tools
|
|
46
|
+
server.tool(searchTool.name, searchTool.description, searchTool.schema, searchTool.handler);
|
|
47
|
+
server.tool(configTool.name, configTool.description, configTool.schema, configTool.handler);
|
|
48
|
+
return server;
|
|
49
|
+
};
|
|
14
50
|
// Health check endpoint
|
|
15
|
-
app.get(
|
|
51
|
+
app.get('/health', (req, res) => {
|
|
16
52
|
res.json({
|
|
17
|
-
status:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
53
|
+
status: 'healthy',
|
|
54
|
+
transport: 'streamable-http',
|
|
55
|
+
protocol: 'MCP 2025-03-26',
|
|
56
|
+
collection: process.env.AIRWEAVE_COLLECTION || 'unknown',
|
|
57
|
+
timestamp: new Date().toISOString()
|
|
21
58
|
});
|
|
22
59
|
});
|
|
23
60
|
// Root endpoint with server info
|
|
24
|
-
app.get(
|
|
61
|
+
app.get('/', (req, res) => {
|
|
62
|
+
const collection = process.env.AIRWEAVE_COLLECTION || 'default';
|
|
63
|
+
const baseUrl = process.env.AIRWEAVE_BASE_URL || 'https://api.airweave.ai';
|
|
25
64
|
res.json({
|
|
26
65
|
name: "Airweave MCP Search Server",
|
|
27
66
|
version: "2.1.0",
|
|
28
|
-
|
|
29
|
-
|
|
67
|
+
transport: "Streamable HTTP",
|
|
68
|
+
protocol: "MCP 2025-03-26",
|
|
69
|
+
collection: collection,
|
|
30
70
|
endpoints: {
|
|
31
71
|
health: "/health",
|
|
32
|
-
|
|
72
|
+
mcp: "/mcp"
|
|
33
73
|
},
|
|
34
74
|
authentication: {
|
|
35
75
|
required: true,
|
|
@@ -40,74 +80,152 @@ app.get("/", (_req, res) => {
|
|
|
40
80
|
"Query parameter: ?api_key=your-key"
|
|
41
81
|
],
|
|
42
82
|
openai_agent_builder: {
|
|
43
|
-
url: "https://mcp.
|
|
83
|
+
url: "https://mcp.airweave.ai/mcp",
|
|
44
84
|
headers: {
|
|
45
85
|
Authorization: "Bearer <your-airweave-api-key>"
|
|
46
86
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
},
|
|
87
|
+
}
|
|
88
|
+
}
|
|
50
89
|
});
|
|
51
90
|
});
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
req.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
// Session management: Map session IDs to { server, transport, apiKey }
|
|
92
|
+
const sessions = new Map();
|
|
93
|
+
// Main MCP endpoint (Streamable HTTP)
|
|
94
|
+
app.post('/mcp', async (req, res) => {
|
|
95
|
+
try {
|
|
96
|
+
// Extract API key from request headers or query parameters
|
|
97
|
+
const apiKey = req.headers['x-api-key'] ||
|
|
98
|
+
req.headers['authorization']?.replace('Bearer ', '') ||
|
|
99
|
+
req.query.apiKey ||
|
|
100
|
+
req.query.api_key;
|
|
101
|
+
if (!apiKey) {
|
|
102
|
+
res.status(401).json({
|
|
103
|
+
jsonrpc: '2.0',
|
|
104
|
+
error: {
|
|
105
|
+
code: -32001,
|
|
106
|
+
message: 'Authentication required',
|
|
107
|
+
data: 'Please provide an API key via X-API-Key header, Authorization header, or apiKey query parameter'
|
|
108
|
+
},
|
|
109
|
+
id: req.body.id || null
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// Get or create session ID from MCP-Session-ID header
|
|
114
|
+
const sessionId = req.headers['mcp-session-id'] || `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
115
|
+
// Check if we have an existing session
|
|
116
|
+
let session = sessions.get(sessionId);
|
|
117
|
+
if (!session) {
|
|
118
|
+
console.log(`[${new Date().toISOString()}] Creating new session: ${sessionId}`);
|
|
119
|
+
// Create a new server with the API key
|
|
120
|
+
const server = createMcpServer(apiKey);
|
|
121
|
+
// Create a new transport for this session
|
|
122
|
+
const transport = new StreamableHTTPServerTransport({
|
|
123
|
+
sessionIdGenerator: () => sessionId
|
|
124
|
+
});
|
|
125
|
+
// Set up session management callbacks
|
|
126
|
+
transport.onsessioninitialized = (sid) => {
|
|
127
|
+
console.log(`[${new Date().toISOString()}] Session initialized: ${sid}`);
|
|
128
|
+
};
|
|
129
|
+
// Set up cleanup on close
|
|
130
|
+
transport.onclose = () => {
|
|
131
|
+
console.log(`[${new Date().toISOString()}] Session closed: ${sessionId}`);
|
|
132
|
+
sessions.delete(sessionId);
|
|
133
|
+
};
|
|
134
|
+
// Connect the transport to the server
|
|
135
|
+
await server.connect(transport);
|
|
136
|
+
// Store the session
|
|
137
|
+
session = { server, transport, apiKey: apiKey };
|
|
138
|
+
sessions.set(sessionId, session);
|
|
139
|
+
}
|
|
140
|
+
else if (session.apiKey !== apiKey) {
|
|
141
|
+
// API key changed - recreate session
|
|
142
|
+
console.log(`[${new Date().toISOString()}] API key changed for session ${sessionId}, recreating...`);
|
|
143
|
+
session.transport.close();
|
|
144
|
+
sessions.delete(sessionId);
|
|
145
|
+
// Create new session with new API key
|
|
146
|
+
const server = createMcpServer(apiKey);
|
|
147
|
+
const transport = new StreamableHTTPServerTransport({
|
|
148
|
+
sessionIdGenerator: () => sessionId
|
|
149
|
+
});
|
|
150
|
+
await server.connect(transport);
|
|
151
|
+
session = { server, transport, apiKey: apiKey };
|
|
152
|
+
sessions.set(sessionId, session);
|
|
153
|
+
}
|
|
154
|
+
// Handle the request with the session's transport
|
|
155
|
+
await session.transport.handleRequest(req, res, req.body);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.error(`[${new Date().toISOString()}] Error handling MCP request:`, error);
|
|
159
|
+
if (!res.headersSent) {
|
|
160
|
+
res.status(500).json({
|
|
161
|
+
jsonrpc: '2.0',
|
|
162
|
+
error: {
|
|
163
|
+
code: -32603,
|
|
164
|
+
message: 'Internal server error',
|
|
165
|
+
},
|
|
166
|
+
id: req.body.id || null
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
// DELETE endpoint for session termination
|
|
172
|
+
app.delete('/mcp', (req, res) => {
|
|
173
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
174
|
+
if (!sessionId) {
|
|
175
|
+
res.status(400).json({
|
|
176
|
+
jsonrpc: '2.0',
|
|
177
|
+
error: {
|
|
178
|
+
code: -32000,
|
|
179
|
+
message: 'Bad Request: No session ID provided',
|
|
180
|
+
},
|
|
181
|
+
id: null
|
|
65
182
|
});
|
|
66
183
|
return;
|
|
67
184
|
}
|
|
68
|
-
//
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
req.on("close", () => {
|
|
82
|
-
console.error(`[${new Date().toISOString()}] SSE connection closed`);
|
|
185
|
+
// Close the session if it exists
|
|
186
|
+
const session = sessions.get(sessionId);
|
|
187
|
+
if (session) {
|
|
188
|
+
console.log(`[${new Date().toISOString()}] Terminating session: ${sessionId}`);
|
|
189
|
+
session.transport.close();
|
|
190
|
+
sessions.delete(sessionId);
|
|
191
|
+
}
|
|
192
|
+
res.status(200).json({
|
|
193
|
+
jsonrpc: '2.0',
|
|
194
|
+
result: {
|
|
195
|
+
message: session ? 'Session terminated successfully' : 'Session not found (may have already been closed)'
|
|
196
|
+
},
|
|
197
|
+
id: null
|
|
83
198
|
});
|
|
84
199
|
});
|
|
85
|
-
// POST endpoint for client messages (required by SSE transport)
|
|
86
|
-
app.post("/message", express.json(), async (req, res) => {
|
|
87
|
-
// The SSE transport handles this internally
|
|
88
|
-
// This endpoint is registered but the actual handling is done by the transport
|
|
89
|
-
res.status(200).send();
|
|
90
|
-
});
|
|
91
200
|
// Error handling middleware
|
|
92
|
-
app.use((
|
|
93
|
-
console.error(
|
|
94
|
-
res.
|
|
201
|
+
app.use((error, req, res, next) => {
|
|
202
|
+
console.error(`[${new Date().toISOString()}] Unhandled error:`, error);
|
|
203
|
+
if (!res.headersSent) {
|
|
204
|
+
res.status(500).json({
|
|
205
|
+
jsonrpc: '2.0',
|
|
206
|
+
error: {
|
|
207
|
+
code: -32603,
|
|
208
|
+
message: 'Internal server error',
|
|
209
|
+
},
|
|
210
|
+
id: null
|
|
211
|
+
});
|
|
212
|
+
}
|
|
95
213
|
});
|
|
96
|
-
// Start
|
|
214
|
+
// Start server
|
|
215
|
+
const PORT = process.env.PORT || 8080;
|
|
97
216
|
app.listen(PORT, () => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.
|
|
101
|
-
console.
|
|
102
|
-
console.
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
console.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
console.
|
|
111
|
-
process.exit(0);
|
|
217
|
+
const collection = process.env.AIRWEAVE_COLLECTION || 'default';
|
|
218
|
+
const baseUrl = process.env.AIRWEAVE_BASE_URL || 'https://api.airweave.ai';
|
|
219
|
+
console.log(`š Airweave MCP Search Server (Streamable HTTP) started`);
|
|
220
|
+
console.log(`š” Protocol: MCP 2025-03-26`);
|
|
221
|
+
console.log(`š Endpoint: http://localhost:${PORT}/mcp`);
|
|
222
|
+
console.log(`š„ Health: http://localhost:${PORT}/health`);
|
|
223
|
+
console.log(`š Info: http://localhost:${PORT}/`);
|
|
224
|
+
console.log(`š Collection: ${collection}`);
|
|
225
|
+
console.log(`š Base URL: ${baseUrl}`);
|
|
226
|
+
console.log(`\nš Authentication required: Provide your Airweave API key via:`);
|
|
227
|
+
console.log(` - Authorization: Bearer <your-api-key>`);
|
|
228
|
+
console.log(` - X-API-Key: <your-api-key>`);
|
|
229
|
+
console.log(` - Query parameter: ?apiKey=your-key`);
|
|
112
230
|
});
|
|
113
231
|
//# sourceMappingURL=index-http.js.map
|
package/build/index-http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-http.js","sourceRoot":"","sources":["../src/index-http.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index-http.js","sourceRoot":"","sources":["../src/index-http.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AACtB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAEzC,wCAAwC;AACxC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,SAAS,CAAC;IAChE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,yBAAyB,CAAC;IAE3E,MAAM,MAAM,GAAG;QACX,UAAU;QACV,OAAO;QACP,MAAM,CAAC,4CAA4C;KACtD,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QACzB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,OAAO;KACnB,EAAE;QACC,YAAY,EAAE;YACV,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;SACd;KACJ,CAAC,CAAC;IAEH,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,UAAU,UAAU,EAAE,CAAC;IAExC,wDAAwD;IACxD,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IAElD,oDAAoD;IACpD,MAAM,UA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@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airweave-mcp-search",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.51",
|
|
4
4
|
"description": "MCP server for searching Airweave collections",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"test": "vitest run",
|
|
17
17
|
"test:watch": "vitest",
|
|
18
18
|
"test:coverage": "vitest run --coverage",
|
|
19
|
-
"test:
|
|
20
|
-
"test:
|
|
21
|
-
"test:
|
|
19
|
+
"test:mcp": "vitest run tests/mcp-server.test.ts",
|
|
20
|
+
"test:http": "vitest run tests/http-transport.test.ts",
|
|
21
|
+
"test:all": "npm run test:mcp && npm run test:http",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"node": ">=18.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@airweave/sdk": "^0.
|
|
49
|
+
"@airweave/sdk": "^0.6.0",
|
|
50
50
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
51
51
|
"express": "^4.18.2",
|
|
52
52
|
"zod": "^3.23.8"
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/express": "^4.17.21",
|
|
56
56
|
"@types/node": "^22.10.7",
|
|
57
|
+
"@types/supertest": "^6.0.2",
|
|
57
58
|
"@vitest/coverage-v8": "^2.0.0",
|
|
59
|
+
"supertest": "^7.0.0",
|
|
58
60
|
"typescript": "^5.7.3",
|
|
59
61
|
"vitest": "^2.0.0"
|
|
60
62
|
},
|