Skip to main content
Glama

MCP-Discord

by jar285
MIT License
25
1
  • Linux
  • Apple
mcp-discord-setup.md5.57 kB
# MCP-Discord Setup and Integration with Claude Desktop ## Overview This document outlines the process of setting up and integrating the MCP-Discord server with Claude Desktop. The MCP-Discord server enables Claude to interact with Discord through the Model Context Protocol (MCP). ## What We Achieved 1. **Discord Bot Setup** - Created a Discord bot through the Discord Developer Portal - Configured the necessary permissions and intents - Added the bot to a Discord server 2. **MCP-Discord Server Setup** - Configured the Discord bot token in the environment - Built the TypeScript code with `npm run build` - Created an enhanced startup script for better debugging and error handling 3. **Claude Desktop Integration** - Configured Claude Desktop to use the MCP-Discord server - Added default server and channel IDs for easier usage - Enhanced the MCP-Discord server to provide better error handling and debugging 4. **Feature Enhancements** - Added a new `discord_list_guilds` function to list all available Discord servers - Modified existing functions to use default server and channel IDs when specific ones aren't provided - Improved error handling and debugging information ## Key Changes Made ### 1. Enhanced Startup Script Created a `start-discord.js` script that: - Loads environment variables from the .env file - Sets default server and channel IDs - Redirects console.log to stderr to avoid JSON parsing issues in Claude Desktop - Tests the Discord connection directly before starting the MCP server - Provides detailed error information if anything goes wrong ### 2. Added New Discord List Guilds Function Added a new `discord_list_guilds` function that: - Lists all available guilds without requiring a guild ID - Returns detailed information about each guild, including: - Guild ID - Guild name - Member count - List of channels with their IDs, names, and types ### 3. Modified Existing Functions Updated several functions to use default server and channel IDs when specific ones aren't provided: - `discord_send` - Can now use a default channel ID - `discord_get_server_info` - Can now use a default server ID ## Usage Examples ### Listing Available Discord Servers ``` Can you show me what Discord servers you have access to? ``` ### Sending a Message to the Default Channel ``` Can you send a message to the default channel saying "Hello from Claude!"? ``` ### Getting Information About a Server ``` Can you get information about the Discord server? ``` ## Troubleshooting If you encounter issues with the MCP-Discord server: 1. Check the Claude Desktop logs for error messages 2. Verify that your Discord bot is online and in the server 3. Make sure the bot has the necessary permissions in the server 4. Check that the server ID and channel ID are correct ## Future Improvements Potential enhancements for the future: 1. Add more comprehensive error handling 2. Implement caching of server and channel information 3. Add support for more Discord features (voice channels, roles, etc.) 4. Create a web interface for easier configuration ## Conclusion The MCP-Discord server is now successfully integrated with Claude Desktop, allowing Claude to interact with Discord. The enhancements we've made make it easier to use and more robust, providing better error handling and debugging information. ## Quick-Start Guide for Demos When showing off this project to others, here's the minimal setup process: ### Prerequisites - Your Discord bot must be created and added to a server - The bot token should be in your `.env` file - Claude Desktop should be installed ### Step 1: Build the Project First, build the TypeScript code: ```bash cd /Users/franklind.rosarioabreu/mcp-discord npm run build ``` ### Step 2: Verify Claude Desktop Configuration Ensure your Claude Desktop configuration file at `~/Library/Application Support/Claude/claude_desktop_config.json` contains the correct MCP-Discord server configuration: ```json { "mcpServers": { "discord": { "command": "node", "args": [ "/Users/franklind.rosarioabreu/mcp-discord/start-discord.js" ], "env": { "DISCORD_TOKEN": "YOUR_DISCORD_BOT_TOKEN" } } } } ``` ### Step 3: Start Claude Desktop Launch Claude Desktop. The MCP-Discord server will start automatically when Claude Desktop starts. ### Step 4: Test the Integration In a new conversation with Claude, try these commands: ``` Can you show me what Discord servers you have access to? ``` ``` Can you send a message to the default channel saying "Hello from a demo!"? ``` ### Important Notes - The Discord bot does not need to be separately online - it will be started by the MCP-Discord server when Claude Desktop launches - You don't need to manually run the MCP-Discord server - Claude Desktop will start it based on the configuration - If you make changes to the code, you need to rebuild with `npm run build` and restart Claude Desktop - The bot will only be online when Claude Desktop is running with the MCP-Discord server configured ### Shutting Down - When closing Claude Desktop, the MCP-Discord server processes might continue running in the background - This can cause the bot to appear online in Discord even after Claude Desktop is closed - To properly shut down all MCP-Discord processes, you can run: ```bash pkill -f "node.*discord" ``` - Alternatively, you can restart your computer to ensure all processes are terminated

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jar285/mcp-discord'

If you have feedback or need assistance with the MCP directory API, please join our Discord server