@quadslab.io/discord-mcp 1.0.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/LICENSE +21 -0
- package/README.md +474 -0
- package/dist/discord-client.d.ts +57 -0
- package/dist/discord-client.js +188 -0
- package/dist/discord-client.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +135 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +15 -0
- package/dist/mcp-server.js +65 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/tools/automod.d.ts +6 -0
- package/dist/tools/automod.js +376 -0
- package/dist/tools/automod.js.map +1 -0
- package/dist/tools/channels.d.ts +6 -0
- package/dist/tools/channels.js +840 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/emojis.d.ts +6 -0
- package/dist/tools/emojis.js +295 -0
- package/dist/tools/emojis.js.map +1 -0
- package/dist/tools/events.d.ts +6 -0
- package/dist/tools/events.js +304 -0
- package/dist/tools/events.js.map +1 -0
- package/dist/tools/forums.d.ts +6 -0
- package/dist/tools/forums.js +276 -0
- package/dist/tools/forums.js.map +1 -0
- package/dist/tools/guild.d.ts +6 -0
- package/dist/tools/guild.js +88 -0
- package/dist/tools/guild.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +142 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/members.d.ts +6 -0
- package/dist/tools/members.js +628 -0
- package/dist/tools/members.js.map +1 -0
- package/dist/tools/messages.d.ts +6 -0
- package/dist/tools/messages.js +688 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/reactions.d.ts +6 -0
- package/dist/tools/reactions.js +137 -0
- package/dist/tools/reactions.js.map +1 -0
- package/dist/tools/roles.d.ts +6 -0
- package/dist/tools/roles.js +469 -0
- package/dist/tools/roles.js.map +1 -0
- package/dist/tools/server.d.ts +6 -0
- package/dist/tools/server.js +607 -0
- package/dist/tools/server.js.map +1 -0
- package/dist/tools/stage.d.ts +6 -0
- package/dist/tools/stage.js +153 -0
- package/dist/tools/stage.js.map +1 -0
- package/dist/tools/threads.d.ts +6 -0
- package/dist/tools/threads.js +331 -0
- package/dist/tools/threads.js.map +1 -0
- package/dist/tools/utils.d.ts +21 -0
- package/dist/tools/utils.js +315 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/tools/webhooks.d.ts +6 -0
- package/dist/tools/webhooks.js +195 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 QuadsLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
# @quadslab.io/discord-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@quadslab.io/discord-mcp)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
|
|
7
|
+
A Model Context Protocol (MCP) server for full Discord server administration through Claude Code. 99 tools across 14 categories covering every aspect of server management -- from sending messages and managing roles to configuring auto-moderation rules, forums, stages, and scheduled events.
|
|
8
|
+
|
|
9
|
+
Built with [Discord.js v14](https://discord.js.org/) and the [MCP SDK](https://github.com/modelcontextprotocol/sdk).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What Can You Do With It?
|
|
14
|
+
|
|
15
|
+
Once connected to Claude Code, just ask in natural language:
|
|
16
|
+
|
|
17
|
+
- *"Send a welcome message in #general"*
|
|
18
|
+
- *"Lock down the #announcements channel"*
|
|
19
|
+
- *"Who reacted to the last message in #server-guide?"*
|
|
20
|
+
- *"Create a role called VIP with a gold color and assign it to @john"*
|
|
21
|
+
- *"Show me the audit log for the last 24 hours"*
|
|
22
|
+
- *"Set up an automod rule to block links in #general"*
|
|
23
|
+
- *"Create a forum post in #feedback titled Bug Reports"*
|
|
24
|
+
- *"Timeout @spammer for 1 hour for spamming"*
|
|
25
|
+
- *"List all webhooks and delete the unused ones"*
|
|
26
|
+
- *"Schedule a community event for Friday at 8pm in the Stage channel"*
|
|
27
|
+
- *"Bulk delete the last 50 messages in #bot-testing"*
|
|
28
|
+
- *"Give everyone with the Member role access to #private-channel"*
|
|
29
|
+
|
|
30
|
+
Claude automatically resolves channel, role, and member names using fuzzy matching -- no need to look up IDs.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **99 tools across 14 categories** -- comprehensive Discord server administration without leaving the terminal
|
|
37
|
+
- **Fuzzy name resolution** -- type `"bot testing"`, `"bot-testing"`, or `"bottesting"` and it resolves correctly; no need to look up IDs
|
|
38
|
+
- **Zero-config name matching** -- channels, roles, and members are all resolved by name, ID, or mention format automatically
|
|
39
|
+
- **Pre-cached server data** -- all channels, roles, and members are cached on startup for instant lookups without extra API calls
|
|
40
|
+
- **Structured JSON responses** -- every tool returns consistent, pretty-printed JSON
|
|
41
|
+
- **Audit log integration** -- all modifying operations accept a `reason` parameter that appears in the Discord audit log
|
|
42
|
+
- **Helpful error recovery** -- failed lookups return suggestions (e.g., "Did you mean: #general, #bot-testing?")
|
|
43
|
+
- **MCP resources** -- three read-only resources for server overview data
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
### 1. Clone the repository
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/HardHeadHackerHead/discord-mcp.git
|
|
53
|
+
cd discord-mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Install dependencies
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Configure environment variables
|
|
63
|
+
|
|
64
|
+
Copy the example environment file and fill in your values:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cp .env.example .env
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Edit `.env` with your Discord bot token and server ID:
|
|
71
|
+
|
|
72
|
+
```env
|
|
73
|
+
DISCORD_TOKEN=your_bot_token_here
|
|
74
|
+
DISCORD_GUILD_ID=your_guild_id_here
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Variable | Required | Description |
|
|
78
|
+
|----------|----------|-------------|
|
|
79
|
+
| `DISCORD_TOKEN` | Yes | Your Discord bot token (also accepts `BOT_TOKEN` as fallback) |
|
|
80
|
+
| `DISCORD_GUILD_ID` | Yes | The ID of the Discord server to manage |
|
|
81
|
+
|
|
82
|
+
### 4. Build
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. Run
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm start
|
|
92
|
+
# or
|
|
93
|
+
node dist/mcp-server.js
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For development with live TypeScript execution:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Claude Code Integration
|
|
105
|
+
|
|
106
|
+
Add the following to your `.mcp.json` file (located in your project root or home directory):
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"mcpServers": {
|
|
111
|
+
"discord-server": {
|
|
112
|
+
"command": "node",
|
|
113
|
+
"args": ["dist/mcp-server.js"],
|
|
114
|
+
"cwd": "/path/to/discord-mcp"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
After saving, reconnect the MCP server in Claude Code with the `/mcp` command.
|
|
121
|
+
|
|
122
|
+
Once connected, all 99 tools are available directly in Claude Code. You can ask Claude to manage your Discord server using natural language, and it will call the appropriate tools automatically.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Tools Overview
|
|
127
|
+
|
|
128
|
+
### Summary
|
|
129
|
+
|
|
130
|
+
| Category | Tools | Description |
|
|
131
|
+
|----------|------:|-------------|
|
|
132
|
+
| Guild | 2 | Server information and metadata |
|
|
133
|
+
| Roles | 9 | Role creation, editing, permissions, and assignment |
|
|
134
|
+
| Channels | 16 | Channel creation, editing, permissions, and organization |
|
|
135
|
+
| Members | 12 | Member management, moderation, and bulk operations |
|
|
136
|
+
| Messages | 13 | Send, edit, delete, pin, and react to messages |
|
|
137
|
+
| Reactions | 1 | Detailed reaction data with reactor info |
|
|
138
|
+
| Server Admin | 13 | Server settings, invites, bans, audit log, and integrations |
|
|
139
|
+
| Threads | 7 | Thread creation, archiving, locking, and deletion |
|
|
140
|
+
| Forums | 5 | Forum posts and tag management |
|
|
141
|
+
| Emojis & Stickers | 7 | Custom emoji and sticker management |
|
|
142
|
+
| Webhooks | 4 | Webhook creation, deletion, and messaging |
|
|
143
|
+
| Scheduled Events | 4 | Event creation, editing, and deletion |
|
|
144
|
+
| Stage Instances | 3 | Stage channel management |
|
|
145
|
+
| Auto-Moderation | 4 | Automod rule creation, editing, and deletion |
|
|
146
|
+
| **Total** | **99** | |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Guild (2 tools)
|
|
151
|
+
|
|
152
|
+
| Tool | Description |
|
|
153
|
+
|------|-------------|
|
|
154
|
+
| `list_guilds` | List all servers the bot is a member of |
|
|
155
|
+
| `get_guild_info` | Detailed server info -- member count, channels, roles, features, boost tier |
|
|
156
|
+
|
|
157
|
+
### Roles (9 tools)
|
|
158
|
+
|
|
159
|
+
| Tool | Description |
|
|
160
|
+
|------|-------------|
|
|
161
|
+
| `list_roles` | List all roles sorted by position with colors and member counts |
|
|
162
|
+
| `create_role` | Create a new role with name, color, hoist, and mentionable options |
|
|
163
|
+
| `delete_role` | Delete a role (with managed role protection) |
|
|
164
|
+
| `modify_role` | Change a role's name, color, hoist, mentionable, or position |
|
|
165
|
+
| `get_role_permissions` | View all permissions granted to a role |
|
|
166
|
+
| `modify_role_permissions` | Grant or revoke specific permissions on a role |
|
|
167
|
+
| `set_role_icon` | Set a Unicode emoji or image as the role icon (requires boost level 2+) |
|
|
168
|
+
| `assign_role` | Add a role to a member |
|
|
169
|
+
| `remove_role` | Remove a role from a member |
|
|
170
|
+
|
|
171
|
+
### Channels (16 tools)
|
|
172
|
+
|
|
173
|
+
| Tool | Description |
|
|
174
|
+
|------|-------------|
|
|
175
|
+
| `list_channels` | List all channels organized by category |
|
|
176
|
+
| `create_text_channel` | Create a new text channel, optionally in a category |
|
|
177
|
+
| `create_voice_channel` | Create a new voice channel with bitrate and user limit |
|
|
178
|
+
| `create_category` | Create a new channel category |
|
|
179
|
+
| `create_forum_channel` | Create a new forum channel with optional tags and default settings |
|
|
180
|
+
| `delete_channel` | Delete any channel type |
|
|
181
|
+
| `modify_channel` | Change name, topic, category, NSFW, position, user limit |
|
|
182
|
+
| `set_channel_permissions` | Set permission overwrites for a role or user on a channel |
|
|
183
|
+
| `view_channel_permissions` | View all permission overwrites on a channel |
|
|
184
|
+
| `lock_channel` | Deny SendMessages for @everyone (quick lock) |
|
|
185
|
+
| `unlock_channel` | Remove SendMessages deny for @everyone |
|
|
186
|
+
| `set_slowmode` | Set rate limit (0-21600 seconds) on a text channel |
|
|
187
|
+
| `clone_channel` | Duplicate a channel with all permissions and settings |
|
|
188
|
+
| `reorder_channels` | Reorder channels by specifying new positions |
|
|
189
|
+
| `set_voice_region` | Set the RTC region for a voice channel |
|
|
190
|
+
| `follow_announcement_channel` | Follow an announcement channel to cross-post into another channel |
|
|
191
|
+
|
|
192
|
+
### Members (12 tools)
|
|
193
|
+
|
|
194
|
+
| Tool | Description |
|
|
195
|
+
|------|-------------|
|
|
196
|
+
| `list_members` | List members with optional role and search filters |
|
|
197
|
+
| `get_member` | Detailed member info -- roles, join date, account age, permissions |
|
|
198
|
+
| `kick_member` | Kick a member from the server |
|
|
199
|
+
| `ban_member` | Ban a member with optional message deletion (0-7 days) |
|
|
200
|
+
| `unban_member` | Remove a ban by username or user ID |
|
|
201
|
+
| `timeout_member` | Apply a timeout (10m, 1h, 1d, 1w) or remove one |
|
|
202
|
+
| `prune_members` | Remove inactive members (supports dry run and role filtering) |
|
|
203
|
+
| `bulk_assign_role` | Assign a role to multiple members at once |
|
|
204
|
+
| `bulk_remove_role` | Remove a role from multiple members at once |
|
|
205
|
+
| `set_nickname` | Change a member's nickname or reset it |
|
|
206
|
+
| `move_to_voice` | Move a member to a different voice channel |
|
|
207
|
+
| `disconnect_from_voice` | Disconnect a member from their voice channel |
|
|
208
|
+
|
|
209
|
+
### Messages (13 tools)
|
|
210
|
+
|
|
211
|
+
| Tool | Description |
|
|
212
|
+
|------|-------------|
|
|
213
|
+
| `get_messages` | Fetch recent messages from a text or voice channel |
|
|
214
|
+
| `get_message` | Fetch a single message by ID with full details |
|
|
215
|
+
| `send_message` | Send a text message, optionally as a reply |
|
|
216
|
+
| `send_embed` | Send a rich embed with title, fields, images, and footer |
|
|
217
|
+
| `edit_message` | Edit a message previously sent by the bot |
|
|
218
|
+
| `delete_message` | Delete a single message by ID |
|
|
219
|
+
| `bulk_delete_messages` | Delete 2-100 messages at once (< 14 days old), optionally filtered by user |
|
|
220
|
+
| `crosspost_message` | Publish a message in an announcement channel to all following channels |
|
|
221
|
+
| `pin_message` | Pin a message |
|
|
222
|
+
| `unpin_message` | Unpin a message |
|
|
223
|
+
| `list_pinned_messages` | Get all pinned messages in a channel |
|
|
224
|
+
| `add_reaction` | Add a reaction from the bot to a message |
|
|
225
|
+
| `remove_reaction` | Remove the bot's reaction from a message |
|
|
226
|
+
|
|
227
|
+
### Reactions (1 tool)
|
|
228
|
+
|
|
229
|
+
| Tool | Description |
|
|
230
|
+
|------|-------------|
|
|
231
|
+
| `get_reactions` | Get all reactions on a message with full reactor details -- account creation date, server join date, roles, avatar, boost status. Optionally filter by emoji. |
|
|
232
|
+
|
|
233
|
+
### Server Admin (13 tools)
|
|
234
|
+
|
|
235
|
+
| Tool | Description |
|
|
236
|
+
|------|-------------|
|
|
237
|
+
| `edit_server` | Modify server name, description, verification level, notification defaults |
|
|
238
|
+
| `list_invites` | List all active invite links with usage stats and expiration |
|
|
239
|
+
| `create_invite` | Generate a new invite with configurable max age, uses, and temporary flag |
|
|
240
|
+
| `delete_invite` | Revoke an invite by code |
|
|
241
|
+
| `get_audit_log` | Fetch audit log entries, optionally filtered by action type or user |
|
|
242
|
+
| `list_bans` | View all banned users with reasons |
|
|
243
|
+
| `get_welcome_screen` | Get the server welcome screen configuration |
|
|
244
|
+
| `set_welcome_screen` | Configure the welcome screen with description and featured channels |
|
|
245
|
+
| `get_widget` | Get the server widget settings |
|
|
246
|
+
| `set_widget` | Configure the server widget (enable/disable, set channel) |
|
|
247
|
+
| `get_vanity_url` | Get the server vanity URL (requires VANITY_URL feature) |
|
|
248
|
+
| `list_integrations` | List all integrations (bots, apps) connected to the server |
|
|
249
|
+
| `delete_integration` | Remove an integration from the server |
|
|
250
|
+
|
|
251
|
+
### Threads (7 tools)
|
|
252
|
+
|
|
253
|
+
| Tool | Description |
|
|
254
|
+
|------|-------------|
|
|
255
|
+
| `list_threads` | List active threads, optionally filtered to a channel |
|
|
256
|
+
| `create_thread` | Start a thread from a message or as a standalone public thread |
|
|
257
|
+
| `archive_thread` | Archive a thread |
|
|
258
|
+
| `unarchive_thread` | Unarchive a thread |
|
|
259
|
+
| `delete_thread` | Delete a thread |
|
|
260
|
+
| `lock_thread` | Lock a thread (prevent new messages without archiving) |
|
|
261
|
+
| `unlock_thread` | Unlock a thread |
|
|
262
|
+
|
|
263
|
+
### Forums (5 tools)
|
|
264
|
+
|
|
265
|
+
| Tool | Description |
|
|
266
|
+
|------|-------------|
|
|
267
|
+
| `create_forum_post` | Create a new post (thread) in a forum channel with optional tags |
|
|
268
|
+
| `list_forum_tags` | List all available tags on a forum channel |
|
|
269
|
+
| `create_forum_tag` | Add a new tag to a forum channel (max 20 per channel) |
|
|
270
|
+
| `edit_forum_tag` | Edit an existing forum tag's name, emoji, or moderated status |
|
|
271
|
+
| `delete_forum_tag` | Remove a tag from a forum channel |
|
|
272
|
+
|
|
273
|
+
### Emojis & Stickers (7 tools)
|
|
274
|
+
|
|
275
|
+
| Tool | Description |
|
|
276
|
+
|------|-------------|
|
|
277
|
+
| `list_emojis` | List all custom emojis with names, IDs, animated status, and URLs |
|
|
278
|
+
| `create_emoji` | Upload a new custom emoji from a URL |
|
|
279
|
+
| `delete_emoji` | Remove a custom emoji by name or ID |
|
|
280
|
+
| `rename_emoji` | Rename a custom emoji |
|
|
281
|
+
| `list_stickers` | List all custom stickers with descriptions and format info |
|
|
282
|
+
| `create_sticker` | Upload a new custom sticker from a URL |
|
|
283
|
+
| `delete_sticker` | Remove a custom sticker by name or ID |
|
|
284
|
+
|
|
285
|
+
### Webhooks (4 tools)
|
|
286
|
+
|
|
287
|
+
| Tool | Description |
|
|
288
|
+
|------|-------------|
|
|
289
|
+
| `list_webhooks` | List all webhooks, optionally filtered to a channel |
|
|
290
|
+
| `create_webhook` | Create a webhook on a channel with name and optional avatar |
|
|
291
|
+
| `delete_webhook` | Delete a webhook by ID |
|
|
292
|
+
| `send_webhook_message` | Send a message via webhook with optional name/avatar override |
|
|
293
|
+
|
|
294
|
+
### Scheduled Events (4 tools)
|
|
295
|
+
|
|
296
|
+
| Tool | Description |
|
|
297
|
+
|------|-------------|
|
|
298
|
+
| `list_events` | List all scheduled events with times, status, type, and attendee count |
|
|
299
|
+
| `create_event` | Create a voice, stage, or external event with start/end times |
|
|
300
|
+
| `edit_event` | Modify an event's name, description, times, or status |
|
|
301
|
+
| `delete_event` | Delete a scheduled event |
|
|
302
|
+
|
|
303
|
+
### Stage Instances (3 tools)
|
|
304
|
+
|
|
305
|
+
| Tool | Description |
|
|
306
|
+
|------|-------------|
|
|
307
|
+
| `list_stage_instances` | List all active stage instances with topic and channel info |
|
|
308
|
+
| `start_stage` | Start a new stage instance on a stage channel with a topic |
|
|
309
|
+
| `end_stage` | End an active stage instance |
|
|
310
|
+
|
|
311
|
+
### Auto-Moderation (4 tools)
|
|
312
|
+
|
|
313
|
+
| Tool | Description |
|
|
314
|
+
|------|-------------|
|
|
315
|
+
| `list_automod_rules` | List all automod rules with triggers, actions, and exemptions |
|
|
316
|
+
| `create_automod_rule` | Create a rule -- keyword filter, spam detection, keyword presets, or mention spam |
|
|
317
|
+
| `edit_automod_rule` | Modify a rule's keywords, actions, exemptions, or enabled state |
|
|
318
|
+
| `delete_automod_rule` | Delete an automod rule |
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Fuzzy Matching
|
|
323
|
+
|
|
324
|
+
All tools that accept channel, role, or member names use smart fuzzy matching. You never need to look up IDs manually. The resolution order is:
|
|
325
|
+
|
|
326
|
+
1. **Exact ID match** -- pass a Discord snowflake ID directly
|
|
327
|
+
2. **Exact name match** -- case-insensitive
|
|
328
|
+
3. **Normalized match** -- ignores hyphens, spaces, and underscores (`"bot testing"` matches `"bot-testing"`)
|
|
329
|
+
4. **Substring match** -- partial name matches at 0.7+ similarity threshold
|
|
330
|
+
|
|
331
|
+
Mention formats are also handled automatically:
|
|
332
|
+
|
|
333
|
+
- Channels: `#name` or `<#id>`
|
|
334
|
+
- Roles: `@name` or `<@&id>`
|
|
335
|
+
- Members: `@name` or `<@id>` or `<@!id>`
|
|
336
|
+
|
|
337
|
+
If no match is found, the error message includes suggestions of similar names to help you correct the input.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## MCP Resources
|
|
342
|
+
|
|
343
|
+
Three read-only resources are exposed for quick server overview data:
|
|
344
|
+
|
|
345
|
+
| URI | Description |
|
|
346
|
+
|-----|-------------|
|
|
347
|
+
| `discord://server/summary` | Text overview of the server (channels, roles, members) |
|
|
348
|
+
| `discord://server/channels` | JSON list of all channels organized by category |
|
|
349
|
+
| `discord://server/roles` | JSON list of all roles sorted by position |
|
|
350
|
+
|
|
351
|
+
These resources can be read by Claude Code to build context about the server before performing operations.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Required Permissions
|
|
356
|
+
|
|
357
|
+
The Discord bot needs the following permissions in the server for full functionality:
|
|
358
|
+
|
|
359
|
+
**General**
|
|
360
|
+
- Manage Server
|
|
361
|
+
- Manage Roles
|
|
362
|
+
- Manage Channels
|
|
363
|
+
- View Audit Log
|
|
364
|
+
- Manage Webhooks
|
|
365
|
+
- Manage Events
|
|
366
|
+
- Manage Emojis and Stickers
|
|
367
|
+
|
|
368
|
+
**Text**
|
|
369
|
+
- Send Messages
|
|
370
|
+
- Manage Messages
|
|
371
|
+
- Read Message History
|
|
372
|
+
- Add Reactions
|
|
373
|
+
- Use External Emojis
|
|
374
|
+
|
|
375
|
+
**Voice**
|
|
376
|
+
- Move Members
|
|
377
|
+
- Disconnect Members
|
|
378
|
+
|
|
379
|
+
**Moderation**
|
|
380
|
+
- Kick Members
|
|
381
|
+
- Ban Members
|
|
382
|
+
- Moderate Members
|
|
383
|
+
- Manage Auto Moderation
|
|
384
|
+
|
|
385
|
+
The bot can only act within its role hierarchy -- it cannot manage roles positioned higher than its own highest role.
|
|
386
|
+
|
|
387
|
+
### Required OAuth2 Scopes
|
|
388
|
+
|
|
389
|
+
When inviting the bot, ensure the following scopes are selected:
|
|
390
|
+
|
|
391
|
+
- `bot`
|
|
392
|
+
- `applications.commands`
|
|
393
|
+
|
|
394
|
+
### Gateway Intents
|
|
395
|
+
|
|
396
|
+
The bot connects with these privileged intents (must be enabled in the Discord Developer Portal):
|
|
397
|
+
|
|
398
|
+
- `Guilds` -- server structure (channels, roles)
|
|
399
|
+
- `GuildMembers` -- member data and events
|
|
400
|
+
- `GuildMessages` -- message content and events
|
|
401
|
+
- `GuildModeration` -- ban and kick events
|
|
402
|
+
- `MessageContent` -- read message text
|
|
403
|
+
- `GuildMessageReactions` -- reaction data
|
|
404
|
+
- `GuildScheduledEvents` -- scheduled event management
|
|
405
|
+
- `AutoModerationConfiguration` -- automod rule management
|
|
406
|
+
- `GuildWebhooks` -- webhook events
|
|
407
|
+
- `GuildInvites` -- invite tracking
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Architecture
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
@quadslab.io/discord-mcp/
|
|
415
|
+
├── package.json
|
|
416
|
+
├── tsconfig.json
|
|
417
|
+
├── README.md
|
|
418
|
+
├── LICENSE
|
|
419
|
+
├── .env.example
|
|
420
|
+
├── .gitignore
|
|
421
|
+
├── docs/
|
|
422
|
+
│ └── discord-mcp-server.md # Full tool reference documentation
|
|
423
|
+
└── src/
|
|
424
|
+
├── mcp-server.ts # Entry point -- validates env, initializes client, starts server
|
|
425
|
+
├── index.ts # MCP server setup -- registers tools, resources, and request handlers
|
|
426
|
+
├── discord-client.ts # Discord.js client -- intents, caching, connection management
|
|
427
|
+
└── tools/
|
|
428
|
+
├── index.ts # Tool registry -- routes tool calls to category handlers
|
|
429
|
+
├── utils.ts # Fuzzy matching -- smart name resolution for channels, roles, members
|
|
430
|
+
├── guild.ts # Server info tools (2)
|
|
431
|
+
├── roles.ts # Role management tools (9)
|
|
432
|
+
├── channels.ts # Channel management tools (16)
|
|
433
|
+
├── members.ts # Member management tools (12)
|
|
434
|
+
├── messages.ts # Messaging tools (13)
|
|
435
|
+
├── reactions.ts # Reaction tools (1)
|
|
436
|
+
├── server.ts # Server admin tools (13)
|
|
437
|
+
├── threads.ts # Thread management tools (7)
|
|
438
|
+
├── emojis.ts # Emoji & sticker tools (7)
|
|
439
|
+
├── webhooks.ts # Webhook tools (4)
|
|
440
|
+
├── events.ts # Scheduled event tools (4)
|
|
441
|
+
├── automod.ts # Auto-moderation tools (4)
|
|
442
|
+
├── forums.ts # Forum channel tools (5)
|
|
443
|
+
└── stage.ts # Stage instance tools (3)
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## Contributing
|
|
449
|
+
|
|
450
|
+
Contributions are welcome. To get started:
|
|
451
|
+
|
|
452
|
+
1. Fork the repository
|
|
453
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
454
|
+
3. Make your changes
|
|
455
|
+
4. Ensure the project builds cleanly (`npm run build`)
|
|
456
|
+
5. Commit your changes with a descriptive message
|
|
457
|
+
6. Push to your fork and open a pull request
|
|
458
|
+
|
|
459
|
+
### Guidelines
|
|
460
|
+
|
|
461
|
+
- Follow the existing code style and patterns
|
|
462
|
+
- Each new tool should be added to the appropriate category file in `src/tools/`
|
|
463
|
+
- All tools must return structured JSON responses
|
|
464
|
+
- Include fuzzy matching support for any new parameters that accept channel, role, or member names
|
|
465
|
+
- Add new tools to the tool registry in `src/tools/index.ts`
|
|
466
|
+
- Update the documentation in `docs/discord-mcp-server.md` for any new or changed tools
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## License
|
|
471
|
+
|
|
472
|
+
MIT License. Copyright (c) 2026 [QuadsLab](https://github.com/quadslab).
|
|
473
|
+
|
|
474
|
+
See [LICENSE](LICENSE) for the full text.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Client } from 'discord.js';
|
|
2
|
+
export interface ServerCache {
|
|
3
|
+
channels: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
categoryId: string | null;
|
|
8
|
+
categoryName: string | null;
|
|
9
|
+
}>;
|
|
10
|
+
roles: Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
color: string;
|
|
14
|
+
position: number;
|
|
15
|
+
}>;
|
|
16
|
+
members: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
username: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
nickname: string | null;
|
|
21
|
+
}>;
|
|
22
|
+
lastUpdated: Date;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the Discord client for MCP server
|
|
26
|
+
* Uses minimal intents needed for server management
|
|
27
|
+
*/
|
|
28
|
+
export declare function initializeClient(): Promise<Client>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the Discord client instance
|
|
31
|
+
*/
|
|
32
|
+
export declare function getClient(): Client;
|
|
33
|
+
/**
|
|
34
|
+
* Get the configured guild ID
|
|
35
|
+
*/
|
|
36
|
+
export declare function getGuildId(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the configured guild
|
|
39
|
+
*/
|
|
40
|
+
export declare function getGuild(): Promise<import("discord.js").Guild>;
|
|
41
|
+
/**
|
|
42
|
+
* Destroy the Discord client connection
|
|
43
|
+
*/
|
|
44
|
+
export declare function destroyClient(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Refresh the server cache with current data
|
|
47
|
+
* Called on startup and can be called to refresh
|
|
48
|
+
*/
|
|
49
|
+
export declare function refreshServerCache(): Promise<ServerCache>;
|
|
50
|
+
/**
|
|
51
|
+
* Get the server cache (refreshes if not initialized)
|
|
52
|
+
*/
|
|
53
|
+
export declare function getServerCache(): Promise<ServerCache>;
|
|
54
|
+
/**
|
|
55
|
+
* Get a summary of the server for context
|
|
56
|
+
*/
|
|
57
|
+
export declare function getServerSummary(): Promise<string>;
|