Discord MCP服务器

一个全面的模型上下文协议(MCP)服务器,使AI助手能够与Discord服务器交互,提供包括读取频道、发送消息、管理直接消息和执行审核操作在内的双向通信功能。

  • by Shawnsey
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 shawnsey/discord-mcp

使用说明

断开MCP服务器

一个全面的模型上下文协议(MCP)服务器,使AI助手能够与Discord服务器进行交互。该服务器提供完整的双向通信功能,包括从通道读取、发送消息、管理直接消息,以及通过标准化的MCP接口执行审核操作。

特性

资源(读取操作)

  • 公会列表 (guilds://)-列出可访问的Discord服务器,包括成员计数和权限
  • 频道列表 (channels://{guild_id})-使用元数据列出特定服务器中的频道
  • 消息阅读 (messages://{channel_id})-从支持分页的频道读取消息
  • 用户信息 (user://{user_id})-获取详细的用户配置文件信息
  • 健康检查 (health://status)-服务器状态和配置信息

工具(操作)

  • 列出行业协会 (list_guilds)-列出所有可访问的Discord服务器(已读)
  • 列出频道 (list_channels)-列出特定服务器中的频道(已读)
  • 获取消息 (get_messages)-从频道读取最近的消息(已读)
  • 获取用户信息 (get_user_info)-获取用户配置文件信息(已读)
  • 发送消息 (send_message)-向支持回复的Discord频道发送消息(写)
  • 发送直接消息 (send_dm)-向用户发送私信(写)
  • 阅读直接消息 (read_direct_messages)-阅读与特定用户的DM对话(阅读)
  • 消息管理 -删除(delete_message)并编辑(edit_message)具有权限的邮件(写入)
  • 用户审核 -超时(timeout_user),删除超时(untimeout_user),踢(kick_user),并禁止(ban_user)具有适当权限验证(审核)的用户
  • 高级功能 -支持嵌入、附件、反应和丰富的格式

快速开始

先决条件

  • Python 3.8或更高版本
  • Discord Bot令牌(请参见 Discord Bot设置)
  • MCP兼容客户端(Amazon Q CLI、Claude Desktop等)

安装

  1. 克隆存储库

    git clone <repository-url>
    cd Discord-MCP
    
  2. 创建虚拟环境

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. 安装依赖项

    pip install -r requirements.txt
    
  4. 配置环境

    cp .env.example .env
    # Edit .env with your Discord bot token and settings
    
  5. 运行服务器

    选项A:本地HTTP服务器(SSE模式)

    # Run as local HTTP server (like prompt-mcp)
    python discord_server.py --transport sse --port 8000
    
    # Or using module
    python -m discord_mcp --transport sse --port 8000
    
    # With custom host and debug logging
    python discord_server.py --transport sse --host 0.0.0.0 --port 8000 --log-level DEBUG
    

    选项B:MCP客户端集成(stdio模式)

    # For MCP client integration
    python discord_server.py --transport stdio
    
    # Or using module
    python -m discord_mcp --transport stdio
    

服务器模式

Discord MCP服务器支持双传输模式,以实现最大的灵活性:

SSE模式(本地HTTP服务器)

将服务器作为可以直接连接的本地HTTP服务器运行:

# Start local server
python discord_server.py --transport sse --port 8000

# Server will be available at:
# http://localhost:8000/sse
# Health check: http://localhost:8000/health

SSE模式的好处:

  • ✅ 作为本地服务独立运行
  • ✅ 多个客户端可以同时访问
  • ✅ 更容易调试和开发
  • ✅ 直接HTTP API访问
  • ✅ 内置健康检查端点
  • ✅ 实时服务器监控

stdio模式(MCP客户端集成)

运行服务器以与MCP客户端(Claude Desktop、Amazon Q等)集成:

# For MCP client integration
python discord_server.py --transport stdio

stdio模式的优点:

  • ✅ 标准MCP客户端集成
  • ✅ MCP客户端管理生命周期
  • ✅ 自动化流程管理
  • ✅ 安全的子流程通信
  • ✅ 内置错误处理和恢复

命令行选项

python discord_server.py --help

Options:
  --transport {stdio,sse}    Transport protocol (default: stdio)
  --host HOST               Host for SSE mode (default: 127.0.0.1)
  --port PORT               Port for SSE mode (default: 8000)
  --mount-path PATH         Mount path for SSE (default: /sse)
  --log-level LEVEL         Logging level: DEBUG, INFO, WARNING, ERROR (default: INFO)
  --log-format FORMAT       Log format: text or json (default: text)

Examples:
  # Run with stdio transport (for MCP clients)
  python discord_server.py --transport stdio
  
  # Run with SSE transport (local HTTP server)
  python discord_server.py --transport sse --host 0.0.0.0 --port 8000
  
  # Run with debug logging
  python discord_server.py --log-level DEBUG --transport sse

MCP集成

开发和测试

使用MCP开发工具测试服务器:

# Test with MCP dev tools
mcp dev mcp_server.py

# Run integration tests
python test_mcp_integration.py

# Test local server functionality
python test_local_server.py

Amazon Q CLI集成

对于Amazon Q CLI集成,请在MCP配置中添加:

{
  "mcpServers": {
    "discord-server": {
      "command": "/path/to/Discord-MCP/venv/bin/python",
      "args": ["-m", "discord_mcp.cli", "--transport", "stdio"],
      "env": {
        "DISCORD_BOT_TOKEN": "your_discord_bot_token_here",
        "DISCORD_APPLICATION_ID": "your_discord_application_id_here",
        "LOG_LEVEL": "INFO",
        "PYTHONPATH": "/path/to/Discord-MCP/src"
      }
    }
  }
}

Claude桌面集成

对于Claude Desktop,请在配置文件中添加:

{
  "mcpServers": {
    "discord-server": {
      "command": "python",
      "args": ["/path/to/Discord-MCP/discord_server.py", "--transport", "stdio"],
      "env": {
        "DISCORD_BOT_TOKEN": "your_discord_bot_token_here",
        "DISCORD_APPLICATION_ID": "your_discord_application_id_here",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Discord Bot设置

1.创建Discord应用程序

  • 首选 Discord开发者门户
  • 点击“新建应用程序”并为其命名
  • 注意 应用标识符 (你需要这个)

2.创建Bot用户

  • 转到“Bot”部分
  • 点击“添加机器人”
  • 复制 机器人令牌 (确保安全!)
  • 启用必要 特权网关意图 如有需要

3.配置Bot权限

完整功能所需的权限:

  • 查看频道 -查看服务器中的频道
  • 发送消息 -通过MCP工具发送消息
  • 读取消息历史记录 -通过MCP资源读取消息
  • 管理邮件 -删除/编辑消息(可选)
  • 中等成员 -超时并删除用户的超时(审核)
  • Kick会员 -将用户从服务器上踢出(审核)
  • 禁止成员 -禁止用户使用服务器(审核)
  • 使用Slash命令 -用于未来的斜线命令支持(可选)

4.邀请Bot到服务器

  • 转到“OAuth2”>“URL生成器”
  • 选择“机器人”范围
  • 选择所需权限
  • 使用生成的URL邀请机器人到您的Discord服务器

5.获取Bot邀请URL

替换 YOUR_CLIENT_ID 使用您的Discord应用程序ID:

基本权限(读/写操作):

https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=3072&scope=bot

完全权限(包括审核):

https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=1099511627776&scope=bot

配置

环境变量

变量 必填 描述 默认值
DISCORD_BOT_TOKEN 是 Discord机器人令牌(最少50个字符) -
DISCORD_APPLICATION_ID 是 Discord应用程序ID(最少17个字符) -
ALLOWED_GUILDS 否 允许的公会ID逗号分隔列表 全部
ALLOWED_CHANNELS 否 逗号分隔的允许通道ID列表 全部
RATE_LIMIT_REQUESTS_PER_SECOND 否 API速率限制 5
RATE_LIMIT_BURST_SIZE 否 速率限制突发大小 10
LOG_LEVEL 否 日志记录级别(调试、信息、警告、错误) 信息
LOG_FORMAT 否 日志格式(文本、json) 文本
SERVER_NAME 否 自定义服务器名称 Discord MCP服务器
DEBUG 否 启用调试模式 false
DEVELOPMENT_MODE 否 启用开发功能 false

安全考虑

  • 🔒 令牌安全:永远不要将您的机器人令牌提交给版本控制
  • 🛡️ 公会限制:使用 ALLOWED_GUILDS 限制服务器访问
  • ⚡ 速率限制:配置为自动遵守Discord API限制
  • 🔐 权限:Bot只访问它有权限访问的频道
  • 📝 审计日志:记录所有操作以进行安全监控
  • 👮 适度安全:审核操作尊重Discord的角色层次结构-机器人无法审核具有更高角色的用户
  • 🛡️ 权限验证:所有审核工具在执行操作之前都会验证所需的Discord权限
  • ⚠️ 适度限制:超时限制为Discord的最长28天,禁令可以删除最长7天的消息

角色层次结构和适度限制

Discord强制执行严格的角色层次结构系统,机器人必须尊重所有审核操作:

角色层次结构规则

  • 机器人角色位置:机器人的最高角色必须高于目标用户的最高角色
  • 许可要求:机器人必须对每个审核操作拥有特定权限:
    • moderate_members 用于超时/超时操作
    • kick_members 用于踢击操作
    • ban_members 禁止行动
  • 所有者豁免权:无论角色层次结构如何,服务器所有者都不能由机器人进行审核
  • 机器人限制:机器人无法调节其他角色位置相同或更高的机器人

适度约束

  • 超时持续时间:最少1分钟,最多28天(Discord API限制)
  • 禁止删除消息:禁止时可以删除0-7天的消息历史记录
  • 审计日志集成:所有审核操作都会自动记录到Discord的审核日志中
  • 错误处理:明确的错误消息解释了层次结构违规和权限问题

最佳实践

  • 在服务器的角色层次结构中适当地定位机器人的角色
  • 仅授予必要的权限以尽量减少安全风险
  • 对所有审核操作使用描述性原因,以明确审核跟踪
  • 在生产使用之前,在受控环境中测试审核命令

api参考

资源

资源 URI模式 描述
公会列表 guilds:// 列出所有可访问的Discord服务器
频道列表 channels://{guild_id} 列出特定服务器中的频道
消息阅读 messages://{channel_id} 从频道读取消息
用户信息 user://{user_id} 获取用户配置文件信息
健康检查 health://status 服务器状态和配置

工具

工具 参数 描述 所需权限
list_guilds - 列出所有可访问的Discord服务器 查看频道
list_channels guild_id 列出特定服务器中的频道 查看频道
get_messages channel_id 从频道获取最新消息 读取消息历史记录
get_user_info user_id 获取用户配置文件信息 -
send_message channel_id, content, reply_to_message_id? 向频道发送消息 发送消息
send_dm user_id, content 向用户发送直接消息 -
read_direct_messages user_id, limit? 阅读DM对话 -
delete_message channel_id, message_id 删除邮件 管理邮件
edit_message channel_id, message_id, new_content 编辑邮件 管理邮件
timeout_user guild_id, user_id, duration_minutes?, reason? 用户超时(默认值:10分钟) 中等成员
untimeout_user guild_id, user_id, reason? 删除用户超时 适度成员
kick_user guild_id, user_id, reason? 从服务器上踢用户 踢会员
ban_user guild_id, user_id, reason?, delete_message_days? 从服务器中禁止用户 禁止成员

使用示例

使用工具(操作)

# List all accessible Discord servers
guilds = await client.call_tool("list_guilds", {})

# List channels in a specific server
channels = await client.call_tool("list_channels", {
    "guild_id": "123456789012345678"
})

# Get recent messages from a channel
messages = await client.call_tool("get_messages", {
    "channel_id": "123456789012345678"
})

# Get user information
user_info = await client.call_tool("get_user_info", {
    "user_id": "987654321098765432"
})

阅读消息(资源)

# Through MCP client - get recent messages from a channel
messages = await client.read_resource("messages://123456789012345678")

# Get user information
user_info = await client.read_resource("user://987654321098765432")

# List servers the bot has access to
guilds = await client.read_resource("guilds://")

发送消息

# Send a message to a channel
result = await client.call_tool("send_message", {
    "channel_id": "123456789012345678",
    "content": "Hello from AI assistant! 👋"
})

# Reply to a specific message
result = await client.call_tool("send_message", {
    "channel_id": "123456789012345678",
    "content": "This is a reply!",
    "reply_to_message_id": "111111111111111111"
})

直接消息

# Send a direct message
result = await client.call_tool("send_dm", {
    "user_id": "123456789012345678",
    "content": "Private message from AI assistant"
})

# Read DM conversation
conversation = await client.call_tool("read_direct_messages", {
    "user_id": "123456789012345678",
    "limit": 10
})

消息管理

# Delete a message (requires permissions)
result = await client.call_tool("delete_message", {
    "channel_id": "123456789012345678",
    "message_id": "111111111111111111"
})

# Edit a message (bot's own messages only)
result = await client.call_tool("edit_message", {
    "channel_id": "123456789012345678",
    "message_id": "222222222222222222",
    "new_content": "Updated message content"
})

用户审核

# Timeout a user for 30 minutes
result = await client.call_tool("timeout_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "duration_minutes": 30,
    "reason": "Disruptive behavior in chat"
})

# Timeout a user with default duration (10 minutes)
result = await client.call_tool("timeout_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "reason": "Spam messages"
})

# Remove timeout from a user
result = await client.call_tool("untimeout_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "reason": "Timeout period served"
})

# Kick a user from the server
result = await client.call_tool("kick_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "reason": "Violation of server rules"
})

# Ban a user from the server
result = await client.call_tool("ban_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "reason": "Repeated rule violations",
    "delete_message_days": 1  # Delete messages from last 1 day
})

# Ban a user without deleting messages
result = await client.call_tool("ban_user", {
    "guild_id": "123456789012345678",
    "user_id": "987654321098765432",
    "reason": "Serious rule violation"
})

发展

项目结构

Discord-MCP/
├── src/discord_mcp/          # Main package source
│   ├── __init__.py           # Package initialization and exports
│   ├── __main__.py           # Module entry point for `python -m discord_mcp`
│   ├── cli.py                # Command line interface with argument parsing
│   ├── config.py             # Configuration management using Pydantic Settings
│   ├── discord_client.py     # Discord API client wrapper
│   ├── resources.py          # MCP resources (read operations)
│   ├── server.py             # Main MCP server implementation with FastMCP
│   ├── tools.py              # MCP tools (write/action operations)
│   └── services/             # Service layer for business logic
│       ├── __init__.py       # Service exports (DiscordService, ContentFormatter, IDiscordService)
│       ├── interfaces.py     # Abstract service contracts (IDiscordService)
│       ├── discord_service.py # Centralized Discord operations service
│       ├── content_formatter.py # Content formatting and presentation logic
│       └── validation.py     # Validation utilities and mixins
├── tests/                    # Test suite
│   ├── services/             # Service layer tests
│   │   ├── test_discord_service.py    # DiscordService integration tests
│   │   ├── test_content_formatter.py  # ContentFormatter unit tests
│   │   ├── test_interfaces.py         # Interface compliance tests
│   │   └── test_validation.py         # Validation utility tests
│   ├── test_integration.py   # End-to-end integration tests
│   ├── test_tools.py         # MCP tools testing
│   ├── test_resources.py     # MCP resources testing
│   └── test_*.py             # Additional test modules
├── discord_server.py         # Standalone server entry point
├── mcp_server.py            # MCP dev compatible entry point
├── requirements.txt          # Dependencies
├── .env.example             # Environment template
└── README.md                # This file

服务层架构

Discord MCP Server实现了一个干净的服务层架构,具有适当的关注点分离,消除了代码重复,并为Discord操作提供了可维护的基础。

架构组件

  • 业务逻辑:DiscordService处理Discord API交互和业务规则
  • 显示逻辑:ContentFormatter处理所有格式和显示问题
  • 验证逻辑:ValidationMixin提供集中验证实用程序
  • 接口契约:IDiscordService定义服务操作契约

架构优势

  • 🔄 代码重用:消除了工具和资源之间85%以上的重复代码
  • 🧪 可测试性:清洁服务模拟,用于全面的单元测试
  • 🛠️ 可维护性:Discord操作和格式化的单一真实来源
  • 🚀 可扩展性:通过服务方法轻松添加新的Discord功能
  • 🎨 关注点分离:明确业务逻辑和演示之间的界限
  • 🔒 类型安全:接口合同确保正确实施

服务层组件

IDiscordService接口 (src/discord_mcp/services/interfaces.py)

class IDiscordService(ABC):
    """Abstract interface defining Discord operation contracts"""
    
    @abstractmethod
    async def get_guilds_formatted(self) -> str: ...
    
    @abstractmethod
    async def get_channels_formatted(self, guild_id: str) -> str: ...
    
    @abstractmethod
    async def get_messages_formatted(self, channel_id: str, limit: int = 50) -> str: ...
    
    # ... additional methods for user info, messaging, moderation, etc.

DiscordService实现 (src/discord_mcp/services/discord_service.py)

class DiscordService(IDiscordService):
    """Centralized Discord operations with dependency injection"""
    
    def __init__(
        self,
        discord_client: DiscordClient,
        settings: Settings,
        logger: Logger,
        content_formatter: Optional[ContentFormatter] = None,
    ):
        self._discord_client = discord_client
        self._settings = settings
        self._logger = logger
        self._content_formatter = content_formatter or ContentFormatter(settings)
    
    async def get_guilds_formatted(self) -> str:
        # Business logic: fetch and filter guilds
        guilds = await self._discord_client.get_user_guilds()
        # Presentation logic: delegate to ContentFormatter
        return self._content_formatter.format_guild_info(guilds)

内容格式化工具实现 (src/discord_mcp/services/content_formatter.py)

class ContentFormatter:
    """Handles all Discord content formatting operations"""
    
    def __init__(self, settings: Optional[Settings] = None):
        self._settings = settings
    
    def format_guild_info(self, guilds: list) -> str:
        """Format guild information into consistent markdown structure"""
        # Centralized formatting logic for guilds
    
    def format_channel_info(self, channels: list, guild_name: str) -> str:
        """Format channel information into consistent markdown structure"""
        # Centralized formatting logic for channels
    
    # ... additional formatting methods for messages, users, timestamps, etc.

服务集成模式

# Tools and resources use the service through dependency injection
async def list_guilds() -> str:
    ctx = server.get_context()
    discord_service: IDiscordService = ctx.request_context.lifespan_context["discord_service"]
    return await discord_service.get_guilds_formatted()

使用服务层进行测试

服务层支持干净、隔离的测试:

# Service unit testing
@pytest.fixture
def mock_discord_service():
    return Mock(spec=IDiscordService)

async def test_list_guilds_tool(mock_discord_service):
    # Test tools in isolation by mocking the service
    mock_discord_service.get_guilds_formatted.return_value = "# Test Guilds\n..."
    # ... test implementation

# ContentFormatter unit testing
@pytest.fixture
def content_formatter():
    return ContentFormatter()

def test_format_guild_info(content_formatter):
    guilds = [{"id": "123", "name": "Test Guild"}]
    result = content_formatter.format_guild_info(guilds)
    assert "Test Guild" in result

运行测试

# Run all tests
pytest tests/

# Run with coverage
pytest tests/ --cov=src/discord_mcp

# Run integration tests
python test_mcp_integration.py

# Test local server functionality
python test_local_server.py

代码质量

# Format code
black src/ tests/
isort src/ tests/

# Type checking
mypy src/

# Linting
flake8 src/ tests/

添加新功能

通过服务层架构,添加新的Discord功能得以简化:

  1. 服务方法:添加新方法 IDiscordService 接口和实现 DiscordService

    # Add to interfaces.py
    @abstractmethod
    async def new_discord_feature(self, param: str) -> str: ...
    
    # Implement in discord_service.py
    async def new_discord_feature(self, param: str) -> str:
        # Centralized implementation with error handling
    
  2. 工具:添加到 src/discord_mcp/tools.py 使用该服务

    async def new_tool() -> str:
        ctx = server.get_context()
        discord_service = ctx.request_context.lifespan_context["discord_service"]
        return await discord_service.new_discord_feature(param)
    
  3. 资源:添加到 src/discord_mcp/resources.py 使用该服务

  4. 配置:更新 src/discord_mcp/config.py 如有需要

  5. 测试:在中添加服务单元测试和集成测试 tests/

服务开发效益

  • 单一实现:在服务中写入一次Discord逻辑
  • 一致的错误处理:自动错误管理和日志记录
  • 易于测试:模拟用于隔离测试的服务接口
  • 类型安全:接口合同确保正确实施
  • 适度支持:对所有审核操作进行集中权限验证和角色层次检查

服务层开发优势

  • 单一实现:在服务中写入一次Discord逻辑
  • 一致的错误处理:自动错误管理和日志记录
  • 易于测试:模拟用于隔离测试的服务接口
  • 类型安全:接口合同确保正确实施
  • 集中式格式化:ContentFormatter提供一致的输出格式
  • 适度支持:对所有审核操作进行集中权限验证和角色层次检查

故障排除

常见问题

1.机器人令牌问题

症状:身份验证错误,“Bot令牌无效” 解决方案:

  • 验证令牌格式(应为~70个字符)
  • 在Discord开发者门户中检查令牌
  • 确保令牌以正确的前缀开头
  • 如果令牌泄露,请重新生成令牌

2.许可问题

症状:“缺少权限”、“禁止”错误 解决方案:

  • 检查Discord服务器设置中的机器人权限
  • 验证bot是否具有执行该操作所需的权限
  • 以正确的权限重新邀请机器人
  • 检查特定频道的权限覆盖

5.适度问题

症状:“角色层次结构违规”,“无法审核此用户” 解决方案:

  • 确保机器人的角色定位高于目标用户的最高角色
  • 验证bot是否具有所需的审核权限(moderate_members、kick_members、ban_members)
  • 检查目标用户是否不是服务器所有者
  • 确认超时时间在1分钟至28天范围内
  • 验证禁令消息删除天数是否在0-7范围内

3.MCP集成问题

症状:“仍在加载”,连接超时 解决方案:

  • 验证环境变量是否设置正确
  • 检查MCP配置文件语法
  • 手动启动测试服务器
  • 查看日志中的特定错误消息

4.费率限制

症状:响应缓慢,“速率受限”错误 解决方案:

  • 降低请求频率
  • 调整 RATE_LIMIT_REQUESTS_PER_SECOND 设置
  • 实现请求批处理
  • 监控Discord API费率限制

调试模式

启用全面调试:

# Set debug environment
export LOG_LEVEL=DEBUG
export LOG_FORMAT=json

# Run with debug output
python discord_server.py --transport sse --log-level DEBUG 2>&1 | tee debug.log

健康监测

检查服务器运行状况:

# For SSE mode
curl http://localhost:8000/health

# Check MCP resources
python -c "
import asyncio
from mcp.client.session import ClientSession
# ... health check code
"

演出

基准测试

  • 消息阅读:~100ms平均响应时间
  • 消息发送:平均响应时间~200ms
  • 速率限制:5个请求/秒(可配置)
  • 内存使用:~50MB基线
  • 并发连接:支持多个MCP客户端

优化提示

  • 对大型消息集使用分页
  • 对频繁访问的数据实施缓存
  • 监控速率限制以避免API阻塞
  • 在生产中使用适当的日志级别

贡献

我们欢迎捐款!请遵循以下指南:

  1. 分叉存储库
  2. 创建要素分支 (git checkout -b feature/amazing-feature)
  3. 进行更改 有适当的文件
  4. 添加测试 对于新功能
  5. 运行测试套件 (pytest tests/)
  6. 检查代码质量 (black, isort, mypy)
  7. 提交拉取请求

开发设置

# Clone your fork
git clone https://github.com/your-username/Discord-MCP.git
cd Discord-MCP

# Set up development environment
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt  # If available

# Run tests
pytest tests/

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

支持和资源

更新日志

v0.4.0(最新版本)

  • ✅ 内容格式化程序提取:完成了将格式化逻辑与业务逻辑分离的重大重构
  • ✅ 消除代码重复通过集中格式化,重复代码减少了85%以上
  • ✅ 增强架构:在DiscordService和ContentFormatter之间实现了清晰的关注点分离
  • ✅ 提高可测试性:为ContentFormatter添加了全面的单元测试,覆盖率超过95%
  • ✅ 向后兼容:在重构期间保持了100%的API兼容性
  • ✅ 错误处理:为格式错误的数据和边缘情况添加了强大的错误处理
  • ✅ 文档更新:更新项目结构和架构文件

v0.3.0

  • ✅ 添加了全面的用户审核工具(timeout_user, untimeout_user, kick_user, ban_user)
  • ✅ 对所有审核操作实施了角色层次验证
  • ✅ 为审核操作添加了权限验证
  • ✅ 增强的服务层架构,实现更好的代码组织
  • ✅ 添加了全面的审核文档和示例
  • ✅ 所有审核操作的集成审核日志记录

v0.2.0版本

  • ✅ 添加 read_direct_messages 双向DM支持工具
  • ✅ 实现了双传输支持(stdio+SSE)
  • ✅ 添加了全面的命令行界面
  • ✅ 增强的错误处理和日志记录
  • ✅ 添加了健康检查端点
  • ✅ 改进的文档和示例
  • ✅ 添加了全面的测试套件

v0.1.0(初始版本)

  • ✅ 基本MCP服务器实现
  • ✅ Discord API集成
  • ✅ 频道和消息操作
  • ✅ 直接消息支持
  • ✅ Amazon Q CLI集成

内置于❤️ 对于Discord社区