-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Discord Bot MCP server and tools #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .dev.vars |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| # Discord Bot MCP | ||
|
|
||
| MCP (Model Context Protocol) server para integração com Discord Bot API. | ||
|
|
||
| ## Funcionalidades | ||
|
|
||
| ### Mensagens | ||
| - Enviar mensagens em canais | ||
| - Editar mensagens existentes | ||
| - Deletar mensagens | ||
| - Fixar/desafixar mensagens | ||
| - Adicionar/remover reações | ||
| - Buscar mensagens de canais | ||
| - Buscar mensagens fixadas | ||
|
|
||
| ### Canais | ||
| - Criar canais (texto, voz, categorias) | ||
| - Listar canais do servidor | ||
| - Buscar informações de canais específicos | ||
|
|
||
| ### Servidores (Guilds) | ||
| - Listar servidores onde o bot está presente | ||
| - Buscar informações de servidores | ||
| - Listar membros do servidor | ||
| - Banir membros | ||
|
|
||
| ### Roles | ||
| - Criar roles | ||
| - Editar roles | ||
| - Deletar roles | ||
| - Listar roles do servidor | ||
|
|
||
| ### Threads | ||
| - Criar threads | ||
| - Entrar/sair de threads | ||
| - Listar threads ativas | ||
| - Listar threads arquivadas | ||
|
|
||
| ### Webhooks | ||
| - Criar webhooks | ||
| - Executar webhooks | ||
| - Deletar webhooks | ||
| - Listar webhooks | ||
|
|
||
| ### Usuários | ||
| - Buscar informações do usuário atual (bot) | ||
| - Buscar informações de usuários específicos | ||
|
|
||
| ## Configuração | ||
|
|
||
| ### Pré-requisitos | ||
|
|
||
| 1. Criar um bot no [Discord Developer Portal](https://discord.com/developers/applications) | ||
| 2. Obter o Bot Token | ||
| 3. Adicionar o bot ao seu servidor com as permissões necessárias | ||
|
|
||
| ### Instalação | ||
|
|
||
| 1. Instale o MCP no seu workspace Deco | ||
| 2. Configure o Bot Token quando solicitado | ||
|
|
||
| ### Permissões Necessárias | ||
|
|
||
| O bot precisa das seguintes permissões no Discord: | ||
| - Read Messages/View Channels | ||
| - Send Messages | ||
| - Manage Messages | ||
| - Manage Channels | ||
| - Manage Roles | ||
| - Manage Webhooks | ||
| - Ban Members | ||
| - Read Message History | ||
| - Add Reactions | ||
|
|
||
| ## Desenvolvimento | ||
|
|
||
| ```bash | ||
| # Instalar dependências | ||
| bun install | ||
|
|
||
| # Desenvolvimento local | ||
| bun run dev | ||
|
|
||
| # Build | ||
| bun run build | ||
|
|
||
| # Deploy | ||
| bun run deploy | ||
| ``` | ||
|
|
||
| ## Estrutura | ||
|
|
||
| ``` | ||
| discord-bot/ | ||
| ├── server/ | ||
| │ ├── main.ts # Entry point do MCP | ||
| │ ├── lib/ | ||
| │ │ └── types.ts # Schemas Zod e tipos | ||
| │ └── tools/ | ||
| │ ├── index.ts # Exporta todas as tools | ||
| │ ├── messages.ts # Tools de mensagens | ||
| │ ├── channels.ts # Tools de canais | ||
| │ ├── guilds.ts # Tools de servidores | ||
| │ ├── roles.ts # Tools de roles | ||
| │ ├── threads.ts # Tools de threads | ||
| │ ├── webhooks.ts # Tools de webhooks | ||
| │ └── utils/ | ||
| │ └── discord-client.ts # Cliente HTTP Discord | ||
| └── shared/ | ||
| └── deco.gen.ts # Tipos gerados automaticamente | ||
| ``` | ||
|
|
||
| ## Exemplos de Uso | ||
|
|
||
| ### Enviar uma mensagem | ||
|
|
||
| ```typescript | ||
| { | ||
| "channelId": "123456789", | ||
| "content": "Hello, Discord!" | ||
| } | ||
| ``` | ||
|
|
||
| ### Criar um canal | ||
|
|
||
| ```typescript | ||
| { | ||
| "guildId": "123456789", | ||
| "name": "novo-canal", | ||
| "type": 0 | ||
| } | ||
| ``` | ||
|
|
||
| ### Listar servidores | ||
|
|
||
| ```typescript | ||
| { | ||
| "limit": 100 | ||
| } | ||
| ``` | ||
|
|
||
| ## API do Discord | ||
|
|
||
| Este MCP usa a [Discord API v10](https://discord.com/developers/docs/intro). | ||
|
|
||
| ## Suporte | ||
|
|
||
| Para mais informações sobre a API do Discord, consulte: | ||
| - [Discord Developer Portal](https://discord.com/developers/docs) | ||
| - [Bot Permissions Calculator](https://discordapi.com/permissions.html) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "discord-bot", | ||
| "version": "1.0.0", | ||
| "description": "MCP server for Discord Bot integration", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "deco dev --vite", | ||
| "configure": "deco configure", | ||
| "gen": "deco gen --output=shared/deco.gen.ts", | ||
| "deploy": "npm run build && deco deploy ./dist/server", | ||
| "check": "tsc --noEmit", | ||
| "build": "bun --bun vite build" | ||
| }, | ||
| "dependencies": { | ||
| "@decocms/runtime": "0.24.0", | ||
| "tweetnacl": "^1.0.3", | ||
| "zod": "^3.24.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@cloudflare/vite-plugin": "^1.13.4", | ||
| "@cloudflare/workers-types": "^4.20251014.0", | ||
| "@decocms/mcps-shared": "1.0.0", | ||
| "@mastra/core": "^0.24.0", | ||
| "@modelcontextprotocol/sdk": "^1.21.0", | ||
| "@types/mime-db": "^1.43.6", | ||
| "deco-cli": "^0.26.0", | ||
| "typescript": "^5.7.2", | ||
| "vite": "7.2.0", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify the Vite version exists and is compatible. Vite is pinned to exact version 🌐 Web query: 💡 Result: The latest stable Vite version as of November 17, 2025 is v7.1.4. [1][2] Sources: Vite version 7.2.0 exceeds the current latest stable release. The latest stable Vite version as of November 17, 2025 is v7.1.4, but the package.json pins version 7.2.0. This version either doesn't exist yet or may be a pre-release. Verify this is intentional; otherwise, update to a released version or remove the exact pin to allow flexibility. 🤖 Prompt for AI Agents |
||
| "wrangler": "^4.28.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=22.0.0" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specification to the fenced code block.
The fenced code block on line 93 is missing a language specification, which is flagged by markdownlint. Adding a language identifier improves syntax highlighting and documentation clarity.
Apply this diff to add the language specification:
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
93-93: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents