Discord MCP Bot - Server Component

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

Getting Started

  1. Clone the repository:

    git clone https://github.com/mastra-ai/discord-mcp-server
    cd discord-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. 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
    
  4. Run the server:

    npm start
    

Setting Up a Discord Bot

  1. 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"
  2. Configure bot permissions:

    • Under "Privileged Gateway Intents", enable:
      • Message Content Intent
      • Server Members Intent
      • Direct Message Intent
  3. 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 as DISCORD_BOT_TOKEN
  4. 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 setup
  • scripts/register-commands.ts: Register the bot commands
  • scripts/delete-commands.ts: Delete the bot commands
  • scripts/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

推荐服务器

graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Apple MCP Server

Apple MCP Server

通过 MCP 协议与 Apple 应用(如“信息”、“备忘录”和“通讯录”)进行交互,从而使用自然语言发送消息、搜索和打开应用内容。

精选
本地
TypeScript
@kazuph/mcp-gmail-gas

@kazuph/mcp-gmail-gas

用于 Gmail 集成的模型上下文协议 (Model Context Protocol, MCP) 服务器。它允许 Claude Desktop(或任何 MCP 客户端)通过 Google Apps Script 与您的 Gmail 帐户进行交互。

精选
JavaScript
MCP Server Trello

MCP Server Trello

通过 Trello API 促进与 Trello 看板的交互,提供速率限制、类型安全、输入验证和错误处理等功能,以实现对卡片、列表和看板活动的无缝管理。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Composio MCP Server

Composio MCP Server

一个服务器实现,提供与 MCP 兼容的 Composio 应用(如 Gmail 和 Linear)的访问,允许通过结构化的接口与语言模型进行交互。

官方
TypeScript
Folderr

Folderr

一个模型上下文协议 (MCP) 服务器,它提供与 Folderr API 交互的工具,专门用于管理 Folderr 助手并与之通信。

官方
JavaScript
mcp-google

mcp-google

一个专门的模型上下文协议(MCP)服务器,它将 Google 服务(Gmail、日历等)集成到您的 AI 工作流程中。该服务器通过 MCP 实现对 Google 服务的无缝访问,从而允许 AI 代理与 Gmail、Google 日历和其他 Google 服务进行交互。

本地
TypeScript
MCP-JIRA-Python Server

MCP-JIRA-Python Server

一个基于 Python 的服务器,可以与 JIRA 无缝集成,并通过自定义 API 管理和交互项目。

本地
Python
Email sending MCP 💌

Email sending MCP 💌

Send emails directly from Cursor with this email sending MCP server

本地
TypeScript