@zerobuild/mcp 2.6.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 +114 -0
- package/dist/client.d.ts +79 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +137 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +171 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +164 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/channels.d.ts +4 -0
- package/dist/resources/channels.d.ts.map +1 -0
- package/dist/resources/channels.js +58 -0
- package/dist/resources/channels.js.map +1 -0
- package/dist/resources/contacts.d.ts +4 -0
- package/dist/resources/contacts.d.ts.map +1 -0
- package/dist/resources/contacts.js +73 -0
- package/dist/resources/contacts.js.map +1 -0
- package/dist/resources/conversations.d.ts +4 -0
- package/dist/resources/conversations.d.ts.map +1 -0
- package/dist/resources/conversations.js +97 -0
- package/dist/resources/conversations.js.map +1 -0
- package/dist/resources/documents.d.ts +4 -0
- package/dist/resources/documents.d.ts.map +1 -0
- package/dist/resources/documents.js +63 -0
- package/dist/resources/documents.js.map +1 -0
- package/dist/resources/search.d.ts +4 -0
- package/dist/resources/search.d.ts.map +1 -0
- package/dist/resources/search.js +44 -0
- package/dist/resources/search.js.map +1 -0
- package/dist/tools/conversations.d.ts +4 -0
- package/dist/tools/conversations.d.ts.map +1 -0
- package/dist/tools/conversations.js +124 -0
- package/dist/tools/conversations.js.map +1 -0
- package/dist/tools/documents.d.ts +4 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +75 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/messages.d.ts +4 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +31 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +37 -0
- package/dist/tools/search.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerConversationTools(server, client) {
|
|
3
|
+
server.tool("list_conversations", "List live chat conversations. Use this to find conversation IDs before taking actions on them.", {
|
|
4
|
+
status: z.enum(["open", "closed"]).optional().describe("Filter by status (default: open)"),
|
|
5
|
+
}, async ({ status }) => {
|
|
6
|
+
const result = await client.listConversations({ status: status || "open", limit: 50 });
|
|
7
|
+
const conversations = result.conversations;
|
|
8
|
+
if (conversations.length === 0) {
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: "text", text: `No ${status || "open"} conversations.` }],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const lines = conversations.map((c) => {
|
|
14
|
+
const contact = c.contact?.name || c.contact?.email || "Unknown";
|
|
15
|
+
const assigned = c.assignedAgentName || "Unassigned";
|
|
16
|
+
return `${contact} — ${c.id} (assigned: ${assigned}, status: ${c.status})`;
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
server.tool("reply_to_conversation", "Send a reply to a customer in a live chat conversation", {
|
|
23
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
24
|
+
content: z.string().max(10000).describe("Message content"),
|
|
25
|
+
}, async ({ conversationId, content }) => {
|
|
26
|
+
const msg = await client.replyToConversation(conversationId, { content });
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: `Reply sent to conversation ${conversationId}. Message ID: ${msg.id}`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
server.tool("add_internal_note", "Add an internal note to a conversation (visible only to team members)", {
|
|
37
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
38
|
+
content: z.string().describe("Note content"),
|
|
39
|
+
}, async ({ conversationId, content }) => {
|
|
40
|
+
const msg = await client.replyToConversation(conversationId, {
|
|
41
|
+
content,
|
|
42
|
+
isInternalNote: true,
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `Internal note added to conversation ${conversationId}. Message ID: ${msg.id}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
server.tool("close_conversation", "Close a live chat conversation", {
|
|
54
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
55
|
+
}, async ({ conversationId }) => {
|
|
56
|
+
await client.closeConversation(conversationId);
|
|
57
|
+
return {
|
|
58
|
+
content: [
|
|
59
|
+
{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: `Conversation ${conversationId} closed.`,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
server.tool("assign_conversation", "Assign a conversation to a team member, or unassign by passing null", {
|
|
67
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
68
|
+
userId: z
|
|
69
|
+
.string()
|
|
70
|
+
.uuid()
|
|
71
|
+
.nullable()
|
|
72
|
+
.describe("User UUID to assign to, or null to unassign"),
|
|
73
|
+
}, async ({ conversationId, userId }) => {
|
|
74
|
+
await client.assignConversation(conversationId, userId);
|
|
75
|
+
const action = userId ? `assigned to ${userId}` : "unassigned";
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: `Conversation ${conversationId} ${action}.`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
server.tool("transfer_conversation", "Transfer a conversation to another agent with an optional handoff note", {
|
|
86
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
87
|
+
targetUserId: z.string().uuid().describe("User UUID to transfer to"),
|
|
88
|
+
note: z.string().optional().describe("Handoff note for the receiving agent"),
|
|
89
|
+
}, async ({ conversationId, targetUserId, note }) => {
|
|
90
|
+
await client.transferConversation(conversationId, {
|
|
91
|
+
targetUserId,
|
|
92
|
+
note,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: "text",
|
|
98
|
+
text: `Conversation ${conversationId} transferred to ${targetUserId}.`,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
server.tool("tag_conversation", "Add or remove a tag from a conversation", {
|
|
104
|
+
conversationId: z.string().uuid().describe("Conversation UUID"),
|
|
105
|
+
tagId: z.string().uuid().describe("Tag UUID"),
|
|
106
|
+
action: z.enum(["add", "remove"]).describe("Whether to add or remove the tag"),
|
|
107
|
+
}, async ({ conversationId, tagId, action }) => {
|
|
108
|
+
if (action === "add") {
|
|
109
|
+
await client.addTagToConversation(conversationId, tagId);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
await client.removeTagFromConversation(conversationId, tagId);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: "text",
|
|
118
|
+
text: `Tag ${tagId} ${action === "add" ? "added to" : "removed from"} conversation ${conversationId}.`,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,yBAAyB,CACvC,MAAiB,EACjB,MAAuB;IAEvB,MA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C;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiBpD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,QAmExB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Convert plain text to minimal TipTap JSON.
|
|
4
|
+
* Splits on double newlines into paragraphs.
|
|
5
|
+
*/
|
|
6
|
+
function textToTipTap(text) {
|
|
7
|
+
const paragraphs = text.split(/\n\n+/).filter(Boolean);
|
|
8
|
+
return {
|
|
9
|
+
type: "doc",
|
|
10
|
+
content: paragraphs.map((p) => ({
|
|
11
|
+
type: "paragraph",
|
|
12
|
+
content: [{ type: "text", text: p.trim() }],
|
|
13
|
+
})),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function registerDocumentTools(server, client) {
|
|
17
|
+
server.tool("create_document", "Create a new document or folder", {
|
|
18
|
+
title: z.string().min(1).max(500).describe("Document title"),
|
|
19
|
+
content: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Plain text content (auto-converted to rich text format)"),
|
|
23
|
+
parentId: z
|
|
24
|
+
.string()
|
|
25
|
+
.uuid()
|
|
26
|
+
.nullable()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Parent folder UUID, or null for root"),
|
|
29
|
+
isFolder: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Create a folder instead of a document"),
|
|
33
|
+
}, async ({ title, content, parentId, isFolder }) => {
|
|
34
|
+
const body = { title };
|
|
35
|
+
if (content)
|
|
36
|
+
body.content = textToTipTap(content);
|
|
37
|
+
if (parentId !== undefined)
|
|
38
|
+
body.parentId = parentId;
|
|
39
|
+
if (isFolder)
|
|
40
|
+
body.isFolder = true;
|
|
41
|
+
const doc = await client.createDocument(body);
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: "text",
|
|
46
|
+
text: `${isFolder ? "Folder" : "Document"} created: "${doc.title}" (${doc.id})`,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
server.tool("update_document", "Update a document's title or content", {
|
|
52
|
+
documentId: z.string().uuid().describe("Document UUID"),
|
|
53
|
+
title: z.string().min(1).max(500).optional().describe("New title"),
|
|
54
|
+
content: z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("New plain text content (auto-converted to rich text format)"),
|
|
58
|
+
}, async ({ documentId, title, content }) => {
|
|
59
|
+
const body = {};
|
|
60
|
+
if (title)
|
|
61
|
+
body.title = title;
|
|
62
|
+
if (content)
|
|
63
|
+
body.content = textToTipTap(content);
|
|
64
|
+
const doc = await client.updateDocument(documentId, body);
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: `Document updated: "${doc.title}" (${doc.id})`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvD,OAAO;QACL,IAAI,EAA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"messages.d.ts","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,QA6CxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerMessageTools(server, client) {
|
|
3
|
+
server.tool("list_channels", "List all team chat channels with their IDs. Use this to find channel IDs before sending messages.", {}, async () => {
|
|
4
|
+
const channels = await client.listChannels();
|
|
5
|
+
const list = Array.isArray(channels) ? channels : [];
|
|
6
|
+
if (list.length === 0) {
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: "text", text: "No channels found." }],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const lines = list.map((ch) => `#${ch.name} — ${ch.id}${ch.description ? ` (${ch.description})` : ""}`);
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
server.tool("send_message", "Send a message to a team chat channel. Use list_channels first to find the channel ID.", {
|
|
17
|
+
channelId: z.string().uuid().describe("Channel UUID"),
|
|
18
|
+
content: z.string().max(10000).describe("Message content"),
|
|
19
|
+
}, async ({ channelId, content }) => {
|
|
20
|
+
const msg = await client.sendChannelMessage(channelId, { content });
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: `Message sent to channel ${channelId}. Message ID: ${msg.id}`,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources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ACD,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACpE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,2BAA2B,SAAS,iBAAiB,GAAG,CAAC,EAAE,EAAE;iBACpE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,QAyCxB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerSearchTool(server, client) {
|
|
3
|
+
server.tool("search", "Search across messages, documents, contacts, and people", {
|
|
4
|
+
query: z.string().min(2).max(200).describe("Search query"),
|
|
5
|
+
type: z
|
|
6
|
+
.enum(["all", "messages", "docs", "contacts", "people"])
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Filter by content type (default: all)"),
|
|
9
|
+
limit: z
|
|
10
|
+
.number()
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(50)
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Max results (default: 20)"),
|
|
15
|
+
}, async ({ query, type, limit }) => {
|
|
16
|
+
const result = await client.search({ q: query, type, limit });
|
|
17
|
+
const results = result.results || [];
|
|
18
|
+
const lines = [`Search results for "${query}": ${result.total || results.length} found.\n`];
|
|
19
|
+
for (const r of results) {
|
|
20
|
+
lines.push(`[${r.type}] ${r.title || r.id}`);
|
|
21
|
+
if (r.snippet)
|
|
22
|
+
lines.push(` ${r.snippet}`);
|
|
23
|
+
if (r.authorName)
|
|
24
|
+
lines.push(` by ${r.authorName}`);
|
|
25
|
+
lines.push("");
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: lines.join("\n") || "No results found.",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,MAAuB;IAEvB,MAAM,CAAC,IAAI,CACT,QAAQ,EACR,yDAAyD,EACzD;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC1D,IAAI,EAAE,CAAC;aACJ,IAAI,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;aACvD,QAAQ,EAAE;aACV,QAAQ,CAAC,uCAAuC,CAAC;QACpD,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aACV,QAAQ,CAAC,2BAA2B,CAAC;KACzC,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QAErC,MAAM,KAAK,GAAG,CAAC,uBAAuB,KAAK,MAAM,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;QAE5F,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7C,IAAI,CAAC,CAAC,OAAO;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5C,IAAI,CAAC,CAAC,UAAU;gBAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,mBAAmB;iBAC9C;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zerobuild/mcp",
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "MCP server for Zerobuild — connect AI agents to your workspace",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"zerobuild-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"zerobuild",
|
|
20
|
+
"ai",
|
|
21
|
+
"claude",
|
|
22
|
+
"cursor"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "tsx watch src/index.ts",
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"start": "node dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
31
|
+
"zod": "^3.24.4"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tsx": "^4.19.4",
|
|
35
|
+
"typescript": "^5.7.3"
|
|
36
|
+
}
|
|
37
|
+
}
|