import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';
/**
* Discord MCP Prompts
*
* Prompts provide reusable conversation templates that guide AI interactions
* for common Discord server management tasks. Users can discover and invoke
* these prompts to start structured workflows.
*/
export function registerDiscordPrompts(server: McpServer): void {
// Server Audit Prompt
server.registerPrompt(
'server-audit',
{
title: 'Server Audit Checklist',
description: 'Generate a comprehensive audit checklist and analysis for a Discord server',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server to audit'),
},
},
async ({ guildId }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Please perform a comprehensive security and configuration audit of Discord server ${guildId}.
Use the available tools to gather information and analyze:
1. **Server Configuration**
- Basic server settings and features
- Verification level and content filter
- System channel configuration
2. **Role Hierarchy & Permissions**
- Review all roles and their positions
- Identify overly permissive roles
- Check for dangerous permission combinations (Administrator, Manage Server, etc.)
3. **Channel Organization**
- List all channels and categories
- Review channel permission overwrites
- Identify channels with unusual permissions
4. **Moderation & AutoMod**
- Review AutoMod rules if configured
- Check recent audit log for moderation actions
- Assess moderation tool coverage
5. **Security Concerns**
- Webhooks that could be abused
- Invite links and their settings
- Bot permissions review
Please provide a detailed report with:
- Current state summary
- Identified issues (Critical/Warning/Info)
- Specific recommendations for improvements
- Priority order for addressing issues`,
},
},
],
})
);
// Moderation Report Prompt
server.registerPrompt(
'moderation-report',
{
title: 'Moderation Activity Report',
description: 'Generate a summary of recent moderation activity in a server',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server'),
actionTypes: z
.string()
.optional()
.describe(
'Comma-separated list of action types to include (e.g., "MEMBER_BAN_ADD,MEMBER_KICK,MESSAGE_DELETE")'
),
},
},
async ({ guildId, actionTypes }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Generate a moderation activity report for Discord server ${guildId}.
${actionTypes ? `Focus on these action types: ${actionTypes}` : 'Include all moderation-related actions.'}
Please use the audit log tools to gather data and provide:
1. **Activity Summary**
- Total moderation actions in the available audit log period
- Breakdown by action type (bans, kicks, timeouts, message deletions, etc.)
- Most active moderators
2. **Recent Actions**
- List of recent moderation actions with details
- Who performed each action and why (if reason provided)
- Affected users
3. **Patterns & Trends**
- Any concerning patterns (e.g., same user being actioned multiple times)
- Unusual activity spikes
- Potential issues to investigate
4. **Recommendations**
- Suggestions for improving moderation coverage
- AutoMod rules that might help
- Any gaps in moderation activity
Format the report in a clear, readable structure suitable for sharing with server leadership.`,
},
},
],
})
);
// Channel Setup Guide Prompt
server.registerPrompt(
'channel-setup-guide',
{
title: 'Channel Setup Guide',
description: 'Get guidance for setting up a new channel with proper permissions',
argsSchema: {
channelType: z
.enum(['text', 'voice', 'announcement', 'forum', 'stage'])
.describe('The type of channel to set up'),
purpose: z.string().describe('The intended purpose of the channel (e.g., "staff discussion", "public announcements", "gaming voice chat")'),
guildId: z.string().optional().describe('Server ID to analyze existing structure for context'),
},
},
async ({ channelType, purpose, guildId }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `I need help setting up a new ${channelType} channel for: "${purpose}"
${guildId ? `Server ID for context: ${guildId} - Please use list_channels and list_roles to understand the existing server structure.` : ''}
Please provide comprehensive guidance on:
1. **Channel Configuration**
- Recommended channel name (following Discord conventions)
- Appropriate category placement
- Channel topic/description
- ${channelType === 'text' ? 'Slowmode settings if applicable' : ''}
- ${channelType === 'voice' ? 'User limit and bitrate recommendations' : ''}
- ${channelType === 'forum' ? 'Default tags and post guidelines' : ''}
2. **Permission Setup**
- Which roles should have access
- Specific permissions to grant/deny for each role
- @everyone permissions (what to explicitly deny)
- Any special permissions for moderators
3. **Best Practices**
- Common mistakes to avoid
- Security considerations
- User experience tips
4. **Implementation Steps**
- Step-by-step instructions using the available tools
- Specific tool calls needed (create_channel, set_channel_permission, etc.)
- Verification steps after creation
Please tailor recommendations specifically for a ${channelType} channel with the purpose: "${purpose}"`,
},
},
],
})
);
// Role Hierarchy Review Prompt
server.registerPrompt(
'role-hierarchy-review',
{
title: 'Role Hierarchy Review',
description: 'Analyze and suggest improvements to server role hierarchy',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server to analyze'),
},
},
async ({ guildId }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Please analyze the role hierarchy for Discord server ${guildId}.
Use list_roles and get_role_info to examine the current structure, then provide:
1. **Current Hierarchy Overview**
- Visual representation of role order (highest to lowest)
- Permission summary for each role
- Role colors and hoisting status
2. **Issues Identified**
- Roles with overly broad permissions
- Dangerous permission combinations
- Roles positioned incorrectly in hierarchy
- Redundant or unused roles
- Roles that can modify roles above them
3. **Security Analysis**
- Roles with Administrator permission
- Roles that can manage server/channels/roles
- Potential privilege escalation paths
- Bot role positioning concerns
4. **Recommendations**
- Suggested hierarchy reorganization
- Permissions to add or remove from specific roles
- Roles to merge or split
- New roles that might be beneficial
5. **Implementation Plan**
- Specific modify_role commands needed
- Order of operations (to avoid permission issues during changes)
- Rollback plan if issues occur
Please prioritize security while maintaining practical server management capabilities.`,
},
},
],
})
);
// Permission Troubleshooting Prompt
server.registerPrompt(
'permission-troubleshoot',
{
title: 'Permission Troubleshooting',
description: 'Diagnose why a user cannot perform a specific action',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server'),
userId: z.string().describe('The ID of the user experiencing the issue'),
channelId: z.string().optional().describe('The channel ID where the issue occurs (if channel-specific)'),
issue: z.string().describe('Description of what the user cannot do (e.g., "cannot send messages", "cannot see channel", "cannot manage roles")'),
},
},
async ({ guildId, userId, channelId, issue }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Help diagnose a permission issue in Discord server ${guildId}.
**User:** ${userId}
${channelId ? `**Channel:** ${channelId}` : '**Issue is server-wide**'}
**Problem:** ${issue}
Please investigate using the available tools:
1. **User Analysis**
- Use get_member_info to see the user's roles
- List all permissions the user has from their roles
2. **${channelId ? 'Channel Permission Analysis' : 'Server Permission Analysis'}**
${channelId ? `- Use get_channel_permissions to see channel overwrites
- Check @everyone overwrites
- Check each of the user's role overwrites
- Check user-specific overwrites` : '- Check server-level permissions from roles'}
3. **Permission Calculation**
- Show how Discord calculates the final permissions
- Identify which role/overwrite is blocking the action
- Explain the permission inheritance chain
4. **Root Cause**
- Clearly identify why the user cannot perform the action
- Explain which specific permission is missing or denied
5. **Solution Options**
- Provide multiple ways to fix the issue
- Recommend the most appropriate solution
- Include specific tool commands to implement the fix
- Warn about any security implications
Please be thorough - permission issues often have non-obvious causes.`,
},
},
],
})
);
// Welcome Message Template Prompt
server.registerPrompt(
'welcome-message-template',
{
title: 'Welcome Message Template',
description: 'Generate a customized server welcome message',
argsSchema: {
serverName: z.string().describe('The name of the Discord server'),
serverPurpose: z.string().describe('Brief description of what the server is for'),
tone: z
.enum(['professional', 'casual', 'friendly', 'gaming', 'community'])
.describe('The tone/style for the welcome message'),
includeRules: z.boolean().optional().describe('Whether to include a rules summary'),
includeRoleInfo: z.boolean().optional().describe('Whether to include information about available roles'),
},
},
async ({ serverName, serverPurpose, tone, includeRules, includeRoleInfo }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Create a welcome message for the Discord server "${serverName}".
**Server Purpose:** ${serverPurpose}
**Tone:** ${tone}
**Include Rules Summary:** ${includeRules ? 'Yes' : 'No'}
**Include Role Information:** ${includeRoleInfo ? 'Yes' : 'No'}
Please create:
1. **Main Welcome Message**
- Engaging greeting appropriate for the ${tone} tone
- Brief introduction to the server
- What new members can expect
2. **Getting Started Section**
- First steps for new members
- Important channels to check out
- How to get help
${includeRules ? `3. **Rules Summary**
- Key rules in brief, friendly format
- Consequences overview
- Where to find full rules` : ''}
${includeRoleInfo ? `4. **Roles Information**
- Available self-assignable roles
- How to get special roles
- Role meanings/purposes` : ''}
5. **Formatting**
- Use Discord markdown (bold, italic, headers)
- Include relevant emojis for visual appeal
- Keep it scannable (not a wall of text)
Please provide the message ready to copy/paste, formatted for Discord. Also provide a shorter variant for mobile-friendly viewing.`,
},
},
],
})
);
// Announcement Draft Prompt
server.registerPrompt(
'announcement-draft',
{
title: 'Announcement Draft',
description: 'Draft a server announcement with proper formatting',
argsSchema: {
topic: z.string().describe('The main topic/subject of the announcement'),
details: z.string().describe('Key details to include in the announcement'),
urgency: z
.enum(['low', 'normal', 'high', 'critical'])
.describe('Urgency level of the announcement'),
mentionEveryone: z.boolean().optional().describe('Whether @everyone should be mentioned'),
},
},
async ({ topic, details, urgency, mentionEveryone }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Draft an announcement for a Discord server.
**Topic:** ${topic}
**Details:** ${details}
**Urgency:** ${urgency}
**Mention @everyone:** ${mentionEveryone ? 'Yes' : 'No (use appropriate role mentions instead)'}
Please create:
1. **Main Announcement**
- ${urgency === 'critical' ? 'URGENT header with warning emoji' : urgency === 'high' ? 'Important header with attention-grabbing emoji' : 'Appropriate header for the topic'}
- Clear, concise main message
- All necessary details organized logically
- ${mentionEveryone ? '@everyone mention at the start' : 'Suggest appropriate role to mention'}
2. **Formatting Guidelines**
- Use Discord markdown effectively
- Include relevant emojis
- Use line breaks for readability
- ${urgency === 'critical' || urgency === 'high' ? 'Make important info stand out with bold/caps' : 'Keep formatting clean and professional'}
3. **Call to Action**
- What members should do (if anything)
- Deadline or timeframe (if applicable)
- Where to ask questions
4. **Additional Versions**
- Provide a TL;DR version
- Suggest a follow-up message format if needed
Output the announcement ready to copy/paste into Discord.`,
},
},
],
})
);
// AutoMod Setup Guide Prompt
server.registerPrompt(
'automod-setup-guide',
{
title: 'AutoMod Setup Guide',
description: 'Get guidance for configuring Discord AutoMod rules',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server'),
concerns: z
.string()
.optional()
.describe(
'Specific concerns to address (e.g., "spam", "slurs", "links", "raid protection")'
),
},
},
async ({ guildId, concerns }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Help me set up AutoMod for Discord server ${guildId}.
${concerns ? `**Specific Concerns:** ${concerns}` : '**Goal:** Comprehensive moderation coverage'}
First, use list_automod_rules to check existing configuration, then provide:
1. **Current State Analysis**
- Existing AutoMod rules and their effectiveness
- Gaps in current coverage
- Potential conflicts between rules
2. **Recommended Rules**
**Spam Protection:**
- Mention spam limits
- Message spam detection
- Duplicate message blocking
**Content Filtering:**
- Profanity/slur filtering (keyword-based)
- Commonly blocked phrases
- Regex patterns for evasion attempts
**Link Safety:**
- Suspicious link blocking
- Allowed domains whitelist
- Invite link restrictions
**Raid Protection:**
- Account age requirements
- Rapid join detection triggers
- Mass mention blocking
3. **Configuration Details**
For each recommended rule, provide:
- Rule name and description
- Trigger type and conditions
- Actions (alert, timeout, block)
- Exempt roles and channels
4. **Implementation Priority**
- Which rules to set up first
- Testing recommendations
- Monitoring and adjustment tips
5. **Exempt Considerations**
- Which roles should be exempt
- Channels that might need exemptions
- Balance between protection and usability
Please be specific about Discord's AutoMod capabilities and limitations.`,
},
},
],
})
);
// Webhook Security Audit Prompt
server.registerPrompt(
'webhook-security-audit',
{
title: 'Webhook Security Audit',
description: 'Audit webhooks for security concerns and unauthorized usage',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server to audit'),
},
},
async ({ guildId }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Perform a webhook security audit for Discord server ${guildId}.
Use list_guild_webhooks to get all webhooks, then analyze:
1. **Webhook Inventory**
- List all webhooks with their channels
- Creation date and creator (if available)
- Webhook purpose (based on name/avatar)
2. **Security Assessment**
For each webhook, evaluate:
- Is it actively needed/used?
- Is the name/avatar appropriate?
- Is it in an appropriate channel?
- Could it be used for impersonation?
3. **Risk Analysis**
- Webhooks in sensitive channels (announcements, rules, etc.)
- Webhooks with generic/suspicious names
- Unused webhooks that should be removed
- Webhooks that could impersonate staff/bots
4. **Recommendations**
- Webhooks to delete immediately
- Webhooks to monitor
- Channel permissions to restrict webhook creation
- Best practices for webhook management
5. **Action Items**
- Specific delete_webhook commands for removal
- modify_webhook commands to improve naming
- Permission changes to prevent unauthorized webhook creation
Webhooks can be a significant security risk - be thorough in this audit.`,
},
},
],
})
);
// Server Onboarding Setup Prompt
server.registerPrompt(
'member-onboarding-review',
{
title: 'Member Onboarding Review',
description: 'Review and suggest improvements for new member experience',
argsSchema: {
guildId: z.string().describe('The ID of the Discord server'),
},
},
async ({ guildId }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Review the new member onboarding experience for Discord server ${guildId}.
Use the available tools to examine:
- Server configuration (get_server_info)
- Channel structure (list_channels)
- Role setup (list_roles)
Then analyze and provide recommendations for:
1. **First Impressions**
- Server icon, banner, description
- Verification level appropriateness
- Welcome channel setup
2. **Channel Discovery**
- Are channels well-organized?
- Can new members find what they need?
- Is there a clear starting point?
- Are sensitive channels properly hidden?
3. **Role Assignment**
- Self-assignable roles available?
- Clear path to getting roles?
- Default permissions for new members
4. **Information Access**
- Rules easily accessible?
- FAQ or help resources?
- Staff contact methods clear?
5. **Engagement Path**
- Introduction channel for new members?
- Easy first interactions?
- Community integration opportunities?
6. **Improvement Recommendations**
- Priority changes to implement
- Quick wins for better onboarding
- Longer-term improvements
- Tools/bots that could help
Please provide actionable recommendations with specific implementation steps using the available Discord MCP tools.`,
},
},
],
})
);
}