Discord MCP Bot - Server Component
A Discord bot server that integrates with Mastra's MCP Bot component to provide intelligent assistance and answer questions about Mastra.ai.
Overview
This Discord bot server works with the Mastra MCP component to:
- Handle Discord interactions and message routing
- Manage bot commands and permissions
- Provide Discord-specific functionality like threads and DMs
- Interface with the Mastra component for intelligent responses
Prerequisites
- Node.js v20.0+
- npm
- Discord bot token
- Access to discord-mcp-bot component
Getting Started
- Clone the repository:
- Install dependencies:
- Create a
.env
file with your Discord credentials: - Run the server:
Setting Up a Discord Bot
- Create a Discord application:
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Navigate to the "Bot" tab and click "Add Bot"
- Configure bot permissions:
- Under "Privileged Gateway Intents", enable:
- Message Content Intent
- Server Members Intent
- Direct Message Intent
- Under "Privileged Gateway Intents", enable:
- Get your bot token:
- In the Bot tab, click "Reset Token" or "Copy" to get your bot token
- Add this token to your
.env
file asDISCORD_BOT_TOKEN
- Invite the bot to your server:
- Go to the "OAuth2" tab, then "URL Generator"
- Select "bot" under scopes
- Select required permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
- Copy the generated URL and open it in your browser
- Select your server and authorize the bot
Features
- Direct Message Support: Users can DM the bot to ask questions
- Slash Commands: Uses Discord's slash commands to interact with the bot
/ask
: Ask the bot a question/cleardm
: Clear the bot messages in the user's DMs
- Threads: Uses Discord's threads to provide a better user experience
- Integration: Seamless integration with the Mastra MCP component
Project Structure
api/index.ts
: Main bot implementation and Discord client setupscripts/register-commands.ts
: Register the bot commandsscripts/delete-commands.ts
: Delete the bot commandsscripts/list-commands.ts
: List the bot commands
Implementation Notes
The server is built with:
- Discord.js for Discord integration
- TypeScript for type safety and better development experience
- Integration with Mastra MCP component for intelligent responses
For production deployment, consider:
- Setting up proper logging
- Implementing rate limiting
- Adding monitoring and error tracking
- Setting up a process manager (PM2, etc.)
Related Projects
- discord-mcp-bot: Handles Mastra-specific functionality and intelligent responses
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Discord bot server that integrates with Mastra's MCP Bot component to provide intelligent assistance and answer questions about Mastra.ai through direct messages and slash commands.
Related MCP Servers
- -securityFlicense-qualityAn MCP server that enables communication with users through Telegram. This server provides a tool to ask questions to users and receive their responses via a Telegram bot.Last updated -116JavaScript
- AsecurityAlicenseAqualityAn MCP server that enables posting messages to Discord webhooks, allowing customization of content, username, and avatar URL.Last updated -10JavaScriptMIT License
- -securityAlicense-qualityAn MCP server that helps AI assistants access text content from websites that implement bot detection, bridging the gap between what you can see in your browser and what the AI can access.Last updated -1PythonApache 2.0
- -securityFlicense-qualityA specialized MCP server that enables AI agents to interact with Reddit, including reading posts, creating content, and managing subreddit configurations.Last updated -715TypeScript