discord-self-mcp
v1.1.2
Published
MCP server for Discord using selfbot to read channels
Downloads
52
Maintainers
Readme
Discord Self MCP
An MCP (Model Context Protocol) server that allows AIs to access Discord using selfbot to read messages, manage channels, get user information, and more.
Installation and Usage
Option 1: Direct use with npx (no installation)
You don't need to install anything. Simply configure your MCP client with:
{
"mcpServers": {
"discord": {
"command": "npx",
"args": ["-y", "discord-self-mcp"],
"env": {
"DISCORD_TOKEN": "your_discord_token_here"
}
}
}
}Option 2: Global installation
npm install -g discord-self-mcpThen configure your MCP client:
{
"mcpServers": {
"discord": {
"command": "discord-self-mcp",
"env": {
"DISCORD_TOKEN": "your_discord_token_here"
}
}
}
}Option 3: Local development
# Clone the repository
git clone [repo-url]
cd discord-self-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Configure in your MCP client with the local pathDiscord Token Configuration
The Discord token is passed as an environment variable from your MCP client. DO NOT use local .env files.
How to get your Discord token:
Method 1: Using Console Script (Recommended)
- Open Discord in your browser
- Press F12 to open developer tools
- Go to the "Console" tab
- Paste the following code and press Enter:
window.webpackChunkdiscord_app.push([
[Symbol()],
{},
(req) => {
if (!req.c) return
for (let m of Object.values(req.c)) {
try {
if (!m.exports || m.exports === window) continue
if (m.exports?.getToken) return copy(m.exports.getToken())
for (let ex in m.exports) {
if (
m.exports?.[ex]?.getToken &&
m.exports[ex][Symbol.toStringTag] !== 'IntlMessagesProxy'
)
return copy(m.exports[ex].getToken())
}
} catch {}
}
},
])
window.webpackChunkdiscord_app.pop()
console.log('%cWorked!', 'font-size: 50px')
console.log(`%cYou now have your token in the clipboard!`, 'font-size: 16px')- Your token will be automatically copied to the clipboard
Method 2: Manual Network Inspection
- Open Discord in your browser
- Press F12 to open developer tools
- Go to the "Network" tab
- Look for any request to Discord's API
- In the headers, look for "Authorization"
Available Tools
📧 Message Management
mcp_discord_read_channel
Read messages from a Discord channel.
Parameters:
channelId(string, required): The Discord channel ID to read messages fromlimit(number, optional): Number of messages to fetch (default: 50, max: 100)
mcp_discord_search_messages
Search for messages in a Discord channel by content, author, or date range.
Parameters:
channelId(string, required): The Discord channel ID to search messages inquery(string, optional): Text to search for in message contentauthorId(string, optional): Optional: Filter by author IDlimit(number, optional): Number of messages to search through (default: 100, max: 500)before(string, optional): Optional: Search messages before this message IDafter(string, optional): Optional: Search messages after this message ID
mcp_discord_send_message
Send a message to a specific Discord channel.
Parameters:
channelId(string, required): The Discord channel ID to send the message tocontent(string, required): The message content to sendreplyToMessageId(string, optional): Optional: Message ID to reply to
🏰 Guild and Channel Management
mcp_discord_list_channels
List all accessible channels for the current user.
Parameters:
guildId(string, optional): Optional: Filter channels by guild ID
mcp_discord_list_guilds
List all guilds (servers) the user is in.
Parameters:
- None required
👥 User Management
mcp_discord_get_user_info
Get information about the logged-in user.
Parameters:
- None required
mcp_discord_list_guild_members
List members of a specific Discord guild/server.
Parameters:
guildId(string, required): The Discord guild ID to list members fromlimit(number, optional): Number of members to fetch (default: 100, max: 1000)includeRoles(boolean, optional): Whether to include role information for each member
Usage Examples in Claude
Once configured, you can use commands like:
Server Management
- "List my Discord servers"
- "Show all channels from server [ID]"
- "How many members does server [ID] have?"Message Reading
- "Read the last 20 messages from channel [ID]"
- "Search for messages containing 'meeting' in channel [ID]"
- "Show messages from user [ID] in channel [ID]"Interaction
- "Send a message to channel [ID] saying 'Hello world'"
- "Reply to message [ID] with 'Thanks for the information'"User Information
- "Show my Discord information"
- "List members of server [ID] with their roles"Features
- ✅ Message reading with advanced filters
- ✅ Message searching by content, author, and date
- ✅ Message sending with reply support
- ✅ Server management and channel listing
- ✅ User information and member management
- ✅ Robust error handling
- ✅ Complete parameter validation
- ✅ Relative time formatting (e.g., "2 hours ago")
- ✅ Support for attachments and embeds
Project Structure
src/
├── index.ts # Main MCP server
├── types.ts # TypeScript type definitions
├── tool-definitions.ts # MCP tool schemas
├── message-handlers.ts # Message handling functions
├── guild-handlers.ts # Guild/server handling functions
├── user-handlers.ts # User handling functions
└── utils.ts # Common utilitiesWarning
This project uses selfbot, which goes against Discord's terms of service. Use it at your own risk and only for educational or personal purposes.
Contributing
Contributions are welcome! Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/new-functionality) - Commit your changes (
git commit -am 'feat: add new functionality') - Push to the branch (
git push origin feature/new-functionality) - Open a Pull Request
