@mahesvara/discord-mcpserver 1.0.7 → 1.0.9

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.
Files changed (54) hide show
  1. package/dist/index.js +7 -2835
  2. package/dist/schemas/channel.d.ts +158 -0
  3. package/dist/schemas/channel.js +128 -0
  4. package/dist/schemas/common.d.ts +23 -0
  5. package/dist/schemas/common.js +71 -0
  6. package/dist/schemas/community.d.ts +181 -0
  7. package/dist/schemas/community.js +60 -0
  8. package/dist/schemas/emoji.d.ts +59 -0
  9. package/dist/schemas/emoji.js +29 -0
  10. package/dist/schemas/event.d.ts +62 -0
  11. package/dist/schemas/event.js +33 -0
  12. package/dist/schemas/guild.d.ts +85 -0
  13. package/dist/schemas/guild.js +42 -0
  14. package/dist/schemas/index.d.ts +12 -855
  15. package/dist/schemas/index.js +13 -617
  16. package/dist/schemas/invite.d.ts +40 -0
  17. package/dist/schemas/invite.js +32 -0
  18. package/dist/schemas/member.d.ts +60 -0
  19. package/dist/schemas/member.js +33 -0
  20. package/dist/schemas/message.d.ts +121 -0
  21. package/dist/schemas/message.js +61 -0
  22. package/dist/schemas/moderation.d.ts +343 -0
  23. package/dist/schemas/moderation.js +152 -0
  24. package/dist/schemas/role.d.ts +126 -0
  25. package/dist/schemas/role.js +73 -0
  26. package/dist/schemas/webhook.d.ts +51 -0
  27. package/dist/schemas/webhook.js +33 -0
  28. package/dist/server.d.ts +2 -0
  29. package/dist/server.js +6 -0
  30. package/dist/tools/channel.d.ts +2 -0
  31. package/dist/tools/channel.js +510 -0
  32. package/dist/tools/community.d.ts +2 -0
  33. package/dist/tools/community.js +259 -0
  34. package/dist/tools/emoji.d.ts +2 -0
  35. package/dist/tools/emoji.js +247 -0
  36. package/dist/tools/event.d.ts +2 -0
  37. package/dist/tools/event.js +170 -0
  38. package/dist/tools/guild.d.ts +2 -0
  39. package/dist/tools/guild.js +198 -0
  40. package/dist/tools/index.d.ts +2 -0
  41. package/dist/tools/index.js +24 -0
  42. package/dist/tools/invite.d.ts +2 -0
  43. package/dist/tools/invite.js +143 -0
  44. package/dist/tools/member.d.ts +2 -0
  45. package/dist/tools/member.js +200 -0
  46. package/dist/tools/message.d.ts +2 -0
  47. package/dist/tools/message.js +386 -0
  48. package/dist/tools/moderation.d.ts +2 -0
  49. package/dist/tools/moderation.js +641 -0
  50. package/dist/tools/role.d.ts +2 -0
  51. package/dist/tools/role.js +420 -0
  52. package/dist/tools/webhook.d.ts +2 -0
  53. package/dist/tools/webhook.js +199 -0
  54. package/package.json +1 -1
@@ -0,0 +1,152 @@
1
+ import { z } from "zod";
2
+ import { GuildIdSchema, UserIdSchema, ChannelIdSchema, RoleIdSchema, AutoModRuleIdSchema, ResponseFormatSchema } from "./common.js";
3
+ export const KickMemberSchema = z.object({
4
+ guild_id: GuildIdSchema,
5
+ user_id: UserIdSchema,
6
+ reason: z.string()
7
+ .max(512)
8
+ .optional()
9
+ .describe("Reason for kick (visible in audit log)")
10
+ }).strict();
11
+ export const BanMemberSchema = z.object({
12
+ guild_id: GuildIdSchema,
13
+ user_id: UserIdSchema,
14
+ reason: z.string()
15
+ .max(512)
16
+ .optional()
17
+ .describe("Reason for ban (visible in audit log)"),
18
+ delete_message_days: z.number()
19
+ .int()
20
+ .min(0)
21
+ .max(7)
22
+ .optional()
23
+ .describe("Number of days of messages to delete (0-7)")
24
+ }).strict();
25
+ export const UnbanMemberSchema = z.object({
26
+ guild_id: GuildIdSchema,
27
+ user_id: UserIdSchema
28
+ }).strict();
29
+ export const TimeoutMemberSchema = z.object({
30
+ guild_id: GuildIdSchema,
31
+ user_id: UserIdSchema,
32
+ duration_minutes: z.number()
33
+ .int()
34
+ .min(1)
35
+ .max(40320)
36
+ .describe("Timeout duration in minutes (max 28 days = 40320)"),
37
+ reason: z.string()
38
+ .max(512)
39
+ .optional()
40
+ .describe("Reason for timeout")
41
+ }).strict();
42
+ export const ListBansSchema = z.object({
43
+ guild_id: GuildIdSchema,
44
+ limit: z.number()
45
+ .int()
46
+ .min(1)
47
+ .max(1000)
48
+ .default(100)
49
+ .describe("Number of bans to return (1-1000)"),
50
+ response_format: ResponseFormatSchema
51
+ }).strict();
52
+ export const PruneMembersSchema = z.object({
53
+ guild_id: GuildIdSchema,
54
+ days: z.number()
55
+ .int()
56
+ .min(1)
57
+ .max(30)
58
+ .describe("Number of days of inactivity (1-30)"),
59
+ include_roles: z.array(RoleIdSchema)
60
+ .optional()
61
+ .describe("Role IDs to include in prune (normally members with roles are excluded)"),
62
+ dry_run: z.boolean()
63
+ .default(true)
64
+ .describe("If true, only returns count without actually pruning")
65
+ }).strict();
66
+ export const GetAuditLogSchema = z.object({
67
+ guild_id: GuildIdSchema,
68
+ limit: z.number()
69
+ .int()
70
+ .min(1)
71
+ .max(100)
72
+ .default(50)
73
+ .describe("Number of entries to retrieve"),
74
+ user_id: UserIdSchema.optional()
75
+ .describe("Filter by user who performed actions"),
76
+ action_type: z.number()
77
+ .int()
78
+ .optional()
79
+ .describe("Filter by action type (Discord audit log action type number)"),
80
+ response_format: ResponseFormatSchema
81
+ }).strict();
82
+ // Auto Moderation schemas
83
+ export const ListAutoModRulesSchema = z.object({
84
+ guild_id: GuildIdSchema,
85
+ response_format: ResponseFormatSchema
86
+ }).strict();
87
+ export const GetAutoModRuleSchema = z.object({
88
+ guild_id: GuildIdSchema,
89
+ rule_id: AutoModRuleIdSchema,
90
+ response_format: ResponseFormatSchema
91
+ }).strict();
92
+ export const CreateAutoModRuleSchema = z.object({
93
+ guild_id: GuildIdSchema,
94
+ name: z.string()
95
+ .min(1)
96
+ .max(100)
97
+ .describe("Rule name"),
98
+ event_type: z.enum(["message_send"])
99
+ .describe("Event type that triggers the rule"),
100
+ trigger_type: z.enum(["keyword", "spam", "keyword_preset", "mention_spam"])
101
+ .describe("Type of content that triggers the rule"),
102
+ trigger_metadata: z.object({
103
+ keyword_filter: z.array(z.string()).optional().describe("Keywords to filter (for keyword trigger)"),
104
+ regex_patterns: z.array(z.string()).optional().describe("Regex patterns to match"),
105
+ presets: z.array(z.enum(["profanity", "sexual_content", "slurs"])).optional().describe("Preset keyword lists"),
106
+ allow_list: z.array(z.string()).optional().describe("Allowed keywords that won't trigger"),
107
+ mention_total_limit: z.number().int().min(1).optional().describe("Max mentions allowed (for mention_spam)")
108
+ }).optional().describe("Trigger configuration"),
109
+ actions: z.array(z.object({
110
+ type: z.enum(["block_message", "send_alert_message", "timeout"]),
111
+ metadata: z.object({
112
+ channel_id: ChannelIdSchema.optional().describe("Channel to send alert (for send_alert_message)"),
113
+ duration_seconds: z.number().int().max(2419200).optional().describe("Timeout duration in seconds (max 28 days)")
114
+ }).optional()
115
+ })).describe("Actions to take when rule is triggered"),
116
+ enabled: z.boolean()
117
+ .default(true)
118
+ .describe("Whether the rule is enabled"),
119
+ exempt_roles: z.array(RoleIdSchema)
120
+ .optional()
121
+ .describe("Roles exempt from this rule"),
122
+ exempt_channels: z.array(ChannelIdSchema)
123
+ .optional()
124
+ .describe("Channels exempt from this rule")
125
+ }).strict();
126
+ export const EditAutoModRuleSchema = z.object({
127
+ guild_id: GuildIdSchema,
128
+ rule_id: AutoModRuleIdSchema,
129
+ name: z.string().min(1).max(100).optional(),
130
+ event_type: z.enum(["message_send"]).optional(),
131
+ trigger_metadata: z.object({
132
+ keyword_filter: z.array(z.string()).optional(),
133
+ regex_patterns: z.array(z.string()).optional(),
134
+ presets: z.array(z.enum(["profanity", "sexual_content", "slurs"])).optional(),
135
+ allow_list: z.array(z.string()).optional(),
136
+ mention_total_limit: z.number().int().min(1).optional()
137
+ }).optional(),
138
+ actions: z.array(z.object({
139
+ type: z.enum(["block_message", "send_alert_message", "timeout"]),
140
+ metadata: z.object({
141
+ channel_id: ChannelIdSchema.optional(),
142
+ duration_seconds: z.number().int().max(2419200).optional()
143
+ }).optional()
144
+ })).optional(),
145
+ enabled: z.boolean().optional(),
146
+ exempt_roles: z.array(RoleIdSchema).optional(),
147
+ exempt_channels: z.array(ChannelIdSchema).optional()
148
+ }).strict();
149
+ export const DeleteAutoModRuleSchema = z.object({
150
+ guild_id: GuildIdSchema,
151
+ rule_id: AutoModRuleIdSchema
152
+ }).strict();
@@ -0,0 +1,126 @@
1
+ import { z } from "zod";
2
+ export declare const ListRolesSchema: z.ZodObject<{
3
+ guild_id: z.ZodString;
4
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
5
+ }, "strict", z.ZodTypeAny, {
6
+ response_format: import("../types.js").ResponseFormat;
7
+ guild_id: string;
8
+ }, {
9
+ guild_id: string;
10
+ response_format?: import("../types.js").ResponseFormat | undefined;
11
+ }>;
12
+ export declare const AddRoleSchema: z.ZodObject<{
13
+ guild_id: z.ZodString;
14
+ user_id: z.ZodString;
15
+ role_id: z.ZodString;
16
+ }, "strict", z.ZodTypeAny, {
17
+ guild_id: string;
18
+ user_id: string;
19
+ role_id: string;
20
+ }, {
21
+ guild_id: string;
22
+ user_id: string;
23
+ role_id: string;
24
+ }>;
25
+ export declare const RemoveRoleSchema: z.ZodObject<{
26
+ guild_id: z.ZodString;
27
+ user_id: z.ZodString;
28
+ role_id: z.ZodString;
29
+ }, "strict", z.ZodTypeAny, {
30
+ guild_id: string;
31
+ user_id: string;
32
+ role_id: string;
33
+ }, {
34
+ guild_id: string;
35
+ user_id: string;
36
+ role_id: string;
37
+ }>;
38
+ export declare const CreateRoleSchema: z.ZodObject<{
39
+ guild_id: z.ZodString;
40
+ name: z.ZodString;
41
+ color: z.ZodOptional<z.ZodNumber>;
42
+ hoist: z.ZodOptional<z.ZodBoolean>;
43
+ mentionable: z.ZodOptional<z.ZodBoolean>;
44
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
45
+ }, "strict", z.ZodTypeAny, {
46
+ name: string;
47
+ guild_id: string;
48
+ color?: number | undefined;
49
+ hoist?: boolean | undefined;
50
+ mentionable?: boolean | undefined;
51
+ permissions?: string[] | undefined;
52
+ }, {
53
+ name: string;
54
+ guild_id: string;
55
+ color?: number | undefined;
56
+ hoist?: boolean | undefined;
57
+ mentionable?: boolean | undefined;
58
+ permissions?: string[] | undefined;
59
+ }>;
60
+ export declare const DeleteRoleSchema: z.ZodObject<{
61
+ guild_id: z.ZodString;
62
+ role_id: z.ZodString;
63
+ }, "strict", z.ZodTypeAny, {
64
+ guild_id: string;
65
+ role_id: string;
66
+ }, {
67
+ guild_id: string;
68
+ role_id: string;
69
+ }>;
70
+ export declare const EditRoleSchema: z.ZodObject<{
71
+ guild_id: z.ZodString;
72
+ role_id: z.ZodString;
73
+ name: z.ZodOptional<z.ZodString>;
74
+ color: z.ZodOptional<z.ZodNumber>;
75
+ hoist: z.ZodOptional<z.ZodBoolean>;
76
+ mentionable: z.ZodOptional<z.ZodBoolean>;
77
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
78
+ }, "strict", z.ZodTypeAny, {
79
+ guild_id: string;
80
+ role_id: string;
81
+ name?: string | undefined;
82
+ color?: number | undefined;
83
+ hoist?: boolean | undefined;
84
+ mentionable?: boolean | undefined;
85
+ permissions?: string[] | undefined;
86
+ }, {
87
+ guild_id: string;
88
+ role_id: string;
89
+ name?: string | undefined;
90
+ color?: number | undefined;
91
+ hoist?: boolean | undefined;
92
+ mentionable?: boolean | undefined;
93
+ permissions?: string[] | undefined;
94
+ }>;
95
+ export declare const SetRolePositionsSchema: z.ZodObject<{
96
+ guild_id: z.ZodString;
97
+ positions: z.ZodArray<z.ZodObject<{
98
+ role_id: z.ZodString;
99
+ position: z.ZodNumber;
100
+ }, "strip", z.ZodTypeAny, {
101
+ position: number;
102
+ role_id: string;
103
+ }, {
104
+ position: number;
105
+ role_id: string;
106
+ }>, "many">;
107
+ }, "strict", z.ZodTypeAny, {
108
+ guild_id: string;
109
+ positions: {
110
+ position: number;
111
+ role_id: string;
112
+ }[];
113
+ }, {
114
+ guild_id: string;
115
+ positions: {
116
+ position: number;
117
+ role_id: string;
118
+ }[];
119
+ }>;
120
+ export type ListRolesInput = z.infer<typeof ListRolesSchema>;
121
+ export type AddRoleInput = z.infer<typeof AddRoleSchema>;
122
+ export type RemoveRoleInput = z.infer<typeof RemoveRoleSchema>;
123
+ export type CreateRoleInput = z.infer<typeof CreateRoleSchema>;
124
+ export type DeleteRoleInput = z.infer<typeof DeleteRoleSchema>;
125
+ export type EditRoleInput = z.infer<typeof EditRoleSchema>;
126
+ export type SetRolePositionsInput = z.infer<typeof SetRolePositionsSchema>;
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ import { GuildIdSchema, UserIdSchema, RoleIdSchema, ResponseFormatSchema } from "./common.js";
3
+ export const ListRolesSchema = z.object({
4
+ guild_id: GuildIdSchema,
5
+ response_format: ResponseFormatSchema
6
+ }).strict();
7
+ export const AddRoleSchema = z.object({
8
+ guild_id: GuildIdSchema,
9
+ user_id: UserIdSchema,
10
+ role_id: RoleIdSchema
11
+ }).strict();
12
+ export const RemoveRoleSchema = z.object({
13
+ guild_id: GuildIdSchema,
14
+ user_id: UserIdSchema,
15
+ role_id: RoleIdSchema
16
+ }).strict();
17
+ export const CreateRoleSchema = z.object({
18
+ guild_id: GuildIdSchema,
19
+ name: z.string()
20
+ .min(1)
21
+ .max(100)
22
+ .describe("Role name"),
23
+ color: z.number()
24
+ .int()
25
+ .min(0)
26
+ .max(16777215)
27
+ .optional()
28
+ .describe("Role color as decimal (e.g., 16711680 for red)"),
29
+ hoist: z.boolean()
30
+ .optional()
31
+ .describe("Whether to display role members separately"),
32
+ mentionable: z.boolean()
33
+ .optional()
34
+ .describe("Whether the role can be mentioned"),
35
+ permissions: z.array(z.string())
36
+ .optional()
37
+ .describe("Array of permission names (e.g., ['SendMessages', 'ManageChannels'])")
38
+ }).strict();
39
+ export const DeleteRoleSchema = z.object({
40
+ guild_id: GuildIdSchema,
41
+ role_id: RoleIdSchema
42
+ }).strict();
43
+ export const EditRoleSchema = z.object({
44
+ guild_id: GuildIdSchema,
45
+ role_id: RoleIdSchema,
46
+ name: z.string()
47
+ .min(1)
48
+ .max(100)
49
+ .optional()
50
+ .describe("New role name"),
51
+ color: z.number()
52
+ .int()
53
+ .min(0)
54
+ .max(16777215)
55
+ .optional()
56
+ .describe("New role color as decimal"),
57
+ hoist: z.boolean()
58
+ .optional()
59
+ .describe("Whether to display role members separately"),
60
+ mentionable: z.boolean()
61
+ .optional()
62
+ .describe("Whether the role can be mentioned"),
63
+ permissions: z.array(z.string())
64
+ .optional()
65
+ .describe("New permission names array")
66
+ }).strict();
67
+ export const SetRolePositionsSchema = z.object({
68
+ guild_id: GuildIdSchema,
69
+ positions: z.array(z.object({
70
+ role_id: RoleIdSchema,
71
+ position: z.number().int().min(0)
72
+ })).min(1).describe("Array of role positions to set")
73
+ }).strict();
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ export declare const ListWebhooksSchema: z.ZodObject<{
3
+ guild_id: z.ZodOptional<z.ZodString>;
4
+ channel_id: z.ZodOptional<z.ZodString>;
5
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
6
+ }, "strict", z.ZodTypeAny, {
7
+ response_format: import("../types.js").ResponseFormat;
8
+ guild_id?: string | undefined;
9
+ channel_id?: string | undefined;
10
+ }, {
11
+ response_format?: import("../types.js").ResponseFormat | undefined;
12
+ guild_id?: string | undefined;
13
+ channel_id?: string | undefined;
14
+ }>;
15
+ export declare const CreateWebhookSchema: z.ZodObject<{
16
+ channel_id: z.ZodString;
17
+ name: z.ZodString;
18
+ avatar_url: z.ZodOptional<z.ZodString>;
19
+ }, "strict", z.ZodTypeAny, {
20
+ name: string;
21
+ channel_id: string;
22
+ avatar_url?: string | undefined;
23
+ }, {
24
+ name: string;
25
+ channel_id: string;
26
+ avatar_url?: string | undefined;
27
+ }>;
28
+ export declare const EditWebhookSchema: z.ZodObject<{
29
+ webhook_id: z.ZodString;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ channel_id: z.ZodOptional<z.ZodString>;
32
+ }, "strict", z.ZodTypeAny, {
33
+ webhook_id: string;
34
+ name?: string | undefined;
35
+ channel_id?: string | undefined;
36
+ }, {
37
+ webhook_id: string;
38
+ name?: string | undefined;
39
+ channel_id?: string | undefined;
40
+ }>;
41
+ export declare const DeleteWebhookSchema: z.ZodObject<{
42
+ webhook_id: z.ZodString;
43
+ }, "strict", z.ZodTypeAny, {
44
+ webhook_id: string;
45
+ }, {
46
+ webhook_id: string;
47
+ }>;
48
+ export type ListWebhooksInput = z.infer<typeof ListWebhooksSchema>;
49
+ export type CreateWebhookInput = z.infer<typeof CreateWebhookSchema>;
50
+ export type EditWebhookInput = z.infer<typeof EditWebhookSchema>;
51
+ export type DeleteWebhookInput = z.infer<typeof DeleteWebhookSchema>;
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { GuildIdSchema, ChannelIdSchema, WebhookIdSchema, ResponseFormatSchema } from "./common.js";
3
+ export const ListWebhooksSchema = z.object({
4
+ guild_id: GuildIdSchema.optional()
5
+ .describe("Guild ID to list all webhooks in the server"),
6
+ channel_id: ChannelIdSchema.optional()
7
+ .describe("Channel ID to list webhooks for a specific channel"),
8
+ response_format: ResponseFormatSchema
9
+ }).strict();
10
+ export const CreateWebhookSchema = z.object({
11
+ channel_id: ChannelIdSchema,
12
+ name: z.string()
13
+ .min(1)
14
+ .max(80)
15
+ .describe("Webhook name"),
16
+ avatar_url: z.string()
17
+ .url()
18
+ .optional()
19
+ .describe("URL of avatar image for the webhook")
20
+ }).strict();
21
+ export const EditWebhookSchema = z.object({
22
+ webhook_id: WebhookIdSchema,
23
+ name: z.string()
24
+ .min(1)
25
+ .max(80)
26
+ .optional()
27
+ .describe("New webhook name"),
28
+ channel_id: ChannelIdSchema.optional()
29
+ .describe("Move webhook to a different channel")
30
+ }).strict();
31
+ export const DeleteWebhookSchema = z.object({
32
+ webhook_id: WebhookIdSchema
33
+ }).strict();
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare const server: McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,6 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ // Initialize MCP Server as a singleton
3
+ export const server = new McpServer({
4
+ name: "discord-mcp-server",
5
+ version: "1.0.0",
6
+ });
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerChannelTools(server: McpServer): void;