Junaidb commited on
Commit
3f7882d
·
verified ·
1 Parent(s): b421dad

Create algoliaops.js

Browse files
Files changed (1) hide show
  1. algoliaops.js +37 -0
algoliaops.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { algoliasearch } from "algoliasearch";
2
+ import fs from "fs"
3
+
4
+ const aclient = algoliasearch('D79SNO8B1R', '5e28f0f65380b998763c5251289f6d9b');
5
+
6
+
7
+
8
+ export async function SavetoAlgolia(raw){
9
+
10
+
11
+ //const raw = fs.readFileSync("./package.json","utf8");
12
+ const pkg = JSON.parse(raw);
13
+
14
+ const meta = {
15
+
16
+ name: pkg.name,
17
+ description: pkg.description,
18
+ author: pkg.author,
19
+ license: pkg.license,
20
+ version: pkg.version,
21
+ readme:`ihub op clone <mcp server name>`
22
+ };
23
+
24
+
25
+ let algolia_insertion=await aclient.saveObject({
26
+ indexName: 'mcp',
27
+ body: meta
28
+ });
29
+ if(algolia_insertion.taskID){
30
+
31
+ return true
32
+ }
33
+ else {
34
+ return false
35
+ }
36
+
37
+ }