Discord MCP Bot - Server Component
mastra-ai
README
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:
git clone https://github.com/mastra-ai/discord-mcp-server cd discord-mcp-server
-
Install dependencies:
npm install
-
Create a
.env
file with your Discord credentials:DISCORD_BOT_TOKEN=your_discord_bot_token DISCORD_CLIENT_ID=your_discord_client_id DISCORD_PUBLIC_KEY=your_discord_public_key MASTRA_URL=your_mastra_url
-
Run the server:
npm start
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
Recommended Servers
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Apple MCP Server
Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.
@kazuph/mcp-gmail-gas
Model Context Protocol server for Gmail integration. This allows Claude Desktop (or any MCP client) to interact with your Gmail account through Google Apps Script.
MCP Server Trello
Facilitates interaction with Trello boards via the Trello API, offering features like rate limiting, type safety, input validation, and error handling for seamless management of cards, lists, and board activities.

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.
Composio MCP Server
A server implementation that provides MCP-compatible access to Composio applications like Gmail and Linear, allowing interaction through a structured interface for language models.

Folderr
A Model Context Protocol (MCP) server that provides tools to interact with Folderr's API, specifically for managing and communicating with Folderr Assistants.

mcp-google
A specialized Model Context Protocol (MCP) server that integrates Google services (Gmail, Calendar, etc.) into your AI workflows. This server enables seamless access to Google services through MCP, allowing AI agents to interact with Gmail, Google Calendar, and other Google services.
MCP-JIRA-Python Server
A Python-based server allowing seamless integration with JIRA for managing and interacting with projects through custom APIs.
Email Sending MCP
Send emails directly from Cursor with this email sending MCP server