daeda-mcp 1.0.0 → 1.0.1
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/README.md +5 -2
- package/dist/sync/csv-loader.js +2 -2
- package/dist/sync/export-api.js +41 -34
- package/dist/sync/init-manager.js +4 -0
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Daeda MCP
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/daeda-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
3
6
|
An MCP server that syncs your HubSpot CRM to a local encrypted database, enabling AI assistants to query your contacts, companies, and deals instantly.
|
|
4
7
|
|
|
5
8
|
## Why Daeda?
|
|
@@ -51,8 +54,8 @@ npm install -g daeda-mcp
|
|
|
51
54
|
### From source
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
|
-
git clone https://github.com/
|
|
55
|
-
cd daeda-mcp
|
|
57
|
+
git clone https://github.com/Daeda-Technologies-Ltd/daeda-free-mcp.git
|
|
58
|
+
cd daeda-free-mcp
|
|
56
59
|
npm install
|
|
57
60
|
npm run build
|
|
58
61
|
```
|
package/dist/sync/csv-loader.js
CHANGED
|
@@ -37,7 +37,7 @@ function findIdColumn(headers) {
|
|
|
37
37
|
async function loadCsvWithWorker(filePath, tableName, mapRow, insertBatch, onProgress) {
|
|
38
38
|
await clearTable(tableName);
|
|
39
39
|
return new Promise((resolve, reject) => {
|
|
40
|
-
const workerUrl = new URL("./csv-worker.
|
|
40
|
+
const workerUrl = new URL("./csv-worker.js", import.meta.url);
|
|
41
41
|
const worker = new Worker(workerUrl);
|
|
42
42
|
let idColumn = null;
|
|
43
43
|
let totalInserted = 0;
|
|
@@ -158,7 +158,7 @@ export async function loadDealsCsvFromFile(filePath, onProgress) {
|
|
|
158
158
|
export async function loadAssociationsCsvFromFile(filePath, associationType, onProgress) {
|
|
159
159
|
await clearTable(associationType);
|
|
160
160
|
return new Promise((resolve, reject) => {
|
|
161
|
-
const workerUrl = new URL("./csv-worker.
|
|
161
|
+
const workerUrl = new URL("./csv-worker.js", import.meta.url);
|
|
162
162
|
const worker = new Worker(workerUrl);
|
|
163
163
|
let idColumn = null;
|
|
164
164
|
let associatedIdColumn = null;
|
package/dist/sync/export-api.js
CHANGED
|
@@ -213,45 +213,52 @@ export async function downloadExportCsvToFile(token, downloadUrl, exportName) {
|
|
|
213
213
|
throw new Error("Response has no body");
|
|
214
214
|
}
|
|
215
215
|
await pipeline(Readable.fromWeb(response.body), createWriteStream(tempPath));
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
const writeStream = createWriteStream(outputPath);
|
|
228
|
-
for (let i = 0; i < csvEntries.length; i++) {
|
|
229
|
-
const csvContent = csvEntries[i].getData().toString("utf-8");
|
|
230
|
-
if (i === 0) {
|
|
231
|
-
writeStream.write(csvContent);
|
|
216
|
+
try {
|
|
217
|
+
const data = readFileSync(tempPath);
|
|
218
|
+
if (data[0] === 0x50 && data[1] === 0x4b) {
|
|
219
|
+
const zip = new AdmZip(tempPath);
|
|
220
|
+
const entries = zip.getEntries();
|
|
221
|
+
const csvEntries = entries
|
|
222
|
+
.filter((e) => e.entryName.endsWith(".csv"))
|
|
223
|
+
.sort((a, b) => a.entryName.localeCompare(b.entryName));
|
|
224
|
+
if (csvEntries.length === 0) {
|
|
225
|
+
throw new Error("No CSV file found in ZIP archive");
|
|
232
226
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
writeStream.write(csvContent
|
|
227
|
+
const writeStream = createWriteStream(outputPath);
|
|
228
|
+
for (let i = 0; i < csvEntries.length; i++) {
|
|
229
|
+
const csvContent = csvEntries[i].getData().toString("utf-8");
|
|
230
|
+
if (i === 0) {
|
|
231
|
+
writeStream.write(csvContent);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const firstNewline = csvContent.indexOf("\n");
|
|
235
|
+
if (firstNewline !== -1) {
|
|
236
|
+
writeStream.write("\n");
|
|
237
|
+
writeStream.write(csvContent.slice(firstNewline + 1));
|
|
238
|
+
}
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
241
|
+
await new Promise((resolve, reject) => {
|
|
242
|
+
writeStream.end((err) => {
|
|
243
|
+
if (err)
|
|
244
|
+
reject(err);
|
|
245
|
+
else
|
|
246
|
+
resolve();
|
|
247
|
+
});
|
|
247
248
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
unlinkSync(tempPath);
|
|
250
|
+
console.error(`[export-api] Extracted and concatenated ${csvEntries.length} CSV files from ZIP`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
const { renameSync } = await import("node:fs");
|
|
254
|
+
renameSync(tempPath, outputPath);
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
257
|
+
catch (err) {
|
|
258
|
+
if (existsSync(tempPath)) {
|
|
259
|
+
unlinkSync(tempPath);
|
|
260
|
+
}
|
|
261
|
+
throw err;
|
|
255
262
|
}
|
|
256
263
|
return outputPath;
|
|
257
264
|
}
|
|
@@ -172,6 +172,7 @@ async function pollOnce() {
|
|
|
172
172
|
exportState.status = "synced";
|
|
173
173
|
writeInitState(state);
|
|
174
174
|
console.error(`[init-manager] ${exportName} synced successfully`);
|
|
175
|
+
break;
|
|
175
176
|
}
|
|
176
177
|
else if (status.status === "FAILED") {
|
|
177
178
|
exportState.status = "error";
|
|
@@ -183,6 +184,9 @@ async function pollOnce() {
|
|
|
183
184
|
catch (err) {
|
|
184
185
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
185
186
|
console.error(`[init-manager] Error polling ${exportName}:`, errMsg);
|
|
187
|
+
exportState.status = "error";
|
|
188
|
+
exportState.error = errMsg;
|
|
189
|
+
writeInitState(state);
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
192
|
if (isFullySynced(state)) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daeda-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "MCP server for HubSpot CRM data sync",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Daeda-Technologies-Ltd/daeda-free-mcp.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/Daeda-Technologies-Ltd/daeda-free-mcp#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Daeda-Technologies-Ltd/daeda-free-mcp/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"hubspot",
|
|
17
|
+
"crm",
|
|
18
|
+
"ai",
|
|
19
|
+
"claude",
|
|
20
|
+
"model-context-protocol"
|
|
21
|
+
],
|
|
6
22
|
"type": "module",
|
|
7
23
|
"main": "./dist/index.js",
|
|
8
24
|
"bin": {
|