social-mcp 1.2.0 → 1.2.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 +1 -1
- package/dist/index.js +1 -1
- package/dist/services/slack-service.js +9 -17
- package/dist/services/slack-service.js.map +1 -1
- package/dist/services/whatsapp-service.d.ts +8 -0
- package/dist/services/whatsapp-service.js +16 -39
- package/dist/services/whatsapp-service.js.map +1 -1
- package/dist/tools/instagram-tools/create-post.js +1 -2
- package/dist/tools/instagram-tools/create-post.js.map +1 -1
- package/dist/tools/telegram-tools/get-channel-members.d.ts +1 -1
- package/dist/tools/telegram-tools/get-channel-members.js +4 -4
- package/dist/tools/telegram-tools/get-channel-members.js.map +1 -1
- package/dist/tools/whatsapp-tools/get-messages.js +0 -14
- package/dist/tools/whatsapp-tools/get-messages.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ An MCP (Model Context Protocol) server that lets AI assistants post and interact
|
|
|
6
6
|
|
|
7
7
|
| Platform | Tools |
|
|
8
8
|
|-----------|-------|
|
|
9
|
-
| Telegram | Send message, get channel info, forward message, pin message, get channel
|
|
9
|
+
| Telegram | Send message, get channel info, forward message, pin message, get channel administrators |
|
|
10
10
|
| Twitter/X | Send tweet, get user info, search tweets |
|
|
11
11
|
| Discord | Send message |
|
|
12
12
|
| WhatsApp | Send message, get messages |
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { sendMessageTool as slackSendMessageTool } from "./tools/slack-tools/sen
|
|
|
22
22
|
async function main() {
|
|
23
23
|
const server = new FastMCP({
|
|
24
24
|
name: "Social MCP Server",
|
|
25
|
-
version: "1.
|
|
25
|
+
version: "1.2.0",
|
|
26
26
|
});
|
|
27
27
|
// Add Telegram tools
|
|
28
28
|
server.addTool(sendMessageTool);
|
|
@@ -9,23 +9,15 @@ export class SlackService {
|
|
|
9
9
|
this.web = new WebClient(token);
|
|
10
10
|
}
|
|
11
11
|
async sendMessage(channelId, text) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
channelId: result.channel,
|
|
22
|
-
text: text,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
console.error("Error sending Slack message:", error);
|
|
27
|
-
throw error; // Re-throw to be caught by the tool's execute function
|
|
28
|
-
}
|
|
12
|
+
const result = await this.web.chat.postMessage({
|
|
13
|
+
channel: channelId,
|
|
14
|
+
text: text,
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
messageId: result.ts,
|
|
18
|
+
channelId: result.channel,
|
|
19
|
+
text: text,
|
|
20
|
+
};
|
|
29
21
|
}
|
|
30
22
|
}
|
|
31
23
|
//# sourceMappingURL=slack-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-service.js","sourceRoot":"","sources":["../../src/services/slack-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,YAAY;IAChB,GAAG,CAAY;IAEvB;QACC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACd,yFAAyF,CACzF,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,IAAY;QAChD,
|
|
1
|
+
{"version":3,"file":"slack-service.js","sourceRoot":"","sources":["../../src/services/slack-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,YAAY;IAChB,GAAG,CAAY;IAEvB;QACC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACd,yFAAyF,CACzF,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,IAAY;QAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;YAC9C,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;QAEH,OAAO;YACN,SAAS,EAAE,MAAM,CAAC,EAAE;YACpB,SAAS,EAAE,MAAM,CAAC,OAAO;YACzB,IAAI,EAAE,IAAI;SACV,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const whatsappMessageDetailSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
from: z.ZodString;
|
|
5
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
body: z.ZodString;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
1
9
|
export declare class WhatsappService {
|
|
2
10
|
private baseUrl;
|
|
3
11
|
private headers;
|
|
@@ -6,14 +6,11 @@ const whatsappMessageSchema = z.object({
|
|
|
6
6
|
contacts: z.array(z.object({ input: z.string(), wa_id: z.string() })),
|
|
7
7
|
messages: z.array(z.object({ id: z.string() })),
|
|
8
8
|
});
|
|
9
|
-
|
|
10
|
-
const whatsappMessageDetailSchema = z.object({
|
|
9
|
+
export const whatsappMessageDetailSchema = z.object({
|
|
11
10
|
id: z.string().describe("The unique ID of the message"),
|
|
12
11
|
from: z.string().describe("The sender's phone number"),
|
|
13
12
|
text: z.object({ body: z.string() }).optional().describe("The message text content"),
|
|
14
|
-
// Add other relevant fields if available from the API, e.g., timestamp, type, etc.
|
|
15
13
|
});
|
|
16
|
-
// Define a schema for the list of messages response
|
|
17
14
|
const getMessagesResponseSchema = z.object({
|
|
18
15
|
data: z.array(whatsappMessageDetailSchema),
|
|
19
16
|
});
|
|
@@ -27,46 +24,26 @@ export class WhatsappService {
|
|
|
27
24
|
if (!to || !text) {
|
|
28
25
|
throw new Error("Both 'to' and 'text' parameters are required");
|
|
29
26
|
}
|
|
30
|
-
// Validate phone number format (basic validation)
|
|
31
27
|
if (!/^\+?[1-9]\d{1,14}$/.test(to)) {
|
|
32
28
|
throw new Error("Invalid phone number format");
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, whatsappMessageSchema);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error("Error sending WhatsApp message:", error);
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
30
|
+
const body = {
|
|
31
|
+
messaging_product: "whatsapp",
|
|
32
|
+
to,
|
|
33
|
+
type: "text",
|
|
34
|
+
text: { body: text },
|
|
35
|
+
};
|
|
36
|
+
return fetchJson(`${this.baseUrl}/me/messages`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: this.headers,
|
|
39
|
+
body: JSON.stringify(body),
|
|
40
|
+
}, whatsappMessageSchema);
|
|
51
41
|
}
|
|
52
|
-
// Method to fetch recent messages
|
|
53
42
|
async getMessages(limit = 10) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
const response = await fetchJson(`${this.baseUrl}/me/messages?limit=${limit}`, // Placeholder endpoint
|
|
60
|
-
{
|
|
61
|
-
method: "GET",
|
|
62
|
-
headers: this.headers,
|
|
63
|
-
}, getMessagesResponseSchema);
|
|
64
|
-
return response;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error("Error fetching WhatsApp messages:", error);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
43
|
+
return fetchJson(`${this.baseUrl}/me/messages?limit=${limit}`, {
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: this.headers,
|
|
46
|
+
}, getMessagesResponseSchema);
|
|
70
47
|
}
|
|
71
48
|
}
|
|
72
49
|
//# sourceMappingURL=whatsapp-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-service.js","sourceRoot":"","sources":["../../src/services/whatsapp-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;CAChD,CAAC,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"whatsapp-service.js","sourceRoot":"","sources":["../../src/services/whatsapp-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC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,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,IAAI,GAAG;YACX,iBAAiB,EAAE,UAAU;YAC7B,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACrB,CAAC;QAEF,OAAO,SAAS,CACd,GAAG,IAAI,CAAC,OAAO,cAAc,EAC7B;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,EACD,qBAAqB,CACtB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,QAAgB,EAAE;QAClC,OAAO,SAAS,CACd,GAAG,IAAI,CAAC,OAAO,sBAAsB,KAAK,EAAE,EAC5C;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,EACD,yBAAyB,CAC1B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { InstagramService } from "../../services/instagram-service.js";
|
|
4
4
|
const createPostParams = z.object({
|
|
5
5
|
userId: z.string().describe("The Instagram user ID"),
|
|
6
|
-
imageUrl: z.string().url().describe("The URL of the image to post
|
|
6
|
+
imageUrl: z.string().url().describe("The URL of the image to post"),
|
|
7
7
|
message: z.string().min(1).describe("The text content of the Instagram post"),
|
|
8
8
|
});
|
|
9
9
|
export const createPostTool = {
|
|
@@ -13,7 +13,6 @@ export const createPostTool = {
|
|
|
13
13
|
execute: async (params) => {
|
|
14
14
|
const instagramService = new InstagramService();
|
|
15
15
|
try {
|
|
16
|
-
// Call createPost with userId, imageUrl, and message
|
|
17
16
|
const post = await instagramService.createPost(params.userId, params.imageUrl, params.message);
|
|
18
17
|
return dedent `
|
|
19
18
|
Post created successfully on Instagram!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../../src/tools/instagram-tools/create-post.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../../src/tools/instagram-tools/create-post.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;CAC9E,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,iDAAiD;IAC9D,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,EAAE;QAC1C,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAE/F,OAAO,MAAM,CAAA;;;mBAGA,IAAI,CAAC,EAAE;OACnB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;oBACrD,OAAO,8GAA8G,CAAC;gBACxH,CAAC;gBACD,OAAO,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC3D,CAAC;YACD,OAAO,6DAA6D,CAAC;QACvE,CAAC;IACH,CAAC;CACO,CAAC"}
|
|
@@ -6,7 +6,7 @@ declare const getChannelMembersParams: z.ZodObject<{
|
|
|
6
6
|
type GetChannelMembersParams = z.infer<typeof getChannelMembersParams>;
|
|
7
7
|
export declare const getChannelMembersTool: {
|
|
8
8
|
readonly name: "GET_CHANNEL_MEMBERS";
|
|
9
|
-
readonly description: "Get a list of channel administrators
|
|
9
|
+
readonly description: "Get a list of channel administrators";
|
|
10
10
|
readonly parameters: z.ZodObject<{
|
|
11
11
|
channelId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
12
12
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
@@ -10,18 +10,18 @@ const getChannelMembersParams = z.object({
|
|
|
10
10
|
.min(1)
|
|
11
11
|
.max(50)
|
|
12
12
|
.default(10)
|
|
13
|
-
.describe("Maximum number of
|
|
13
|
+
.describe("Maximum number of administrators to retrieve (1-50)"),
|
|
14
14
|
});
|
|
15
15
|
export const getChannelMembersTool = {
|
|
16
16
|
name: "GET_CHANNEL_MEMBERS",
|
|
17
|
-
description: "Get a list of channel administrators
|
|
17
|
+
description: "Get a list of channel administrators",
|
|
18
18
|
parameters: getChannelMembersParams,
|
|
19
19
|
execute: async (params) => {
|
|
20
20
|
const telegramService = new TelegramService();
|
|
21
21
|
try {
|
|
22
22
|
const members = await telegramService.getChannelMembers(params.channelId, params.limit);
|
|
23
23
|
if (members.length === 0) {
|
|
24
|
-
return "No
|
|
24
|
+
return "No administrators found or insufficient permissions to view administrators.";
|
|
25
25
|
}
|
|
26
26
|
const membersList = members
|
|
27
27
|
.map((member, index) => {
|
|
@@ -37,7 +37,7 @@ export const getChannelMembersTool = {
|
|
|
37
37
|
})
|
|
38
38
|
.join("\n\n");
|
|
39
39
|
return dedent `
|
|
40
|
-
Channel
|
|
40
|
+
Channel Administrators (showing ${members.length}):
|
|
41
41
|
|
|
42
42
|
${membersList}
|
|
43
43
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-channel-members.js","sourceRoot":"","sources":["../../../src/tools/telegram-tools/get-channel-members.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC;SACV,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;SAC/B,QAAQ,CAAC,4BAA4B,CAAC;IACxC,KAAK,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"get-channel-members.js","sourceRoot":"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,CAAC;gBACZ,OAAO,MAAM,CAAA;OACX,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI,SAAS;mBACnB,MAAM,CAAC,MAAM;oBACZ,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK;kBACjD,MAAM,CAAC,MAAM;KAC1B,CAAC;YACF,CAAC,CAAC;iBACD,IAAI,CAAC,MAAM,CAAC,CAAC;YAEf,OAAO,MAAM,CAAA;sCACsB,OAAO,CAAC,MAAM;;MAE9C,WAAW;IACb,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;oBACzC,OAAO,sGAAsG,CAAC;gBAC/G,CAAC;gBACD,OAAO,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC1D,CAAC;YACD,OAAO,yDAAyD,CAAC;QAClE,CAAC;IACF,CAAC;CACQ,CAAC"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import dedent from "dedent";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { WhatsappService } from "../../services/whatsapp-service.js";
|
|
4
|
-
// Define a schema for a single WhatsApp message
|
|
5
|
-
const whatsappMessageDetailSchema = z.object({
|
|
6
|
-
id: z.string().describe("The unique ID of the message"),
|
|
7
|
-
from: z.string().describe("The sender's phone number"),
|
|
8
|
-
text: z.object({ body: z.string() }).optional().describe("The message text content"),
|
|
9
|
-
// Add other relevant fields if available from the API, e.g., timestamp, type, etc.
|
|
10
|
-
});
|
|
11
|
-
// Define a schema for the list of messages
|
|
12
|
-
const getMessagesResponseSchema = z.object({
|
|
13
|
-
data: z.array(whatsappMessageDetailSchema),
|
|
14
|
-
});
|
|
15
4
|
const getMessagesParams = z.object({
|
|
16
5
|
limit: z.number().optional().default(10).describe("Maximum number of messages to retrieve"),
|
|
17
6
|
});
|
|
@@ -22,8 +11,6 @@ export const getMessagesTool = {
|
|
|
22
11
|
execute: async (params) => {
|
|
23
12
|
const whatsappService = new WhatsappService();
|
|
24
13
|
try {
|
|
25
|
-
// Assuming WhatsappService has a method like getMessages that takes a limit.
|
|
26
|
-
// The actual implementation might differ based on WhatsApp API capabilities.
|
|
27
14
|
const messages = await whatsappService.getMessages(params.limit);
|
|
28
15
|
if (!messages || messages.data.length === 0) {
|
|
29
16
|
return "No recent WhatsApp messages found.";
|
|
@@ -44,7 +31,6 @@ export const getMessagesTool = {
|
|
|
44
31
|
if (error.message.includes("WHATSAPP_ACCESS_TOKEN")) {
|
|
45
32
|
return "Error: WhatsApp access token is not configured. Please set the WHATSAPP_ACCESS_TOKEN environment variable.";
|
|
46
33
|
}
|
|
47
|
-
// Handle potential errors from the getMessages method itself
|
|
48
34
|
return `Error retrieving WhatsApp messages: ${error.message}`;
|
|
49
35
|
}
|
|
50
36
|
return "An unknown error occurred while retrieving WhatsApp messages";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-messages.js","sourceRoot":"","sources":["../../../src/tools/whatsapp-tools/get-messages.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"get-messages.js","sourceRoot":"","sources":["../../../src/tools/whatsapp-tools/get-messages.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAoC,MAAM,oCAAoC,CAAC;AAEvG,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OA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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "social-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "MCP server for posting and interacting across social media platforms: Twitter, Instagram, Facebook, WhatsApp, Discord, Telegram, and Slack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|