Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@
"wrangler": "^4.28.0",
},
},
"discord-bot": {
"name": "discord-bot",
"version": "1.0.0",
"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",
},
},
"mcp-studio": {
"name": "mcp-studio",
"version": "1.0.0",
Expand Down Expand Up @@ -1604,6 +1625,8 @@

"diff-match-patch": ["diff-match-patch@1.0.5", "", {}, "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw=="],

"discord-bot": ["discord-bot@workspace:discord-bot"],

"dotenv": ["dotenv@16.6.1", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="],

"drizzle-orm": ["drizzle-orm@0.44.7", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", "@prisma/client": "*", "@tidbcloud/serverless": "*", "@types/better-sqlite3": "*", "@types/pg": "*", "@types/sql.js": "*", "@upstash/redis": ">=1.34.7", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", "expo-sqlite": ">=14.0.0", "gel": ">=2", "knex": "*", "kysely": "*", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@prisma/client", "@tidbcloud/serverless", "@types/better-sqlite3", "@types/pg", "@types/sql.js", "@upstash/redis", "@vercel/postgres", "@xata.io/client", "better-sqlite3", "bun-types", "expo-sqlite", "gel", "knex", "kysely", "mysql2", "pg", "postgres", "sql.js", "sqlite3"] }, "sha512-quIpnYznjU9lHshEOAYLoZ9s3jweleHlZIAWR/jX9gAWNg/JhQ1wj0KGRf7/Zm+obRrYd9GjPVJg790QY9N5AQ=="],
Expand Down Expand Up @@ -2228,6 +2251,8 @@

"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],

"tweetnacl": ["tweetnacl@1.0.3", "", {}, "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="],

"type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],

"type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="],
Expand Down
1 change: 1 addition & 0 deletions discord-bot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.dev.vars
151 changes: 151 additions & 0 deletions discord-bot/README.md
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
```
Comment on lines +93 to +111
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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:

-```
+```text
 discord-bot/
 ├── server/
 │   ├── main.ts              # Entry point do MCP
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

93-93: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In discord-bot/README.md around lines 93 to 111 the fenced code block lacks a
language specifier; update the opening fence from ``` to ```text so the block
starts with ```text to satisfy markdownlint and enable proper syntax
highlighting and documentation clarity.


## 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)

35 changes: 35 additions & 0 deletions discord-bot/package.json
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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify the Vite version exists and is compatible.

Vite is pinned to exact version 7.2.0, which seems unusually high. As of my knowledge cutoff, Vite's latest stable version is in the 5.x-6.x range. Please verify that this version exists and is the intended version.


🌐 Web query:

What is the latest version of Vite as of November 2025?

💡 Result:

The latest stable Vite version as of November 17, 2025 is v7.1.4. [1][2]

Sources:
[1] Vite official blog (announcing Vite 7).
[2] Vite package page on npm showing v7.1.4.


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
In discord-bot/package.json around line 28, the Vite dependency is pinned to
"7.2.0" which exceeds the current stable release; update the version to a valid
released version (e.g., "7.1.4") or loosen the pin (e.g., "^7.1.4" or ">=7.1.4
<8.0.0") depending on whether you want exact reproducibility or minor upgrades,
then run npm install / pnpm install and verify the lockfile and build still
succeed.

"wrangler": "^4.28.0"
},
"engines": {
"node": ">=22.0.0"
}
}
Loading
Loading