-
Notifications
You must be signed in to change notification settings - Fork 1
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
Open
viniciusventura29
wants to merge
3
commits into
main
Choose a base branch
from
feat/add-discord
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .dev.vars |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| "wrangler": "^4.28.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=22.0.0" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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