bach-egnyte-mcp 0.1.0 → 0.2.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/data/data.json +22 -0
- package/index.js +20 -67
- package/package.json +4 -6
package/data/data.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"documents": [
|
|
3
|
+
{
|
|
4
|
+
"id": "d1",
|
|
5
|
+
"name": "Vendor_SOW_2026.docx",
|
|
6
|
+
"path": "/Shared/Legal/Vendor_SOW_2026.docx",
|
|
7
|
+
"text": "STATEMENT OF WORK 2026. Deliverables and milestones. Payment net 30. Includes SLA of 99.9% uptime and service credits."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "d2",
|
|
11
|
+
"name": "Security_Policy.docx",
|
|
12
|
+
"path": "/Shared/IT/Security_Policy.docx",
|
|
13
|
+
"text": "INFORMATION SECURITY POLICY. Access control, encryption at rest and in transit, annual SOC 2 audit, incident response runbook."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "d3",
|
|
17
|
+
"name": "Procurement_Guidelines.docx",
|
|
18
|
+
"path": "/Shared/Ops/Procurement_Guidelines.docx",
|
|
19
|
+
"text": "PROCUREMENT GUIDELINES. Vendors over $50k require competitive bids and legal review. DPA required when personal data is processed."
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
package/index.js
CHANGED
|
@@ -2,72 +2,25 @@
|
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"required": [
|
|
18
|
-
"query"
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
"result": {
|
|
22
|
-
"results": [
|
|
23
|
-
{
|
|
24
|
-
"id": "d1",
|
|
25
|
-
"name": "Vendor_SOW_2026.docx",
|
|
26
|
-
"path": "/Shared/Legal/Vendor_SOW_2026.docx"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "get_document",
|
|
33
|
-
"description": "Get extracted text of a document",
|
|
34
|
-
"inputSchema": {
|
|
35
|
-
"type": "object",
|
|
36
|
-
"properties": {
|
|
37
|
-
"doc_id": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"required": [
|
|
42
|
-
"doc_id"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
"result": {
|
|
46
|
-
"id": "d1",
|
|
47
|
-
"name": "Vendor_SOW_2026.docx",
|
|
48
|
-
"text": "STATEMENT OF WORK ... Deliverables ... Payment: net 30 ..."
|
|
49
|
-
}
|
|
50
|
-
}
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
const DATA = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "data", "data.json"), "utf8"));
|
|
9
|
+
const WRITE = [];
|
|
10
|
+
const ACK = { };
|
|
11
|
+
function matches(row, q){ q=String(q||"").toLowerCase(); if(!q) return true; return Object.values(row).some(v=>String(v).toLowerCase().includes(q)); }
|
|
12
|
+
const TOOLS=[
|
|
13
|
+
{name:"list_collections",description:"List available data collections and item counts.",inputSchema:{type:"object",properties:{}},run:()=>({collections:Object.keys(DATA).map(c=>({collection:c,items:(DATA[c]||[]).length}))})},
|
|
14
|
+
{name:"search",description:"Full-text search within a collection (case-insensitive substring across all fields). If collection omitted, searches all.",inputSchema:{type:"object",properties:{collection:{type:"string"},query:{type:"string"}},required:["query"]},run:a=>{const cols=a.collection?[a.collection]:Object.keys(DATA);const out=[];for(const c of cols)for(const row of (DATA[c]||[]))if(matches(row,a.query))out.push({collection:c,...row});return{count:out.length,results:out};}},
|
|
15
|
+
{name:"get",description:"Get one item by id from a collection.",inputSchema:{type:"object",properties:{collection:{type:"string"},id:{type:"string"}},required:["collection","id"]},run:a=>{const row=(DATA[a.collection]||[]).find(r=>String(r.id)===String(a.id));return row?{collection:a.collection,...row}:{error:"not found"};}},
|
|
51
16
|
];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
tools: TOOLS.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })),
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
63
|
-
const tool = TOOLS.find((t) => t.name === req.params.name);
|
|
64
|
-
if (!tool) {
|
|
65
|
-
return { isError: true, content: [{ type: "text", text: "Unknown tool: " + req.params.name }] };
|
|
66
|
-
}
|
|
67
|
-
const payload = { tool: tool.name, args: req.params.arguments || {}, data: tool.result, _note: "MOCK DATA from Egnyte (mock)" };
|
|
68
|
-
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
17
|
+
const server=new Server({name:"bach-egnyte-mcp",version:"0.2.0"},{capabilities:{tools:{}}});
|
|
18
|
+
server.setRequestHandler(ListToolsRequestSchema,async()=>({tools:[...TOOLS.map(({name,description,inputSchema})=>({name,description,inputSchema})),...WRITE]}));
|
|
19
|
+
server.setRequestHandler(CallToolRequestSchema,async req=>{
|
|
20
|
+
const t=TOOLS.find(t=>t.name===req.params.name);
|
|
21
|
+
if(t){try{return{content:[{type:"text",text:JSON.stringify(t.run(req.params.arguments||{}),null,2)}]};}catch(e){return{isError:true,content:[{type:"text",text:"Error: "+e.message}]};}}
|
|
22
|
+
if(ACK[req.params.name]){const r=ACK[req.params.name](req.params.arguments||{});return{content:[{type:"text",text:JSON.stringify({...r,_note:"safe mock write, not actually performed"},null,2)}]};}
|
|
23
|
+
return{isError:true,content:[{type:"text",text:"Unknown tool: "+req.params.name}]};
|
|
69
24
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
await server.connect(transport);
|
|
73
|
-
console.error("Egnyte (mock)" + " MCP server (mock) running on stdio");
|
|
25
|
+
await server.connect(new StdioServerTransport());
|
|
26
|
+
console.error("bach-egnyte-mcp (records engine) collections: "+Object.keys(DATA).join(", "));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bach-egnyte-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Mock
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Mock egnyte MCP with a bundled sample dataset and real search/get tools (write actions are safe mocks).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bach-egnyte-mcp": "index.js"
|
|
@@ -9,18 +9,16 @@
|
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"index.js",
|
|
12
|
-
"
|
|
12
|
+
"data"
|
|
13
13
|
],
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"mcp",
|
|
19
|
-
"modelcontextprotocol",
|
|
20
19
|
"bach",
|
|
21
20
|
"bachstudio",
|
|
22
|
-
"mock"
|
|
23
|
-
"egnyte"
|
|
21
|
+
"mock"
|
|
24
22
|
],
|
|
25
23
|
"author": "bachstudio",
|
|
26
24
|
"license": "MIT",
|